| 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 84 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::Rect& rect) override; |
| 106 const gfx::RectF& last_needs_display_rect() const { | 106 const gfx::Rect& 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::Rect 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 |