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 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id)); |
18 } | 18 } |
19 | 19 |
| 20 // Create layer from a pile that covers the entire layer. |
20 static scoped_ptr<FakePictureLayerImpl> CreateWithPile( | 21 static scoped_ptr<FakePictureLayerImpl> CreateWithPile( |
21 LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { | 22 LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { |
22 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile)); | 23 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile)); |
23 } | 24 } |
24 | 25 |
| 26 // Create layer from a pile that only covers part of the layer. |
| 27 static scoped_ptr<FakePictureLayerImpl> CreateWithPartialPile( |
| 28 LayerTreeImpl* tree_impl, |
| 29 int id, |
| 30 scoped_refptr<PicturePileImpl> pile, |
| 31 const gfx::Size& layer_bounds) { |
| 32 return make_scoped_ptr( |
| 33 new FakePictureLayerImpl(tree_impl, id, pile, layer_bounds)); |
| 34 } |
| 35 |
25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 36 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
26 OVERRIDE; | 37 OVERRIDE; |
27 virtual void AppendQuads(QuadSink* quad_sink, | 38 virtual void AppendQuads(QuadSink* quad_sink, |
28 AppendQuadsData* append_quads_data) OVERRIDE; | 39 AppendQuadsData* append_quads_data) OVERRIDE; |
29 virtual gfx::Size CalculateTileSize( | 40 virtual gfx::Size CalculateTileSize( |
30 const gfx::Size& content_bounds) const OVERRIDE; | 41 const gfx::Size& content_bounds) const OVERRIDE; |
31 | 42 |
32 using PictureLayerImpl::AddTiling; | 43 using PictureLayerImpl::AddTiling; |
33 using PictureLayerImpl::CleanUpTilingsOnActiveLayer; | 44 using PictureLayerImpl::CleanUpTilingsOnActiveLayer; |
34 using PictureLayerImpl::CanHaveTilings; | 45 using PictureLayerImpl::CanHaveTilings; |
(...skipping 27 matching lines...) Expand all Loading... |
62 void SetAllTilesVisible(); | 73 void SetAllTilesVisible(); |
63 void SetAllTilesReady(); | 74 void SetAllTilesReady(); |
64 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); | 75 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); |
65 void ResetAllTilesPriorities(); | 76 void ResetAllTilesPriorities(); |
66 | 77 |
67 protected: | 78 protected: |
68 FakePictureLayerImpl( | 79 FakePictureLayerImpl( |
69 LayerTreeImpl* tree_impl, | 80 LayerTreeImpl* tree_impl, |
70 int id, | 81 int id, |
71 scoped_refptr<PicturePileImpl> pile); | 82 scoped_refptr<PicturePileImpl> pile); |
| 83 FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 84 int id, |
| 85 scoped_refptr<PicturePileImpl> pile, |
| 86 const gfx::Size& layer_bounds); |
72 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 87 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
73 | 88 |
74 private: | 89 private: |
75 gfx::Size fixed_tile_size_; | 90 gfx::Size fixed_tile_size_; |
76 | 91 |
77 size_t append_quads_count_; | 92 size_t append_quads_count_; |
78 }; | 93 }; |
79 | 94 |
80 } // namespace cc | 95 } // namespace cc |
81 | 96 |
82 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 97 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |