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