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