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 #include "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/debug/trace_event_argument.h" | 12 #include "base/debug/trace_event_argument.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
15 #include "cc/base/util.h" | 15 #include "cc/base/util.h" |
16 #include "cc/debug/debug_colors.h" | 16 #include "cc/debug/debug_colors.h" |
17 #include "cc/debug/micro_benchmark_impl.h" | 17 #include "cc/debug/micro_benchmark_impl.h" |
18 #include "cc/debug/traced_value.h" | 18 #include "cc/debug/traced_value.h" |
19 #include "cc/layers/append_quads_data.h" | 19 #include "cc/layers/append_quads_data.h" |
20 #include "cc/layers/solid_color_layer_impl.h" | 20 #include "cc/layers/solid_color_layer_impl.h" |
21 #include "cc/output/begin_frame_args.h" | 21 #include "cc/output/begin_frame_args.h" |
22 #include "cc/quads/checkerboard_draw_quad.h" | 22 #include "cc/quads/checkerboard_draw_quad.h" |
23 #include "cc/quads/debug_border_draw_quad.h" | 23 #include "cc/quads/debug_border_draw_quad.h" |
24 #include "cc/quads/picture_draw_quad.h" | 24 #include "cc/quads/picture_draw_quad.h" |
25 #include "cc/quads/solid_color_draw_quad.h" | 25 #include "cc/quads/solid_color_draw_quad.h" |
26 #include "cc/quads/tile_draw_quad.h" | 26 #include "cc/quads/tile_draw_quad.h" |
27 #include "cc/resources/tile_manager.h" | 27 #include "cc/resources/tile_manager.h" |
| 28 #include "cc/resources/tiling_set_raster_queue_all.h" |
28 #include "cc/trees/layer_tree_impl.h" | 29 #include "cc/trees/layer_tree_impl.h" |
29 #include "cc/trees/occlusion.h" | 30 #include "cc/trees/occlusion.h" |
30 #include "ui/gfx/geometry/quad_f.h" | 31 #include "ui/gfx/geometry/quad_f.h" |
31 #include "ui/gfx/geometry/rect_conversions.h" | 32 #include "ui/gfx/geometry/rect_conversions.h" |
32 #include "ui/gfx/geometry/size_conversions.h" | 33 #include "ui/gfx/geometry/size_conversions.h" |
33 | 34 |
34 namespace { | 35 namespace { |
35 // This must be > 1 as we multiply or divide by this to find a new raster | 36 // This must be > 1 as we multiply or divide by this to find a new raster |
36 // scale during pinch. | 37 // scale during pinch. |
37 const float kMaxScaleRatioDuringPinch = 2.0f; | 38 const float kMaxScaleRatioDuringPinch = 2.0f; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 nearest_neighbor_(false) { | 88 nearest_neighbor_(false) { |
88 layer_tree_impl()->RegisterPictureLayerImpl(this); | 89 layer_tree_impl()->RegisterPictureLayerImpl(this); |
89 } | 90 } |
90 | 91 |
91 PictureLayerImpl::~PictureLayerImpl() { | 92 PictureLayerImpl::~PictureLayerImpl() { |
92 if (twin_layer_) | 93 if (twin_layer_) |
93 twin_layer_->twin_layer_ = nullptr; | 94 twin_layer_->twin_layer_ = nullptr; |
94 layer_tree_impl()->UnregisterPictureLayerImpl(this); | 95 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
95 } | 96 } |
96 | 97 |
| 98 // TODO(vmpstr): Expose tiling_set to the eviction queue directly. |
97 scoped_ptr<TilingSetEvictionQueue> PictureLayerImpl::CreateEvictionQueue( | 99 scoped_ptr<TilingSetEvictionQueue> PictureLayerImpl::CreateEvictionQueue( |
98 TreePriority tree_priority) { | 100 TreePriority tree_priority) { |
99 if (!tilings_) | 101 if (!tilings_) |
100 return make_scoped_ptr(new TilingSetEvictionQueue()); | 102 return make_scoped_ptr(new TilingSetEvictionQueue()); |
101 bool skip_shared_out_of_order_tiles = | 103 bool skip_shared_out_of_order_tiles = |
102 GetPendingOrActiveTwinLayer() != nullptr; | 104 GetPendingOrActiveTwinLayer() != nullptr; |
103 return make_scoped_ptr(new TilingSetEvictionQueue( | 105 return make_scoped_ptr(new TilingSetEvictionQueue( |
104 tilings_.get(), tree_priority, skip_shared_out_of_order_tiles)); | 106 tilings_.get(), tree_priority, skip_shared_out_of_order_tiles)); |
105 } | 107 } |
106 | 108 |
107 scoped_ptr<TilingSetRasterQueue> PictureLayerImpl::CreateRasterQueue( | |
108 bool prioritize_low_res) { | |
109 if (!tilings_) | |
110 return make_scoped_ptr(new TilingSetRasterQueue()); | |
111 return make_scoped_ptr( | |
112 new TilingSetRasterQueue(tilings_.get(), prioritize_low_res)); | |
113 } | |
114 | |
115 const char* PictureLayerImpl::LayerTypeAsString() const { | 109 const char* PictureLayerImpl::LayerTypeAsString() const { |
116 return "cc::PictureLayerImpl"; | 110 return "cc::PictureLayerImpl"; |
117 } | 111 } |
118 | 112 |
119 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( | 113 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( |
120 LayerTreeImpl* tree_impl) { | 114 LayerTreeImpl* tree_impl) { |
121 return PictureLayerImpl::Create(tree_impl, id(), is_mask_); | 115 return PictureLayerImpl::Create(tree_impl, id(), is_mask_); |
122 } | 116 } |
123 | 117 |
124 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { | 118 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 | 1303 |
1310 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | 1304 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
1311 if (!layer_tree_impl()->IsActiveTree()) | 1305 if (!layer_tree_impl()->IsActiveTree()) |
1312 return true; | 1306 return true; |
1313 | 1307 |
1314 return AllTilesRequiredAreReadyToDraw( | 1308 return AllTilesRequiredAreReadyToDraw( |
1315 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 1309 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
1316 } | 1310 } |
1317 | 1311 |
1318 } // namespace cc | 1312 } // namespace cc |
OLD | NEW |