OLD | NEW |
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 CC_TEST_TILED_LAYER_TEST_COMMON_H_ | 5 #ifndef CC_TEST_TILED_LAYER_TEST_COMMON_H_ |
6 #define CC_TEST_TILED_LAYER_TEST_COMMON_H_ | 6 #define CC_TEST_TILED_LAYER_TEST_COMMON_H_ |
7 | 7 |
8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
9 #include "cc/layers/tiled_layer.h" | 9 #include "cc/layers/tiled_layer.h" |
10 #include "cc/layers/tiled_layer_impl.h" | 10 #include "cc/layers/tiled_layer_impl.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 }; | 40 }; |
41 | 41 |
42 FakeLayerUpdater(); | 42 FakeLayerUpdater(); |
43 | 43 |
44 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( | 44 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( |
45 PrioritizedResourceManager* resource) OVERRIDE; | 45 PrioritizedResourceManager* resource) OVERRIDE; |
46 | 46 |
47 virtual void PrepareToUpdate(const gfx::Rect& content_rect, | 47 virtual void PrepareToUpdate(const gfx::Rect& content_rect, |
48 const gfx::Size& tile_size, | 48 const gfx::Size& tile_size, |
49 float contents_width_scale, | 49 float contents_width_scale, |
50 float contents_height_scale, | 50 float contents_height_scale) OVERRIDE; |
51 gfx::Rect* resulting_opaque_rect) OVERRIDE; | |
52 // Sets the rect to invalidate during the next call to PrepareToUpdate(). | 51 // Sets the rect to invalidate during the next call to PrepareToUpdate(). |
53 // After the next call to PrepareToUpdate() the rect is reset. | 52 // After the next call to PrepareToUpdate() the rect is reset. |
54 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); | 53 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); |
55 // Last rect passed to PrepareToUpdate(). | 54 // Last rect passed to PrepareToUpdate(). |
56 gfx::Rect last_update_rect() const { return last_update_rect_; } | 55 gfx::Rect last_update_rect() const { return last_update_rect_; } |
57 | 56 |
58 // Number of times PrepareToUpdate has been invoked. | 57 // Number of times PrepareToUpdate has been invoked. |
59 int prepare_count() const { return prepare_count_; } | 58 int prepare_count() const { return prepare_count_; } |
60 void ClearPrepareCount() { prepare_count_ = 0; } | 59 void ClearPrepareCount() { prepare_count_ = 0; } |
61 | 60 |
62 // Number of times Update() has been invoked on a texture. | 61 // Number of times Update() has been invoked on a texture. |
63 int update_count() const { return update_count_; } | 62 int update_count() const { return update_count_; } |
64 void ClearUpdateCount() { update_count_ = 0; } | 63 void ClearUpdateCount() { update_count_ = 0; } |
65 void Update() { update_count_++; } | 64 void Update() { update_count_++; } |
66 | 65 |
67 void SetOpaquePaintRect(const gfx::Rect& opaque_paint_rect) { | |
68 opaque_paint_rect_ = opaque_paint_rect; | |
69 } | |
70 | |
71 protected: | 66 protected: |
72 virtual ~FakeLayerUpdater(); | 67 virtual ~FakeLayerUpdater(); |
73 | 68 |
74 private: | 69 private: |
75 int prepare_count_; | 70 int prepare_count_; |
76 int update_count_; | 71 int update_count_; |
77 gfx::Rect rect_to_invalidate_; | 72 gfx::Rect rect_to_invalidate_; |
78 gfx::Rect last_update_rect_; | 73 gfx::Rect last_update_rect_; |
79 gfx::Rect opaque_paint_rect_; | |
80 scoped_refptr<FakeTiledLayer> layer_; | 74 scoped_refptr<FakeTiledLayer> layer_; |
81 | 75 |
82 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); | 76 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); |
83 }; | 77 }; |
84 | 78 |
85 class FakeTiledLayerImpl : public TiledLayerImpl { | 79 class FakeTiledLayerImpl : public TiledLayerImpl { |
86 public: | 80 public: |
87 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); | 81 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); |
88 virtual ~FakeTiledLayerImpl(); | 82 virtual ~FakeTiledLayerImpl(); |
89 | 83 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 virtual ~FakeTiledLayerWithScaledBounds(); | 142 virtual ~FakeTiledLayerWithScaledBounds(); |
149 gfx::Size forced_content_bounds_; | 143 gfx::Size forced_content_bounds_; |
150 | 144 |
151 private: | 145 private: |
152 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); | 146 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); |
153 }; | 147 }; |
154 | 148 |
155 } // namespace cc | 149 } // namespace cc |
156 | 150 |
157 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ | 151 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ |
OLD | NEW |