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

Side by Side Diff: cc/damage_tracker.h

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector 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/contents_scaling_layer_unittest.cc ('k') | cc/damage_tracker.cc » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 #ifndef CCDamageTracker_h 5 #ifndef CCDamageTracker_h
6 #define CCDamageTracker_h 6 #define CCDamageTracker_h
7 7
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "FloatRect.h" 10 #include "ui/gfx/rect_f.h"
11 #include <vector> 11 #include <vector>
12 12
13 class SkImageFilter;
14
15 namespace gfx {
16 class Rect;
17 }
18
13 namespace WebKit { 19 namespace WebKit {
14 class WebFilterOperations; 20 class WebFilterOperations;
15 } 21 }
16 22
17 class SkImageFilter;
18
19 namespace cc { 23 namespace cc {
20 24
21 class LayerImpl; 25 class LayerImpl;
22 class RenderSurfaceImpl; 26 class RenderSurfaceImpl;
23 27
24 // Computes the region where pixels have actually changed on a RenderSurfaceImpl . This region is used 28 // Computes the region where pixels have actually changed on a RenderSurfaceImpl . This region is used
25 // to scissor what is actually drawn to the screen to save GPU computation and b andwidth. 29 // to scissor what is actually drawn to the screen to save GPU computation and b andwidth.
26 class DamageTracker { 30 class DamageTracker {
27 public: 31 public:
28 static scoped_ptr<DamageTracker> create(); 32 static scoped_ptr<DamageTracker> create();
29 ~DamageTracker(); 33 ~DamageTracker();
30 34
31 void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); } 35 void didDrawDamagedArea() { m_currentDamageRect = gfx::RectF(); }
32 void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } 36 void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
33 void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, cons t IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const We bKit::WebFilterOperations&, SkImageFilter* filter); 37 void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, cons t gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&, SkImageFilter* filter);
34 38
35 const FloatRect& currentDamageRect() { return m_currentDamageRect; } 39 const gfx::RectF& currentDamageRect() { return m_currentDamageRect; }
36 40
37 private: 41 private:
38 DamageTracker(); 42 DamageTracker();
39 43
40 FloatRect trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerLi st, int targetSurfaceLayerID); 44 gfx::RectF trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerL ist, int targetSurfaceLayerID);
41 FloatRect trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer); 45 gfx::RectF trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer);
42 FloatRect trackDamageFromLeftoverRects(); 46 gfx::RectF trackDamageFromLeftoverRects();
43 47
44 FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew); 48 gfx::RectF removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
45 void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect); 49 void saveRectForNextFrame(int layerID, const gfx::RectF& targetSpaceRect);
46 50
47 // These helper functions are used only in trackDamageFromActiveLayers(). 51 // These helper functions are used only in trackDamageFromActiveLayers().
48 void extendDamageForLayer(LayerImpl*, FloatRect& targetDamageRect); 52 void extendDamageForLayer(LayerImpl*, gfx::RectF& targetDamageRect);
49 void extendDamageForRenderSurface(LayerImpl*, FloatRect& targetDamageRect); 53 void extendDamageForRenderSurface(LayerImpl*, gfx::RectF& targetDamageRect);
50 54
51 // To correctly track exposed regions, two hashtables of rects are maintaine d. 55 // To correctly track exposed regions, two hashtables of rects are maintaine d.
52 // The "current" map is used to compute exposed regions of the current frame , while 56 // The "current" map is used to compute exposed regions of the current frame , while
53 // the "next" map is used to collect layer rects that are used in the next f rame. 57 // the "next" map is used to collect layer rects that are used in the next f rame.
54 typedef base::hash_map<int, FloatRect> RectMap; 58 typedef base::hash_map<int, gfx::RectF> RectMap;
55 scoped_ptr<RectMap> m_currentRectHistory; 59 scoped_ptr<RectMap> m_currentRectHistory;
56 scoped_ptr<RectMap> m_nextRectHistory; 60 scoped_ptr<RectMap> m_nextRectHistory;
57 61
58 FloatRect m_currentDamageRect; 62 gfx::RectF m_currentDamageRect;
59 bool m_forceFullDamageNextUpdate; 63 bool m_forceFullDamageNextUpdate;
60 }; 64 };
61 65
62 } // namespace cc 66 } // namespace cc
63 67
64 #endif // CCDamageTracker_h 68 #endif // CCDamageTracker_h
OLDNEW
« no previous file with comments | « cc/contents_scaling_layer_unittest.cc ('k') | cc/damage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698