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