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

Side by Side Diff: cc/test/tiled_layer_test_common.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/test/layer_test_common.cc ('k') | cc/test/tiled_layer_test_common.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 CCTiledLayerTestCommon_h 5 #ifndef CCTiledLayerTestCommon_h
6 #define CCTiledLayerTestCommon_h 6 #define CCTiledLayerTestCommon_h
7 7
8 #include "IntRect.h"
9 #include "IntSize.h"
10 #include "Region.h" 8 #include "Region.h"
11 #include "cc/layer_updater.h" 9 #include "cc/layer_updater.h"
12 #include "cc/prioritized_texture.h" 10 #include "cc/prioritized_texture.h"
13 #include "cc/resource_provider.h" 11 #include "cc/resource_provider.h"
14 #include "cc/resource_update_queue.h" 12 #include "cc/resource_update_queue.h"
15 #include "cc/texture_copier.h" 13 #include "cc/texture_copier.h"
16 #include "cc/texture_uploader.h" 14 #include "cc/texture_uploader.h"
17 #include "cc/tiled_layer.h" 15 #include "cc/tiled_layer.h"
18 #include "cc/tiled_layer_impl.h" 16 #include "cc/tiled_layer_impl.h"
17 #include "ui/gfx/rect.h"
18 #include "ui/gfx/size.h"
19 19
20 namespace WebKitTests { 20 namespace WebKitTests {
21 21
22 class FakeTiledLayer; 22 class FakeTiledLayer;
23 23
24 class FakeLayerUpdater : public cc::LayerUpdater { 24 class FakeLayerUpdater : public cc::LayerUpdater {
25 public: 25 public:
26 class Resource : public cc::LayerUpdater::Resource { 26 class Resource : public cc::LayerUpdater::Resource {
27 public: 27 public:
28 Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedTexture>); 28 Resource(FakeLayerUpdater*, scoped_ptr<cc::PrioritizedTexture>);
29 virtual ~Resource(); 29 virtual ~Resource();
30 30
31 virtual void update(cc::ResourceUpdateQueue&, const gfx::Rect&, const gf x::Vector2d&, bool, cc::RenderingStats&) OVERRIDE; 31 virtual void update(cc::ResourceUpdateQueue&, const gfx::Rect&, const gf x::Vector2d&, bool, cc::RenderingStats&) OVERRIDE;
32 32
33 private: 33 private:
34 FakeLayerUpdater* m_layer; 34 FakeLayerUpdater* m_layer;
35 SkBitmap m_bitmap; 35 SkBitmap m_bitmap;
36 }; 36 };
37 37
38 FakeLayerUpdater(); 38 FakeLayerUpdater();
39 39
40 virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::Prioritize dTextureManager*) OVERRIDE; 40 virtual scoped_ptr<cc::LayerUpdater::Resource> createResource(cc::Prioritize dTextureManager*) OVERRIDE;
41 41
42 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE; 42 virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE;
43 // Sets the rect to invalidate during the next call to prepareToUpdate(). Af ter the next 43 // Sets the rect to invalidate during the next call to prepareToUpdate(). Af ter the next
44 // call to prepareToUpdate() the rect is reset. 44 // call to prepareToUpdate() the rect is reset.
45 void setRectToInvalidate(const cc::IntRect&, FakeTiledLayer*); 45 void setRectToInvalidate(const gfx::Rect&, FakeTiledLayer*);
46 // Last rect passed to prepareToUpdate(). 46 // Last rect passed to prepareToUpdate().
47 const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; } 47 const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; }
48 48
49 // Number of times prepareToUpdate has been invoked. 49 // Number of times prepareToUpdate has been invoked.
50 int prepareCount() const { return m_prepareCount; } 50 int prepareCount() const { return m_prepareCount; }
51 void clearPrepareCount() { m_prepareCount = 0; } 51 void clearPrepareCount() { m_prepareCount = 0; }
52 52
53 // Number of times update() has been invoked on a texture. 53 // Number of times update() has been invoked on a texture.
54 int updateCount() const { return m_updateCount; } 54 int updateCount() const { return m_updateCount; }
55 void clearUpdateCount() { m_updateCount = 0; } 55 void clearUpdateCount() { m_updateCount = 0; }
56 void update() { m_updateCount++; } 56 void update() { m_updateCount++; }
57 57
58 void setOpaquePaintRect(const gfx::Rect& opaquePaintRect) { m_opaquePaintRec t = opaquePaintRect; } 58 void setOpaquePaintRect(const gfx::Rect& opaquePaintRect) { m_opaquePaintRec t = opaquePaintRect; }
59 59
60 protected: 60 protected:
61 virtual ~FakeLayerUpdater(); 61 virtual ~FakeLayerUpdater();
62 62
63 private: 63 private:
64 int m_prepareCount; 64 int m_prepareCount;
65 int m_updateCount; 65 int m_updateCount;
66 cc::IntRect m_rectToInvalidate; 66 gfx::Rect m_rectToInvalidate;
67 gfx::Rect m_lastUpdateRect; 67 gfx::Rect m_lastUpdateRect;
68 gfx::Rect m_opaquePaintRect; 68 gfx::Rect m_opaquePaintRect;
69 scoped_refptr<FakeTiledLayer> m_layer; 69 scoped_refptr<FakeTiledLayer> m_layer;
70 }; 70 };
71 71
72 class FakeTiledLayerImpl : public cc::TiledLayerImpl { 72 class FakeTiledLayerImpl : public cc::TiledLayerImpl {
73 public: 73 public:
74 explicit FakeTiledLayerImpl(int id); 74 explicit FakeTiledLayerImpl(int id);
75 virtual ~FakeTiledLayerImpl(); 75 virtual ~FakeTiledLayerImpl();
76 76
77 using cc::TiledLayerImpl::hasTileAt; 77 using cc::TiledLayerImpl::hasTileAt;
78 using cc::TiledLayerImpl::hasResourceIdForTileAt; 78 using cc::TiledLayerImpl::hasResourceIdForTileAt;
79 }; 79 };
80 80
81 class FakeTiledLayer : public cc::TiledLayer { 81 class FakeTiledLayer : public cc::TiledLayer {
82 public: 82 public:
83 explicit FakeTiledLayer(cc::PrioritizedTextureManager*); 83 explicit FakeTiledLayer(cc::PrioritizedTextureManager*);
84 84
85 static cc::IntSize tileSize() { return cc::IntSize(100, 100); } 85 static gfx::Size tileSize() { return gfx::Size(100, 100); }
86 86
87 using cc::TiledLayer::invalidateContentRect; 87 using cc::TiledLayer::invalidateContentRect;
88 using cc::TiledLayer::needsIdlePaint; 88 using cc::TiledLayer::needsIdlePaint;
89 using cc::TiledLayer::skipsDraw; 89 using cc::TiledLayer::skipsDraw;
90 using cc::TiledLayer::numPaintedTiles; 90 using cc::TiledLayer::numPaintedTiles;
91 using cc::TiledLayer::idlePaintRect; 91 using cc::TiledLayer::idlePaintRect;
92 92
93 virtual void setNeedsDisplayRect(const cc::FloatRect&) OVERRIDE; 93 virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
94 const cc::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDispla yRect; } 94 const gfx::RectF& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRe ct; }
95 95
96 virtual void setTexturePriorities(const cc::PriorityCalculator&) OVERRIDE; 96 virtual void setTexturePriorities(const cc::PriorityCalculator&) OVERRIDE;
97 97
98 virtual cc::PrioritizedTextureManager* textureManager() const OVERRIDE; 98 virtual cc::PrioritizedTextureManager* textureManager() const OVERRIDE;
99 FakeLayerUpdater* fakeLayerUpdater() { return m_fakeUpdater.get(); } 99 FakeLayerUpdater* fakeLayerUpdater() { return m_fakeUpdater.get(); }
100 cc::FloatRect updateRect() { return m_updateRect; } 100 gfx::RectF updateRect() { return m_updateRect; }
101 101
102 protected: 102 protected:
103 virtual cc::LayerUpdater* updater() const OVERRIDE; 103 virtual cc::LayerUpdater* updater() const OVERRIDE;
104 virtual void createUpdaterIfNeeded() OVERRIDE { } 104 virtual void createUpdaterIfNeeded() OVERRIDE { }
105 virtual ~FakeTiledLayer(); 105 virtual ~FakeTiledLayer();
106 106
107 private: 107 private:
108 scoped_refptr<FakeLayerUpdater> m_fakeUpdater; 108 scoped_refptr<FakeLayerUpdater> m_fakeUpdater;
109 cc::PrioritizedTextureManager* m_textureManager; 109 cc::PrioritizedTextureManager* m_textureManager;
110 cc::FloatRect m_lastNeedsDisplayRect; 110 gfx::RectF m_lastNeedsDisplayRect;
111 }; 111 };
112 112
113 class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { 113 class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
114 public: 114 public:
115 explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedTextureManager*); 115 explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedTextureManager*);
116 116
117 void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBou nds = contentBounds; } 117 void setContentBounds(const gfx::Size& contentBounds) { m_forcedContentBound s = contentBounds; }
118 virtual cc::IntSize contentBounds() const OVERRIDE; 118 virtual gfx::Size contentBounds() const OVERRIDE;
119 virtual float contentsScaleX() const OVERRIDE; 119 virtual float contentsScaleX() const OVERRIDE;
120 virtual float contentsScaleY() const OVERRIDE; 120 virtual float contentsScaleY() const OVERRIDE;
121 virtual void setContentsScale(float) OVERRIDE; 121 virtual void setContentsScale(float) OVERRIDE;
122 122
123 protected: 123 protected:
124 virtual ~FakeTiledLayerWithScaledBounds(); 124 virtual ~FakeTiledLayerWithScaledBounds();
125 cc::IntSize m_forcedContentBounds; 125 gfx::Size m_forcedContentBounds;
126 }; 126 };
127 127
128 } 128 }
129 #endif // CCTiledLayerTestCommon_h 129 #endif // CCTiledLayerTestCommon_h
OLDNEW
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/test/tiled_layer_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698