| 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 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 class FakePictureLayerImpl : public PictureLayerImpl { | 13 class FakePictureLayerImpl : public PictureLayerImpl { |
| 14 public: | 14 public: |
| 15 static scoped_ptr<FakePictureLayerImpl> Create( | 15 static scoped_ptr<FakePictureLayerImpl> Create( |
| 16 LayerTreeImpl* tree_impl, int id) { | 16 LayerTreeImpl* tree_impl, int id) { |
| 17 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id)); | 17 bool is_mask = false; |
| 18 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, is_mask)); |
| 18 } | 19 } |
| 19 | 20 |
| 20 // Create layer from a raster source that covers the entire layer. | 21 // Create layer from a raster source that covers the entire layer. |
| 21 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource( | 22 static scoped_ptr<FakePictureLayerImpl> CreateWithRasterSource( |
| 22 LayerTreeImpl* tree_impl, | 23 LayerTreeImpl* tree_impl, |
| 23 int id, | 24 int id, |
| 24 scoped_refptr<RasterSource> raster_source) { | 25 scoped_refptr<RasterSource> raster_source) { |
| 26 bool is_mask = false; |
| 25 return make_scoped_ptr( | 27 return make_scoped_ptr( |
| 26 new FakePictureLayerImpl(tree_impl, id, raster_source)); | 28 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); |
| 27 } | 29 } |
| 28 | 30 |
| 29 // Create layer from a raster source that only covers part of the layer. | 31 // Create layer from a raster source that only covers part of the layer. |
| 30 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( | 32 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( |
| 31 LayerTreeImpl* tree_impl, | 33 LayerTreeImpl* tree_impl, |
| 32 int id, | 34 int id, |
| 33 scoped_refptr<RasterSource> raster_source, | 35 scoped_refptr<RasterSource> raster_source, |
| 34 const gfx::Size& layer_bounds) { | 36 const gfx::Size& layer_bounds) { |
| 37 bool is_mask = false; |
| 38 return make_scoped_ptr(new FakePictureLayerImpl( |
| 39 tree_impl, id, raster_source, is_mask, layer_bounds)); |
| 40 } |
| 41 |
| 42 // Create layer from a raster source that covers the entire layer and is a |
| 43 // mask. |
| 44 static scoped_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( |
| 45 LayerTreeImpl* tree_impl, |
| 46 int id, |
| 47 scoped_refptr<RasterSource> raster_source) { |
| 48 bool is_mask = true; |
| 35 return make_scoped_ptr( | 49 return make_scoped_ptr( |
| 36 new FakePictureLayerImpl(tree_impl, id, raster_source, layer_bounds)); | 50 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); |
| 37 } | 51 } |
| 38 | 52 |
| 39 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 53 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 54 void PushPropertiesTo(LayerImpl* layer_impl) override; |
| 40 void AppendQuads(RenderPass* render_pass, | 55 void AppendQuads(RenderPass* render_pass, |
| 41 const Occlusion& occlusion_in_content_space, | 56 const Occlusion& occlusion_in_content_space, |
| 42 AppendQuadsData* append_quads_data) override; | 57 AppendQuadsData* append_quads_data) override; |
| 43 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 58 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
| 44 | 59 |
| 45 void DidBecomeActive() override; | 60 void DidBecomeActive() override; |
| 46 size_t did_become_active_call_count() { | 61 size_t did_become_active_call_count() { |
| 47 return did_become_active_call_count_; | 62 return did_become_active_call_count_; |
| 48 } | 63 } |
| 49 | 64 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 99 |
| 85 float ideal_contents_scale() const { return ideal_contents_scale_; } | 100 float ideal_contents_scale() const { return ideal_contents_scale_; } |
| 86 float raster_contents_scale() const { return raster_contents_scale_; } | 101 float raster_contents_scale() const { return raster_contents_scale_; } |
| 87 | 102 |
| 88 PictureLayerTiling* HighResTiling() const; | 103 PictureLayerTiling* HighResTiling() const; |
| 89 PictureLayerTiling* LowResTiling() const; | 104 PictureLayerTiling* LowResTiling() const; |
| 90 size_t num_tilings() const { return tilings_->num_tilings(); } | 105 size_t num_tilings() const { return tilings_->num_tilings(); } |
| 91 | 106 |
| 92 PictureLayerTilingSet* tilings() { return tilings_.get(); } | 107 PictureLayerTilingSet* tilings() { return tilings_.get(); } |
| 93 RasterSource* raster_source() { return raster_source_.get(); } | 108 RasterSource* raster_source() { return raster_source_.get(); } |
| 94 void SetRasterSource(scoped_refptr<RasterSource> raster_source); | 109 void SetRasterSourceOnPending(scoped_refptr<RasterSource> raster_source, |
| 110 const Region& invalidation); |
| 95 size_t append_quads_count() { return append_quads_count_; } | 111 size_t append_quads_count() { return append_quads_count_; } |
| 96 | 112 |
| 97 const Region& invalidation() const { return invalidation_; } | 113 const Region& invalidation() const { return invalidation_; } |
| 98 void set_invalidation(const Region& region) { invalidation_ = region; } | 114 void set_invalidation(const Region& region) { invalidation_ = region; } |
| 99 | 115 |
| 100 gfx::Rect visible_rect_for_tile_priority() { | 116 gfx::Rect visible_rect_for_tile_priority() { |
| 101 return visible_rect_for_tile_priority_; | 117 return visible_rect_for_tile_priority_; |
| 102 } | 118 } |
| 103 | 119 |
| 104 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } | 120 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } |
| 105 | 121 |
| 122 // TODO(danakj): Remove this darn thing. |
| 106 void CreateDefaultTilingsAndTiles(); | 123 void CreateDefaultTilingsAndTiles(); |
| 124 |
| 107 void SetAllTilesVisible(); | 125 void SetAllTilesVisible(); |
| 108 void SetAllTilesReady(); | 126 void SetAllTilesReady(); |
| 109 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); | 127 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); |
| 110 void SetTileReady(Tile* tile); | 128 void SetTileReady(Tile* tile); |
| 111 void ResetAllTilesPriorities(); | 129 void ResetAllTilesPriorities(); |
| 112 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } | 130 PictureLayerTilingSet* GetTilings() { return tilings_.get(); } |
| 113 | 131 |
| 114 size_t release_resources_count() const { return release_resources_count_; } | 132 size_t release_resources_count() const { return release_resources_count_; } |
| 115 void reset_release_resources_count() { release_resources_count_ = 0; } | 133 void reset_release_resources_count() { release_resources_count_ = 0; } |
| 116 | 134 |
| 117 void ReleaseResources() override; | 135 void ReleaseResources() override; |
| 118 | 136 |
| 119 bool only_used_low_res_last_append_quads() const { | 137 bool only_used_low_res_last_append_quads() const { |
| 120 return only_used_low_res_last_append_quads_; | 138 return only_used_low_res_last_append_quads_; |
| 121 } | 139 } |
| 122 | 140 |
| 123 protected: | 141 protected: |
| 124 FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 142 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 125 int id, | 143 int id, |
| 126 scoped_refptr<RasterSource> raster_source); | 144 scoped_refptr<RasterSource> raster_source, |
| 145 bool is_mask); |
| 127 FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 146 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 128 int id, | 147 int id, |
| 129 scoped_refptr<RasterSource> raster_source, | 148 scoped_refptr<RasterSource> raster_source, |
| 149 bool is_mask, |
| 130 const gfx::Size& layer_bounds); | 150 const gfx::Size& layer_bounds); |
| 131 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 151 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); |
| 132 | 152 |
| 133 private: | 153 private: |
| 134 gfx::Size fixed_tile_size_; | 154 gfx::Size fixed_tile_size_; |
| 135 | 155 |
| 136 size_t append_quads_count_; | 156 size_t append_quads_count_; |
| 137 size_t did_become_active_call_count_; | 157 size_t did_become_active_call_count_; |
| 138 bool has_valid_tile_priorities_; | 158 bool has_valid_tile_priorities_; |
| 139 bool use_set_valid_tile_priorities_flag_; | 159 bool use_set_valid_tile_priorities_flag_; |
| 140 size_t release_resources_count_; | 160 size_t release_resources_count_; |
| 141 }; | 161 }; |
| 142 | 162 |
| 143 } // namespace cc | 163 } // namespace cc |
| 144 | 164 |
| 145 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 165 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |