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 static scoped_ptr<FakePictureLayerImpl> CreateWithPile( | 20 static scoped_ptr<FakePictureLayerImpl> CreateWithPile( |
21 LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { | 21 LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { |
22 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile)); | 22 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id, pile)); |
23 } | 23 } |
24 | 24 |
25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
26 OVERRIDE; | 26 OVERRIDE; |
27 virtual void AppendQuads(QuadSink* quad_sink, | 27 virtual void AppendQuads(QuadSink* quad_sink, |
28 AppendQuadsData* append_quads_data) OVERRIDE; | 28 AppendQuadsData* append_quads_data) OVERRIDE; |
29 virtual gfx::Size CalculateTileSize( | 29 virtual gfx::Size CalculateTileSize(gfx::Size content_bounds) const OVERRIDE; |
30 const gfx::Size& content_bounds) const OVERRIDE; | |
31 | 30 |
32 using PictureLayerImpl::AddTiling; | 31 using PictureLayerImpl::AddTiling; |
33 using PictureLayerImpl::CleanUpTilingsOnActiveLayer; | 32 using PictureLayerImpl::CleanUpTilingsOnActiveLayer; |
34 using PictureLayerImpl::CanHaveTilings; | 33 using PictureLayerImpl::CanHaveTilings; |
35 using PictureLayerImpl::MarkVisibleResourcesAsRequired; | 34 using PictureLayerImpl::MarkVisibleResourcesAsRequired; |
36 using PictureLayerImpl::DoPostCommitInitializationIfNeeded; | 35 using PictureLayerImpl::DoPostCommitInitializationIfNeeded; |
37 using PictureLayerImpl::MinimumContentsScale; | 36 using PictureLayerImpl::MinimumContentsScale; |
38 | 37 |
39 bool needs_post_commit_initialization() const { | 38 bool needs_post_commit_initialization() const { |
40 return needs_post_commit_initialization_; | 39 return needs_post_commit_initialization_; |
41 } | 40 } |
42 | 41 |
43 bool is_using_lcd_text() const { return is_using_lcd_text_; } | 42 bool is_using_lcd_text() const { return is_using_lcd_text_; } |
44 void force_set_lcd_text(bool enabled) { is_using_lcd_text_ = enabled; } | 43 void force_set_lcd_text(bool enabled) { is_using_lcd_text_ = enabled; } |
45 | 44 |
46 PictureLayerTiling* HighResTiling() const; | 45 PictureLayerTiling* HighResTiling() const; |
47 PictureLayerTiling* LowResTiling() const; | 46 PictureLayerTiling* LowResTiling() const; |
48 size_t num_tilings() const { return tilings_->num_tilings(); } | 47 size_t num_tilings() const { return tilings_->num_tilings(); } |
49 | 48 |
50 PictureLayerImpl* twin_layer() { return twin_layer_; } | 49 PictureLayerImpl* twin_layer() { return twin_layer_; } |
51 PictureLayerTilingSet* tilings() { return tilings_.get(); } | 50 PictureLayerTilingSet* tilings() { return tilings_.get(); } |
52 PicturePileImpl* pile() { return pile_.get(); } | 51 PicturePileImpl* pile() { return pile_.get(); } |
53 size_t append_quads_count() { return append_quads_count_; } | 52 size_t append_quads_count() { return append_quads_count_; } |
54 | 53 |
55 const Region& invalidation() const { return invalidation_; } | 54 const Region& invalidation() const { return invalidation_; } |
56 void set_invalidation(const Region& region) { invalidation_ = region; } | 55 void set_invalidation(const Region& region) { invalidation_ = region; } |
57 | 56 |
58 void set_fixed_tile_size(const gfx::Size& size) { fixed_tile_size_ = size; } | 57 void set_fixed_tile_size(gfx::Size size) { fixed_tile_size_ = size; } |
59 | 58 |
60 void CreateDefaultTilingsAndTiles(); | 59 void CreateDefaultTilingsAndTiles(); |
61 void SetAllTilesVisible(); | 60 void SetAllTilesVisible(); |
62 void SetAllTilesReady(); | 61 void SetAllTilesReady(); |
63 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); | 62 void SetAllTilesReadyInTiling(PictureLayerTiling* tiling); |
64 | 63 |
65 protected: | 64 protected: |
66 FakePictureLayerImpl( | 65 FakePictureLayerImpl( |
67 LayerTreeImpl* tree_impl, | 66 LayerTreeImpl* tree_impl, |
68 int id, | 67 int id, |
69 scoped_refptr<PicturePileImpl> pile); | 68 scoped_refptr<PicturePileImpl> pile); |
70 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 69 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
71 | 70 |
72 private: | 71 private: |
73 gfx::Size fixed_tile_size_; | 72 gfx::Size fixed_tile_size_; |
74 | 73 |
75 size_t append_quads_count_; | 74 size_t append_quads_count_; |
76 }; | 75 }; |
77 | 76 |
78 } // namespace cc | 77 } // namespace cc |
79 | 78 |
80 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ | 79 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |