Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: cc/layers/picture_layer.cc

Issue 2681183002: cc: Add flag to disable future mask tiling. (Closed)
Patch Set: Correct my mistake in rebase. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "cc/layers/content_layer_client.h" 9 #include "cc/layers/content_layer_client.h"
10 #include "cc/layers/picture_layer_impl.h" 10 #include "cc/layers/picture_layer_impl.h"
11 #include "cc/paint/paint_record.h" 11 #include "cc/paint/paint_record.h"
12 #include "cc/playback/recording_source.h" 12 #include "cc/playback/recording_source.h"
13 #include "cc/trees/layer_tree_host.h" 13 #include "cc/trees/layer_tree_host.h"
14 #include "cc/trees/layer_tree_impl.h" 14 #include "cc/trees/layer_tree_impl.h"
15 #include "ui/gfx/geometry/rect_conversions.h" 15 #include "ui/gfx/geometry/rect_conversions.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 PictureLayer::PictureLayerInputs::PictureLayerInputs() = default; 19 PictureLayer::PictureLayerInputs::PictureLayerInputs() = default;
20 20
21 PictureLayer::PictureLayerInputs::~PictureLayerInputs() = default; 21 PictureLayer::PictureLayerInputs::~PictureLayerInputs() = default;
22 22
23 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { 23 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) {
24 return make_scoped_refptr(new PictureLayer(client)); 24 return make_scoped_refptr(new PictureLayer(client));
25 } 25 }
26 26
27 PictureLayer::PictureLayer(ContentLayerClient* client) 27 PictureLayer::PictureLayer(ContentLayerClient* client)
28 : instrumentation_object_tracker_(id()), 28 : instrumentation_object_tracker_(id()),
29 update_source_frame_number_(-1), 29 update_source_frame_number_(-1),
30 mask_type_(Layer::LayerMaskType::NOT_MASK) { 30 mask_type_(LayerMaskType::NOT_MASK) {
31 picture_layer_inputs_.client = client; 31 picture_layer_inputs_.client = client;
32 } 32 }
33 33
34 PictureLayer::PictureLayer(ContentLayerClient* client, 34 PictureLayer::PictureLayer(ContentLayerClient* client,
35 std::unique_ptr<RecordingSource> source) 35 std::unique_ptr<RecordingSource> source)
36 : PictureLayer(client) { 36 : PictureLayer(client) {
37 recording_source_ = std::move(source); 37 recording_source_ = std::move(source);
38 } 38 }
39 39
40 PictureLayer::~PictureLayer() { 40 PictureLayer::~PictureLayer() {
(...skipping 20 matching lines...) Expand all
61 recording_source_->CreateRasterSource(can_use_lcd_text); 61 recording_source_->CreateRasterSource(can_use_lcd_text);
62 layer_impl->set_gpu_raster_max_texture_size( 62 layer_impl->set_gpu_raster_max_texture_size(
63 layer_tree_host()->device_viewport_size()); 63 layer_tree_host()->device_viewport_size());
64 layer_impl->UpdateRasterSource(raster_source, &last_updated_invalidation_, 64 layer_impl->UpdateRasterSource(raster_source, &last_updated_invalidation_,
65 nullptr); 65 nullptr);
66 DCHECK(last_updated_invalidation_.IsEmpty()); 66 DCHECK(last_updated_invalidation_.IsEmpty());
67 } 67 }
68 68
69 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { 69 void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
70 Layer::SetLayerTreeHost(host); 70 Layer::SetLayerTreeHost(host);
71
71 if (!host) 72 if (!host)
72 return; 73 return;
73 74
75 if (!host->GetSettings().enable_mask_tiling &&
76 mask_type_ == LayerMaskType::MULTI_TEXTURE_MASK)
77 mask_type_ = LayerMaskType::SINGLE_TEXTURE_MASK;
78
74 if (!recording_source_) 79 if (!recording_source_)
75 recording_source_.reset(new RecordingSource); 80 recording_source_.reset(new RecordingSource);
76 recording_source_->SetSlowdownRasterScaleFactor( 81 recording_source_->SetSlowdownRasterScaleFactor(
77 host->GetDebugState().slow_down_raster_scale_factor); 82 host->GetDebugState().slow_down_raster_scale_factor);
78 // If we need to enable image decode tasks, then we have to generate the 83 // If we need to enable image decode tasks, then we have to generate the
79 // discardable images metadata. 84 // discardable images metadata.
80 const LayerTreeSettings& settings = layer_tree_host()->GetSettings(); 85 const LayerTreeSettings& settings = layer_tree_host()->GetSettings();
81 recording_source_->SetGenerateDiscardableImagesMetadata( 86 recording_source_->SetGenerateDiscardableImagesMetadata(
82 settings.image_decode_tasks_enabled); 87 settings.image_decode_tasks_enabled);
83 } 88 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 SetNeedsPushProperties(); 135 SetNeedsPushProperties();
131 } else { 136 } else {
132 // If this invalidation did not affect the recording source, then it can be 137 // If this invalidation did not affect the recording source, then it can be
133 // cleared as an optimization. 138 // cleared as an optimization.
134 last_updated_invalidation_.Clear(); 139 last_updated_invalidation_.Clear();
135 } 140 }
136 141
137 return updated; 142 return updated;
138 } 143 }
139 144
140 void PictureLayer::SetLayerMaskType(Layer::LayerMaskType mask_type) { 145 void PictureLayer::SetLayerMaskType(LayerMaskType mask_type) {
141 mask_type_ = mask_type; 146 mask_type_ = mask_type;
142 } 147 }
143 148
144 sk_sp<SkPicture> PictureLayer::GetPicture() const { 149 sk_sp<SkPicture> PictureLayer::GetPicture() const {
145 // We could either flatten the RecordingSource into a single SkPicture, or 150 // We could either flatten the RecordingSource into a single SkPicture, or
146 // paint a fresh one depending on what we intend to do with it. For now we 151 // paint a fresh one depending on what we intend to do with it. For now we
147 // just paint a fresh one to get consistent results. 152 // just paint a fresh one to get consistent results.
148 if (!DrawsContent()) 153 if (!DrawsContent())
149 return nullptr; 154 return nullptr;
150 155
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 picture_layer_inputs_.display_list = nullptr; 231 picture_layer_inputs_.display_list = nullptr;
227 picture_layer_inputs_.painter_reported_memory_usage = 0; 232 picture_layer_inputs_.painter_reported_memory_usage = 0;
228 } 233 }
229 } 234 }
230 235
231 const DisplayItemList* PictureLayer::GetDisplayItemList() { 236 const DisplayItemList* PictureLayer::GetDisplayItemList() {
232 return picture_layer_inputs_.display_list.get(); 237 return picture_layer_inputs_.display_list.get();
233 } 238 }
234 239
235 } // namespace cc 240 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698