OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_LAYERS_PICTURE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/base/scoped_ptr_vector.h" | 13 #include "cc/base/scoped_ptr_vector.h" |
14 #include "cc/layers/layer_impl.h" | 14 #include "cc/layers/layer_impl.h" |
15 #include "cc/resources/picture_layer_tiling.h" | 15 #include "cc/resources/picture_layer_tiling.h" |
16 #include "cc/resources/picture_layer_tiling_set.h" | 16 #include "cc/resources/picture_layer_tiling_set.h" |
17 #include "cc/resources/picture_pile_impl.h" | 17 #include "cc/resources/picture_pile_impl.h" |
18 #include "cc/resources/tiling_set_eviction_queue.h" | 18 #include "cc/resources/tiling_set_eviction_queue.h" |
| 19 #include "cc/resources/tiling_set_raster_queue.h" |
19 #include "skia/ext/refptr.h" | 20 #include "skia/ext/refptr.h" |
20 #include "third_party/skia/include/core/SkPicture.h" | 21 #include "third_party/skia/include/core/SkPicture.h" |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 | 24 |
24 struct AppendQuadsData; | 25 struct AppendQuadsData; |
25 class MicroBenchmarkImpl; | 26 class MicroBenchmarkImpl; |
26 class Tile; | 27 class Tile; |
27 | 28 |
28 class CC_EXPORT PictureLayerImpl | 29 class CC_EXPORT PictureLayerImpl |
29 : public LayerImpl, | 30 : public LayerImpl, |
30 NON_EXPORTED_BASE(public PictureLayerTilingClient) { | 31 NON_EXPORTED_BASE(public PictureLayerTilingClient) { |
31 public: | 32 public: |
32 struct CC_EXPORT Pair { | 33 struct CC_EXPORT Pair { |
33 Pair(); | 34 Pair(); |
34 Pair(PictureLayerImpl* active_layer, PictureLayerImpl* pending_layer); | 35 Pair(PictureLayerImpl* active_layer, PictureLayerImpl* pending_layer); |
35 ~Pair(); | 36 ~Pair(); |
36 | 37 |
37 PictureLayerImpl* active; | 38 PictureLayerImpl* active; |
38 PictureLayerImpl* pending; | 39 PictureLayerImpl* pending; |
39 }; | 40 }; |
40 | 41 |
41 class CC_EXPORT LayerRasterTileIterator { | |
42 public: | |
43 LayerRasterTileIterator(); | |
44 LayerRasterTileIterator(PictureLayerImpl* layer, bool prioritize_low_res); | |
45 ~LayerRasterTileIterator(); | |
46 | |
47 Tile* operator*(); | |
48 const Tile* operator*() const; | |
49 LayerRasterTileIterator& operator++(); | |
50 operator bool() const; | |
51 | |
52 private: | |
53 enum IteratorType { LOW_RES, HIGH_RES, NUM_ITERATORS }; | |
54 | |
55 void AdvanceToNextStage(); | |
56 | |
57 PictureLayerImpl* layer_; | |
58 | |
59 struct IterationStage { | |
60 IteratorType iterator_type; | |
61 TilePriority::PriorityBin tile_type; | |
62 }; | |
63 | |
64 size_t current_stage_; | |
65 | |
66 // One low res stage, and three high res stages. | |
67 IterationStage stages_[4]; | |
68 PictureLayerTiling::TilingRasterTileIterator iterators_[NUM_ITERATORS]; | |
69 }; | |
70 | |
71 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 42 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
72 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); | 43 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); |
73 } | 44 } |
74 ~PictureLayerImpl() override; | 45 ~PictureLayerImpl() override; |
75 | 46 |
76 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( | 47 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( |
77 TreePriority tree_priority); | 48 TreePriority tree_priority); |
| 49 scoped_ptr<TilingSetRasterQueue> CreateRasterQueue(bool prioritize_low_res); |
78 | 50 |
79 // LayerImpl overrides. | 51 // LayerImpl overrides. |
80 const char* LayerTypeAsString() const override; | 52 const char* LayerTypeAsString() const override; |
81 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 53 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
82 void PushPropertiesTo(LayerImpl* layer) override; | 54 void PushPropertiesTo(LayerImpl* layer) override; |
83 void AppendQuads(RenderPass* render_pass, | 55 void AppendQuads(RenderPass* render_pass, |
84 const Occlusion& occlusion_in_content_space, | 56 const Occlusion& occlusion_in_content_space, |
85 AppendQuadsData* append_quads_data) override; | 57 AppendQuadsData* append_quads_data) override; |
86 void UpdateTiles(const Occlusion& occlusion_in_content_space, | 58 void UpdateTiles(const Occlusion& occlusion_in_content_space, |
87 bool resourceless_software_draw) override; | 59 bool resourceless_software_draw) override; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // frame that has a valid viewport for prioritizing tiles. | 181 // frame that has a valid viewport for prioritizing tiles. |
210 gfx::Rect visible_rect_for_tile_priority_; | 182 gfx::Rect visible_rect_for_tile_priority_; |
211 | 183 |
212 friend class PictureLayer; | 184 friend class PictureLayer; |
213 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 185 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
214 }; | 186 }; |
215 | 187 |
216 } // namespace cc | 188 } // namespace cc |
217 | 189 |
218 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 190 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |