| 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 #include "cc/playback/raster_source.h" | 10 #include "cc/playback/display_list_raster_source.h" |
| 11 | 11 |
| 12 namespace cc { | 12 namespace cc { |
| 13 | 13 |
| 14 class FakePictureLayerImpl : public PictureLayerImpl { | 14 class FakePictureLayerImpl : public PictureLayerImpl { |
| 15 public: | 15 public: |
| 16 static scoped_ptr<FakePictureLayerImpl> Create( | 16 static scoped_ptr<FakePictureLayerImpl> Create( |
| 17 LayerTreeImpl* tree_impl, int id) { | 17 LayerTreeImpl* tree_impl, int id) { |
| 18 bool is_mask = false; | 18 bool is_mask = false; |
| 19 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); | 19 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static scoped_ptr<FakePictureLayerImpl> CreateMask(LayerTreeImpl* tree_impl, | 22 static scoped_ptr<FakePictureLayerImpl> CreateMask(LayerTreeImpl* tree_impl, |
| 23 int id) { | 23 int id) { |
| 24 bool is_mask = true; | 24 bool is_mask = true; |
| 25 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); | 25 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 // Create layer from a raster source that covers the entire layer. | 28 // Create layer from a raster source that covers the entire layer. |
| 29 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource( | 29 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource( |
| 30 LayerTreeImpl* tree_impl, | 30 LayerTreeImpl* tree_impl, |
| 31 int id, | 31 int id, |
| 32 scoped_refptr<RasterSource> raster_source) { | 32 scoped_refptr<DisplayListRasterSource> raster_source) { |
| 33 bool is_mask = false; | 33 bool is_mask = false; |
| 34 return make_scoped_ptr( | 34 return make_scoped_ptr( |
| 35 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); | 35 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // Create layer from a raster source that only covers part of the layer. | 38 // Create layer from a raster source that only covers part of the layer. |
| 39 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( | 39 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( |
| 40 LayerTreeImpl* tree_impl, | 40 LayerTreeImpl* tree_impl, |
| 41 int id, | 41 int id, |
| 42 scoped_refptr<RasterSource> raster_source, | 42 scoped_refptr<DisplayListRasterSource> raster_source, |
| 43 const gfx::Size& layer_bounds) { | 43 const gfx::Size& layer_bounds) { |
| 44 bool is_mask = false; | 44 bool is_mask = false; |
| 45 return make_scoped_ptr(new FakePictureLayerImpl( | 45 return make_scoped_ptr(new FakePictureLayerImpl( |
| 46 tree_impl, id, raster_source, is_mask, layer_bounds)); | 46 tree_impl, id, raster_source, is_mask, layer_bounds)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Create layer from a raster source that covers the entire layer and is a | 49 // Create layer from a raster source that covers the entire layer and is a |
| 50 // mask. | 50 // mask. |
| 51 static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( | 51 static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( |
| 52 LayerTreeImpl* tree_impl, | 52 LayerTreeImpl* tree_impl, |
| 53 int id, | 53 int id, |
| 54 scoped_refptr<RasterSource> raster_source) { | 54 scoped_refptr<DisplayListRasterSource> raster_source) { |
| 55 bool is_mask = true; | 55 bool is_mask = true; |
| 56 return make_scoped_ptr( | 56 return make_scoped_ptr( |
| 57 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); | 57 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 60 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 61 void PushPropertiesTo(LayerImpl* layer_impl) override; | 61 void PushPropertiesTo(LayerImpl* layer_impl) override; |
| 62 void AppendQuads(RenderPass* render_pass, | 62 void AppendQuads(RenderPass* render_pass, |
| 63 AppendQuadsData* append_quads_data) override; | 63 AppendQuadsData* append_quads_data) override; |
| 64 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 64 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void set_raster_page_scale(float scale) { raster_page_scale_ = scale; } | 97 void set_raster_page_scale(float scale) { raster_page_scale_ = scale; } |
| 98 | 98 |
| 99 float ideal_contents_scale() const { return ideal_contents_scale_; } | 99 float ideal_contents_scale() const { return ideal_contents_scale_; } |
| 100 float raster_contents_scale() const { return raster_contents_scale_; } | 100 float raster_contents_scale() const { return raster_contents_scale_; } |
| 101 | 101 |
| 102 PictureLayerTiling* HighResTiling() const; | 102 PictureLayerTiling* HighResTiling() const; |
| 103 PictureLayerTiling* LowResTiling() const; | 103 PictureLayerTiling* LowResTiling() const; |
| 104 size_t num_tilings() const { return tilings_->num_tilings(); } | 104 size_t num_tilings() const { return tilings_->num_tilings(); } |
| 105 | 105 |
| 106 PictureLayerTilingSet* tilings() { return tilings_.get(); } | 106 PictureLayerTilingSet* tilings() { return tilings_.get(); } |
| 107 RasterSource* raster_source() { return raster_source_.get(); } | 107 DisplayListRasterSource* raster_source() { return raster_source_.get(); } |
| 108 void SetRasterSourceOnPending(scoped_refptr<RasterSource> raster_source, | 108 void SetRasterSourceOnPending( |
| 109 const Region& invalidation); | 109 scoped_refptr<DisplayListRasterSource> raster_source, |
| 110 const Region& invalidation); |
| 110 size_t append_quads_count() { return append_quads_count_; } | 111 size_t append_quads_count() { return append_quads_count_; } |
| 111 | 112 |
| 112 const Region& invalidation() const { return invalidation_; } | 113 const Region& invalidation() const { return invalidation_; } |
| 113 void set_invalidation(const Region& region) { invalidation_ = region; } | 114 void set_invalidation(const Region& region) { invalidation_ = region; } |
| 114 | 115 |
| 115 gfx::Rect visible_rect_for_tile_priority() { | 116 gfx::Rect visible_rect_for_tile_priority() { |
| 116 return visible_rect_for_tile_priority_; | 117 return visible_rect_for_tile_priority_; |
| 117 } | 118 } |
| 118 | 119 |
| 119 gfx::Rect viewport_rect_for_tile_priority_in_content_space() { | 120 gfx::Rect viewport_rect_for_tile_priority_in_content_space() { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 143 | 144 |
| 144 void ReleaseResources() override; | 145 void ReleaseResources() override; |
| 145 | 146 |
| 146 bool only_used_low_res_last_append_quads() const { | 147 bool only_used_low_res_last_append_quads() const { |
| 147 return only_used_low_res_last_append_quads_; | 148 return only_used_low_res_last_append_quads_; |
| 148 } | 149 } |
| 149 | 150 |
| 150 protected: | 151 protected: |
| 151 FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 152 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 152 int id, | 153 int id, |
| 153 scoped_refptr<RasterSource> raster_source, | 154 scoped_refptr<DisplayListRasterSource> raster_source, |
| 154 bool is_mask); | 155 bool is_mask); |
| 155 FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 156 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 156 int id, | 157 int id, |
| 157 scoped_refptr<RasterSource> raster_source, | 158 scoped_refptr<DisplayListRasterSource> raster_source, |
| 158 bool is_mask, | 159 bool is_mask, |
| 159 const gfx::Size& layer_bounds); | 160 const gfx::Size& layer_bounds); |
| 160 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); | 161 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); |
| 161 FakePictureLayerImpl( | 162 FakePictureLayerImpl( |
| 162 LayerTreeImpl* tree_impl, | 163 LayerTreeImpl* tree_impl, |
| 163 int id, | 164 int id, |
| 164 bool is_mask, | 165 bool is_mask, |
| 165 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset); | 166 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset); |
| 166 | 167 |
| 167 private: | 168 private: |
| 168 gfx::Size fixed_tile_size_; | 169 gfx::Size fixed_tile_size_; |
| 169 | 170 |
| 170 size_t append_quads_count_; | 171 size_t append_quads_count_; |
| 171 size_t did_become_active_call_count_; | 172 size_t did_become_active_call_count_; |
| 172 bool has_valid_tile_priorities_; | 173 bool has_valid_tile_priorities_; |
| 173 bool use_set_valid_tile_priorities_flag_; | 174 bool use_set_valid_tile_priorities_flag_; |
| 174 size_t release_resources_count_; | 175 size_t release_resources_count_; |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 } // namespace cc | 178 } // namespace cc |
| 178 | 179 |
| 179 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 180 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |