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

Side by Side Diff: cc/image_layer.cc

Issue 11270047: cc: Rename TextureUpdate to ResourceUpdate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sort includes and forward declarations. Created 8 years, 1 month 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
« no previous file with comments | « cc/image_layer.h ('k') | cc/layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "cc/image_layer.h" 7 #include "cc/image_layer.h"
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "cc/layer_updater.h" 10 #include "cc/layer_updater.h"
11 #include "cc/layer_tree_host.h" 11 #include "cc/layer_tree_host.h"
12 #include "cc/texture_update_queue.h" 12 #include "cc/resource_update_queue.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class ImageLayerUpdater : public LayerUpdater { 16 class ImageLayerUpdater : public LayerUpdater {
17 public: 17 public:
18 class Resource : public LayerUpdater::Resource { 18 class Resource : public LayerUpdater::Resource {
19 public: 19 public:
20 Resource(ImageLayerUpdater* updater, scoped_ptr<PrioritizedTexture> text ure) 20 Resource(ImageLayerUpdater* updater, scoped_ptr<PrioritizedTexture> text ure)
21 : LayerUpdater::Resource(texture.Pass()) 21 : LayerUpdater::Resource(texture.Pass())
22 , m_updater(updater) 22 , m_updater(updater)
23 { 23 {
24 } 24 }
25 25
26 virtual void update(TextureUpdateQueue& queue, const IntRect& sourceRect , const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE 26 virtual void update(ResourceUpdateQueue& queue, const IntRect& sourceRec t, const IntSize& destOffset, bool partialUpdate, RenderingStats&) OVERRIDE
27 { 27 {
28 updater()->updateTexture(queue, texture(), sourceRect, destOffset, p artialUpdate); 28 updater()->updateTexture(queue, texture(), sourceRect, destOffset, p artialUpdate);
29 } 29 }
30 30
31 private: 31 private:
32 ImageLayerUpdater* updater() { return m_updater; } 32 ImageLayerUpdater* updater() { return m_updater; }
33 33
34 ImageLayerUpdater* m_updater; 34 ImageLayerUpdater* m_updater;
35 }; 35 };
36 36
37 static scoped_refptr<ImageLayerUpdater> create() 37 static scoped_refptr<ImageLayerUpdater> create()
38 { 38 {
39 return make_scoped_refptr(new ImageLayerUpdater()); 39 return make_scoped_refptr(new ImageLayerUpdater());
40 } 40 }
41 41
42 virtual scoped_ptr<LayerUpdater::Resource> createResource( 42 virtual scoped_ptr<LayerUpdater::Resource> createResource(
43 PrioritizedTextureManager* manager) OVERRIDE 43 PrioritizedTextureManager* manager) OVERRIDE
44 { 44 {
45 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, Prioritized Texture::create(manager))); 45 return scoped_ptr<LayerUpdater::Resource>(new Resource(this, Prioritized Texture::create(manager)));
46 } 46 }
47 47
48 void updateTexture(TextureUpdateQueue& queue, PrioritizedTexture* texture, c onst IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate) 48 void updateTexture(ResourceUpdateQueue& queue, PrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset, bool partialUpdate)
49 { 49 {
50 // Source rect should never go outside the image pixels, even if this 50 // Source rect should never go outside the image pixels, even if this
51 // is requested because the texture extends outside the image. 51 // is requested because the texture extends outside the image.
52 IntRect clippedSourceRect = sourceRect; 52 IntRect clippedSourceRect = sourceRect;
53 IntRect imageRect = IntRect(0, 0, m_bitmap.width(), m_bitmap.height()); 53 IntRect imageRect = IntRect(0, 0, m_bitmap.width(), m_bitmap.height());
54 clippedSourceRect.intersect(imageRect); 54 clippedSourceRect.intersect(imageRect);
55 55
56 IntSize clippedDestOffset = destOffset + IntSize(clippedSourceRect.locat ion() - sourceRect.location()); 56 IntSize clippedDestOffset = destOffset + IntSize(clippedSourceRect.locat ion() - sourceRect.location());
57 57
58 ResourceUpdate upload = ResourceUpdate::Create(texture, 58 ResourceUpdate upload = ResourceUpdate::Create(texture,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 void ImageLayer::setTexturePriorities(const PriorityCalculator& priorityCalc) 108 void ImageLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
109 { 109 {
110 // Update the tile data before creating all the layer's tiles. 110 // Update the tile data before creating all the layer's tiles.
111 updateTileSizeAndTilingOption(); 111 updateTileSizeAndTilingOption();
112 112
113 TiledLayer::setTexturePriorities(priorityCalc); 113 TiledLayer::setTexturePriorities(priorityCalc);
114 } 114 }
115 115
116 void ImageLayer::update(TextureUpdateQueue& queue, const OcclusionTracker* occlu sion, RenderingStats& stats) 116 void ImageLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl usion, RenderingStats& stats)
117 { 117 {
118 createUpdaterIfNeeded(); 118 createUpdaterIfNeeded();
119 if (m_needsDisplay) { 119 if (m_needsDisplay) {
120 m_updater->setBitmap(m_bitmap); 120 m_updater->setBitmap(m_bitmap);
121 updateTileSizeAndTilingOption(); 121 updateTileSizeAndTilingOption();
122 invalidateContentRect(IntRect(IntPoint(), contentBounds())); 122 invalidateContentRect(IntRect(IntPoint(), contentBounds()));
123 m_needsDisplay = false; 123 m_needsDisplay = false;
124 } 124 }
125 TiledLayer::update(queue, occlusion, stats); 125 TiledLayer::update(queue, occlusion, stats);
126 } 126 }
(...skipping 23 matching lines...) Expand all
150 return !m_bitmap.isNull() && TiledLayer::drawsContent(); 150 return !m_bitmap.isNull() && TiledLayer::drawsContent();
151 } 151 }
152 152
153 bool ImageLayer::needsContentsScale() const 153 bool ImageLayer::needsContentsScale() const
154 { 154 {
155 // Contents scale is not need for image layer because this can be done in co mpositor more efficiently. 155 // Contents scale is not need for image layer because this can be done in co mpositor more efficiently.
156 return false; 156 return false;
157 } 157 }
158 158
159 } 159 }
OLDNEW
« no previous file with comments | « cc/image_layer.h ('k') | cc/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698