| 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 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 class Resource : public LayerUpdater::Resource { | 24 class Resource : public LayerUpdater::Resource { |
| 25 public: | 25 public: |
| 26 Resource(FakeLayerUpdater* updater, | 26 Resource(FakeLayerUpdater* updater, |
| 27 scoped_ptr<PrioritizedResource> resource); | 27 scoped_ptr<PrioritizedResource> resource); |
| 28 virtual ~Resource(); | 28 virtual ~Resource(); |
| 29 | 29 |
| 30 virtual void Update(ResourceUpdateQueue* queue, | 30 virtual void Update(ResourceUpdateQueue* queue, |
| 31 const gfx::Rect& source_rect, | 31 const gfx::Rect& source_rect, |
| 32 const gfx::Vector2d& dest_offset, | 32 const gfx::Vector2d& dest_offset, |
| 33 bool partial_update) OVERRIDE; | 33 bool partial_update) override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 FakeLayerUpdater* layer_; | 36 FakeLayerUpdater* layer_; |
| 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::Size& content_size, |
| 48 const gfx::Rect& paint_rect, | 48 const gfx::Rect& paint_rect, |
| 49 const gfx::Size& tile_size, | 49 const gfx::Size& tile_size, |
| 50 float contents_width_scale, | 50 float contents_width_scale, |
| 51 float contents_height_scale) OVERRIDE; | 51 float contents_height_scale) 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(). | 58 // Value of |contents_width_scale| last passed to PrepareToUpdate(). |
| 59 float last_contents_width_scale() const { return last_contents_width_scale_; } | 59 float last_contents_width_scale() const { return last_contents_width_scale_; } |
| 60 | 60 |
| 61 // Number of times PrepareToUpdate has been invoked. | 61 // Number of times PrepareToUpdate has been invoked. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 explicit FakeTiledLayer(PrioritizedResourceManager* resource_manager); | 95 explicit FakeTiledLayer(PrioritizedResourceManager* resource_manager); |
| 96 | 96 |
| 97 static gfx::Size tile_size() { return gfx::Size(100, 100); } | 97 static gfx::Size tile_size() { return gfx::Size(100, 100); } |
| 98 | 98 |
| 99 using TiledLayer::InvalidateContentRect; | 99 using TiledLayer::InvalidateContentRect; |
| 100 using TiledLayer::NeedsIdlePaint; | 100 using TiledLayer::NeedsIdlePaint; |
| 101 using TiledLayer::SkipsDraw; | 101 using TiledLayer::SkipsDraw; |
| 102 using TiledLayer::NumPaintedTiles; | 102 using TiledLayer::NumPaintedTiles; |
| 103 using TiledLayer::IdlePaintRect; | 103 using TiledLayer::IdlePaintRect; |
| 104 | 104 |
| 105 virtual void SetNeedsDisplayRect(const gfx::RectF& rect) OVERRIDE; | 105 virtual void SetNeedsDisplayRect(const gfx::RectF& rect) override; |
| 106 const gfx::RectF& last_needs_display_rect() const { | 106 const gfx::RectF& last_needs_display_rect() const { |
| 107 return last_needs_display_rect_; | 107 return last_needs_display_rect_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 virtual void SetTexturePriorities( | 110 virtual void SetTexturePriorities( |
| 111 const PriorityCalculator& priority_calculator) OVERRIDE; | 111 const PriorityCalculator& priority_calculator) override; |
| 112 | 112 |
| 113 virtual PrioritizedResourceManager* ResourceManager() OVERRIDE; | 113 virtual PrioritizedResourceManager* ResourceManager() override; |
| 114 FakeLayerUpdater* fake_layer_updater() { return fake_updater_.get(); } | 114 FakeLayerUpdater* fake_layer_updater() { return fake_updater_.get(); } |
| 115 gfx::RectF update_rect() { return update_rect_; } | 115 gfx::RectF update_rect() { return update_rect_; } |
| 116 | 116 |
| 117 // Simulate CalcDrawProperties. | 117 // Simulate CalcDrawProperties. |
| 118 void UpdateContentsScale(float ideal_contents_scale); | 118 void UpdateContentsScale(float ideal_contents_scale); |
| 119 | 119 |
| 120 void ResetNumDependentsNeedPushProperties(); | 120 void ResetNumDependentsNeedPushProperties(); |
| 121 | 121 |
| 122 protected: | 122 protected: |
| 123 virtual LayerUpdater* Updater() const OVERRIDE; | 123 virtual LayerUpdater* Updater() const override; |
| 124 virtual void CreateUpdaterIfNeeded() OVERRIDE {} | 124 virtual void CreateUpdaterIfNeeded() override {} |
| 125 virtual ~FakeTiledLayer(); | 125 virtual ~FakeTiledLayer(); |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 scoped_refptr<FakeLayerUpdater> fake_updater_; | 128 scoped_refptr<FakeLayerUpdater> fake_updater_; |
| 129 PrioritizedResourceManager* resource_manager_; | 129 PrioritizedResourceManager* resource_manager_; |
| 130 gfx::RectF last_needs_display_rect_; | 130 gfx::RectF last_needs_display_rect_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayer); | 132 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayer); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { | 135 class FakeTiledLayerWithScaledBounds : public FakeTiledLayer { |
| 136 public: | 136 public: |
| 137 explicit FakeTiledLayerWithScaledBounds( | 137 explicit FakeTiledLayerWithScaledBounds( |
| 138 PrioritizedResourceManager* resource_manager); | 138 PrioritizedResourceManager* resource_manager); |
| 139 | 139 |
| 140 void SetContentBounds(const gfx::Size& content_bounds); | 140 void SetContentBounds(const gfx::Size& content_bounds); |
| 141 virtual void CalculateContentsScale(float ideal_contents_scale, | 141 virtual void CalculateContentsScale(float ideal_contents_scale, |
| 142 float* contents_scale_x, | 142 float* contents_scale_x, |
| 143 float* contents_scale_y, | 143 float* contents_scale_y, |
| 144 gfx::Size* content_bounds) OVERRIDE; | 144 gfx::Size* content_bounds) override; |
| 145 | 145 |
| 146 protected: | 146 protected: |
| 147 virtual ~FakeTiledLayerWithScaledBounds(); | 147 virtual ~FakeTiledLayerWithScaledBounds(); |
| 148 gfx::Size forced_content_bounds_; | 148 gfx::Size forced_content_bounds_; |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); | 151 DISALLOW_COPY_AND_ASSIGN(FakeTiledLayerWithScaledBounds); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace cc | 154 } // namespace cc |
| 155 | 155 |
| 156 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ | 156 #endif // CC_TEST_TILED_LAYER_TEST_COMMON_H_ |
| OLD | NEW |