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