OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FAKE_PICTURE_LAYER_IMPL_H_ | 5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/layers/picture_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } | 114 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } |
115 | 115 |
116 void CreateAllTiles(); | 116 void CreateAllTiles(); |
117 void SetAllTilesVisible(); | 117 void SetAllTilesVisible(); |
118 void SetAllTilesReady(); | 118 void SetAllTilesReady(); |
119 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); | 119 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); |
120 void SetTileReady(Tile* tile); | 120 void SetTileReady(Tile* tile); |
121 void ResetAllTilesPriorities(); | 121 void ResetAllTilesPriorities(); |
122 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } | 122 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } |
123 | 123 |
| 124 // Add the given tiling as a "used" tiling during AppendQuads. This ensures |
| 125 // that future calls to UpdateTiles don't delete the tiling. |
| 126 void MarkAllTilingsUsed() { |
| 127 last_append_quads_tilings_.clear(); |
| 128 for (size_t i = 0; i < tilings_->num_tilings(); ++i) |
| 129 last_append_quads_tilings_.push_back(tilings_->tiling_at(i)); |
| 130 } |
| 131 |
124 size_t release_resources_count() const { return release_resources_count_; } | 132 size_t release_resources_count() const { return release_resources_count_; } |
125 void reset_release_resources_count() { release_resources_count_ = 0; } | 133 void reset_release_resources_count() { release_resources_count_ = 0; } |
126 | 134 |
127 void ReleaseResources() override; | 135 void ReleaseResources() override; |
128 | 136 |
129 bool only_used_low_res_last_append_quads() const { | 137 bool only_used_low_res_last_append_quads() const { |
130 return only_used_low_res_last_append_quads_; | 138 return only_used_low_res_last_append_quads_; |
131 } | 139 } |
132 | 140 |
133 protected: | 141 protected: |
134 FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 142 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
135 int id, | 143 int id, |
136 scoped_refptr<RasterSource> raster_source, | 144 scoped_refptr<RasterSource> raster_source, |
137 bool is_mask); | 145 bool is_mask); |
138 FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 146 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
139 int id, | 147 int id, |
140 scoped_refptr<RasterSource> raster_source, | 148 scoped_refptr<RasterSource> raster_source, |
141 bool is_mask, | 149 bool is_mask, |
142 const gfx::Size& layer_bounds); | 150 const gfx::Size& layer_bounds); |
143 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); | 151 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); |
| 152 FakePictureLayerImpl( |
| 153 LayerTreeImpl* tree_impl, |
| 154 int id, |
| 155 bool is_mask, |
| 156 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset); |
144 | 157 |
145 private: | 158 private: |
146 gfx::Size fixed_tile_size_; | 159 gfx::Size fixed_tile_size_; |
147 | 160 |
148 size_t append_quads_count_; | 161 size_t append_quads_count_; |
149 size_t did_become_active_call_count_; | 162 size_t did_become_active_call_count_; |
150 bool has_valid_tile_priorities_; | 163 bool has_valid_tile_priorities_; |
151 bool use_set_valid_tile_priorities_flag_; | 164 bool use_set_valid_tile_priorities_flag_; |
152 size_t release_resources_count_; | 165 size_t release_resources_count_; |
153 }; | 166 }; |
154 | 167 |
155 } // namespace cc | 168 } // namespace cc |
156 | 169 |
157 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 170 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |