| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 class FakeLayerUpdater : public LayerUpdater { | 23 class FakeLayerUpdater : public LayerUpdater { |
| 24 public: | 24 public: |
| 25 class Resource : public LayerUpdater::Resource { | 25 class Resource : public LayerUpdater::Resource { |
| 26 public: | 26 public: |
| 27 Resource(FakeLayerUpdater* updater, | 27 Resource(FakeLayerUpdater* updater, |
| 28 scoped_ptr<PrioritizedResource> resource); | 28 scoped_ptr<PrioritizedResource> resource); |
| 29 virtual ~Resource(); | 29 virtual ~Resource(); |
| 30 | 30 |
| 31 virtual void Update(ResourceUpdateQueue* queue, | 31 virtual void Update(ResourceUpdateQueue* queue, |
| 32 gfx::Rect source_rect, | 32 const gfx::Rect& source_rect, |
| 33 gfx::Vector2d dest_offset, | 33 gfx::Vector2d dest_offset, |
| 34 bool partial_update) OVERRIDE; | 34 bool partial_update) OVERRIDE; |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 FakeLayerUpdater* layer_; | 37 FakeLayerUpdater* layer_; |
| 38 SkBitmap bitmap_; | 38 SkBitmap bitmap_; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(Resource); | 40 DISALLOW_COPY_AND_ASSIGN(Resource); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 FakeLayerUpdater(); | 43 FakeLayerUpdater(); |
| 44 | 44 |
| 45 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( | 45 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( |
| 46 PrioritizedResourceManager* resource) OVERRIDE; | 46 PrioritizedResourceManager* resource) OVERRIDE; |
| 47 | 47 |
| 48 virtual void PrepareToUpdate(gfx::Rect content_rect, | 48 virtual void PrepareToUpdate(const gfx::Rect& content_rect, |
| 49 gfx::Size tile_size, | 49 gfx::Size tile_size, |
| 50 float contents_width_scale, | 50 float contents_width_scale, |
| 51 float contents_height_scale, | 51 float contents_height_scale, |
| 52 gfx::Rect* resulting_opaque_rect) OVERRIDE; | 52 gfx::Rect* resulting_opaque_rect) OVERRIDE; |
| 53 // Sets the rect to invalidate during the next call to PrepareToUpdate(). | 53 // Sets the rect to invalidate during the next call to PrepareToUpdate(). |
| 54 // After the next call to PrepareToUpdate() the rect is reset. | 54 // After the next call to PrepareToUpdate() the rect is reset. |
| 55 void SetRectToInvalidate(gfx::Rect rect, FakeTiledLayer* layer); | 55 void SetRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer); |
| 56 // Last rect passed to PrepareToUpdate(). | 56 // Last rect passed to PrepareToUpdate(). |
| 57 gfx::Rect last_update_rect() const { return last_update_rect_; } | 57 gfx::Rect last_update_rect() const { return last_update_rect_; } |
| 58 | 58 |
| 59 // Number of times PrepareToUpdate has been invoked. | 59 // Number of times PrepareToUpdate has been invoked. |
| 60 int prepare_count() const { return prepare_count_; } | 60 int prepare_count() const { return prepare_count_; } |
| 61 void ClearPrepareCount() { prepare_count_ = 0; } | 61 void ClearPrepareCount() { prepare_count_ = 0; } |
| 62 | 62 |
| 63 // Number of times Update() has been invoked on a texture. | 63 // Number of times Update() has been invoked on a texture. |
| 64 int update_count() const { return update_count_; } | 64 int update_count() const { return update_count_; } |
| 65 void ClearUpdateCount() { update_count_ = 0; } | 65 void ClearUpdateCount() { update_count_ = 0; } |
| 66 void Update() { update_count_++; } | 66 void Update() { update_count_++; } |
| 67 | 67 |
| 68 void SetOpaquePaintRect(gfx::Rect opaque_paint_rect) { | 68 void SetOpaquePaintRect(const gfx::Rect& opaque_paint_rect) { |
| 69 opaque_paint_rect_ = opaque_paint_rect; | 69 opaque_paint_rect_ = opaque_paint_rect; |
| 70 } | 70 } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 virtual ~FakeLayerUpdater(); | 73 virtual ~FakeLayerUpdater(); |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 int prepare_count_; | 76 int prepare_count_; |
| 77 int update_count_; | 77 int update_count_; |
| 78 gfx::Rect rect_to_invalidate_; | 78 gfx::Rect rect_to_invalidate_; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 virtual ~FakeTiledLayerWithScaledBounds(); | 152 virtual ~FakeTiledLayerWithScaledBounds(); |
| 153 gfx::Size forced_content_bounds_; | 153 gfx::Size forced_content_bounds_; |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); | 156 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 } // namespace cc | 159 } // namespace cc |
| 160 | 160 |
| 161 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ | 161 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ |
| OLD | NEW |