Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: cc/ImageLayerChromium.cpp

Issue 11074009: cc: Remove LayerTextureUpdater::Texture::updateRect() callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #if USE(ACCELERATED_COMPOSITING) 7 #if USE(ACCELERATED_COMPOSITING)
8 8
9 #include "ImageLayerChromium.h" 9 #include "ImageLayerChromium.h"
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "CCLayerTreeHost.h" 12 #include "CCLayerTreeHost.h"
13 #include "CCTextureUpdateQueue.h"
13 #include "LayerTextureUpdater.h" 14 #include "LayerTextureUpdater.h"
14 #include "PlatformColor.h" 15 #include "PlatformColor.h"
15 16
16 namespace cc { 17 namespace cc {
17 18
18 class ImageLayerTextureUpdater : public LayerTextureUpdater { 19 class ImageLayerTextureUpdater : public LayerTextureUpdater {
19 public: 20 public:
20 class Texture : public LayerTextureUpdater::Texture { 21 class Texture : public LayerTextureUpdater::Texture {
21 public: 22 public:
22 Texture(ImageLayerTextureUpdater* textureUpdater, PassOwnPtr<CCPrioritiz edTexture> texture) 23 Texture(ImageLayerTextureUpdater* textureUpdater, PassOwnPtr<CCPrioritiz edTexture> texture)
23 : LayerTextureUpdater::Texture(texture) 24 : LayerTextureUpdater::Texture(texture)
24 , m_textureUpdater(textureUpdater) 25 , m_textureUpdater(textureUpdater)
25 { 26 {
26 } 27 }
27 28
28 virtual void updateRect(CCResourceProvider* resourceProvider, const IntR ect& sourceRect, const IntSize& destOffset) OVERRIDE 29 virtual void update(CCTextureUpdateQueue& queue, const IntRect& sourceRe ct, const IntSize& destOffset, bool partialUpdate, CCRenderingStats&) OVERRIDE
29 { 30 {
30 textureUpdater()->updateTextureRect(resourceProvider, texture(), sou rceRect, destOffset); 31 textureUpdater()->updateTexture(queue, texture(), sourceRect, destOf fset, partialUpdate);
31 } 32 }
32 33
33 private: 34 private:
34 ImageLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } 35 ImageLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
35 36
36 ImageLayerTextureUpdater* m_textureUpdater; 37 ImageLayerTextureUpdater* m_textureUpdater;
37 }; 38 };
38 39
39 static PassRefPtr<ImageLayerTextureUpdater> create() 40 static PassRefPtr<ImageLayerTextureUpdater> create()
40 { 41 {
41 return adoptRef(new ImageLayerTextureUpdater()); 42 return adoptRef(new ImageLayerTextureUpdater());
42 } 43 }
43 44
44 virtual ~ImageLayerTextureUpdater() { } 45 virtual ~ImageLayerTextureUpdater() { }
45 46
46 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture( 47 virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(
47 CCPrioritizedTextureManager* manager) OVERRIDE 48 CCPrioritizedTextureManager* manager) OVERRIDE
48 { 49 {
49 return adoptPtr(new Texture(this, CCPrioritizedTexture::create(manager)) ); 50 return adoptPtr(new Texture(this, CCPrioritizedTexture::create(manager)) );
50 } 51 }
51 52
52 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI DE 53 virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRI DE
53 { 54 {
54 return PlatformColor::sameComponentOrder(textureFormat) ? 55 return PlatformColor::sameComponentOrder(textureFormat) ?
55 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdate r::SampledTexelFormatBGRA; 56 LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdate r::SampledTexelFormatBGRA;
56 } 57 }
57 58
58 void updateTextureRect(CCResourceProvider* resourceProvider, CCPrioritizedTe xture* texture, const IntRect& sourceRect, const IntSize& destOffset) 59 void updateTexture(CCTextureUpdateQueue& queue, CCPrioritizedTexture* textur e, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate)
59 { 60 {
60 // Source rect should never go outside the image pixels, even if this 61 // Source rect should never go outside the image pixels, even if this
61 // is requested because the texture extends outside the image. 62 // is requested because the texture extends outside the image.
62 IntRect clippedSourceRect = sourceRect; 63 IntRect clippedSourceRect = sourceRect;
63 IntRect imageRect = IntRect(0, 0, m_bitmap.width(), m_bitmap.height()); 64 IntRect imageRect = IntRect(0, 0, m_bitmap.width(), m_bitmap.height());
64 clippedSourceRect.intersect(imageRect); 65 clippedSourceRect.intersect(imageRect);
65 66
66 IntSize clippedDestOffset = destOffset + IntSize(clippedSourceRect.locat ion() - sourceRect.location()); 67 IntSize clippedDestOffset = destOffset + IntSize(clippedSourceRect.locat ion() - sourceRect.location());
67 68
68 SkAutoLockPixels lock(m_bitmap); 69 TextureUploader::Parameters upload = { texture, &m_bitmap, NULL, { image Rect, clippedSourceRect, clippedDestOffset } };
69 texture->upload(resourceProvider, static_cast<const uint8_t*>(m_bitmap.g etPixels()), imageRect, clippedSourceRect, clippedDestOffset); 70 if (partialUpdate)
71 queue.appendPartialUpload(upload);
72 else
73 queue.appendFullUpload(upload);
70 } 74 }
71 75
72 void setBitmap(const SkBitmap& bitmap) 76 void setBitmap(const SkBitmap& bitmap)
73 { 77 {
74 m_bitmap = bitmap; 78 m_bitmap = bitmap;
75 } 79 }
76 80
77 private: 81 private:
78 ImageLayerTextureUpdater() { } 82 ImageLayerTextureUpdater() { }
79 83
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 158 }
155 159
156 bool ImageLayerChromium::needsContentsScale() const 160 bool ImageLayerChromium::needsContentsScale() const
157 { 161 {
158 // Contents scale is not need for image layer because this can be done in co mpositor more efficiently. 162 // Contents scale is not need for image layer because this can be done in co mpositor more efficiently.
159 return false; 163 return false;
160 } 164 }
161 165
162 } 166 }
163 #endif // USE(ACCELERATED_COMPOSITING) 167 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698