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 26 matching lines...) Expand all Loading... |
37 SkBitmap bitmap_; | 37 SkBitmap bitmap_; |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(Resource); | 39 DISALLOW_COPY_AND_ASSIGN(Resource); |
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::Size& content_size, |
| 48 const gfx::Rect& paint_rect, |
48 const gfx::Size& tile_size, | 49 const gfx::Size& tile_size, |
49 float contents_width_scale, | 50 float contents_width_scale, |
50 float contents_height_scale) OVERRIDE; | 51 float contents_height_scale) OVERRIDE; |
51 // Sets the rect to invalidate during the next call to PrepareToUpdate(). | 52 // Sets the rect to invalidate during the next call to PrepareToUpdate(). |
52 // After the next call to PrepareToUpdate() the rect is reset. | 53 // After the next call to PrepareToUpdate() the rect is reset. |
53 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); | 54 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); |
54 // Last rect passed to PrepareToUpdate(). | 55 // Last rect passed to PrepareToUpdate(). |
55 gfx::Rect last_update_rect() const { return last_update_rect_; } | 56 gfx::Rect last_update_rect() const { return last_update_rect_; } |
56 | 57 |
| 58 // Value of |contents_width_scale| last passed to PrepareToUpdate(). |
| 59 float last_contents_width_scale() const { return last_contents_width_scale_; } |
| 60 |
57 // Number of times PrepareToUpdate has been invoked. | 61 // Number of times PrepareToUpdate has been invoked. |
58 int prepare_count() const { return prepare_count_; } | 62 int prepare_count() const { return prepare_count_; } |
59 void ClearPrepareCount() { prepare_count_ = 0; } | 63 void ClearPrepareCount() { prepare_count_ = 0; } |
60 | 64 |
61 // Number of times Update() has been invoked on a texture. | 65 // Number of times Update() has been invoked on a texture. |
62 int update_count() const { return update_count_; } | 66 int update_count() const { return update_count_; } |
63 void ClearUpdateCount() { update_count_ = 0; } | 67 void ClearUpdateCount() { update_count_ = 0; } |
64 void Update() { update_count_++; } | 68 void Update() { update_count_++; } |
65 | 69 |
66 protected: | 70 protected: |
67 virtual ~FakeLayerUpdater(); | 71 virtual ~FakeLayerUpdater(); |
68 | 72 |
69 private: | 73 private: |
70 int prepare_count_; | 74 int prepare_count_; |
71 int update_count_; | 75 int update_count_; |
72 gfx::Rect rect_to_invalidate_; | 76 gfx::Rect rect_to_invalidate_; |
73 gfx::Rect last_update_rect_; | 77 gfx::Rect last_update_rect_; |
| 78 float last_contents_width_scale_; |
74 scoped_refptr<FakeTiledLayer> layer_; | 79 scoped_refptr<FakeTiledLayer> layer_; |
75 | 80 |
76 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); | 81 DISALLOW_COPY_AND_ASSIGN(FakeLayerUpdater); |
77 }; | 82 }; |
78 | 83 |
79 class FakeTiledLayerImpl : public TiledLayerImpl { | 84 class FakeTiledLayerImpl : public TiledLayerImpl { |
80 public: | 85 public: |
81 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); | 86 FakeTiledLayerImpl(LayerTreeImpl* tree_impl, int id); |
82 virtual ~FakeTiledLayerImpl(); | 87 virtual ~FakeTiledLayerImpl(); |
83 | 88 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 virtual ~FakeTiledLayerWithScaledBounds(); | 147 virtual ~FakeTiledLayerWithScaledBounds(); |
143 gfx::Size forced_content_bounds_; | 148 gfx::Size forced_content_bounds_; |
144 | 149 |
145 private: | 150 private: |
146 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); | 151 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); |
147 }; | 152 }; |
148 | 153 |
149 } // namespace cc | 154 } // namespace cc |
150 | 155 |
151 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ | 156 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ |
OLD | NEW |