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

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

Issue 2781183002: Remove image_decode_tasks_enabled flag. (Closed)
Patch Set: fixes Created 3 years, 8 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/recording_source.h ('k') | cc/layers/recording_source_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/recording_source.h" 5 #include "cc/layers/recording_source.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 11 matching lines...) Expand all
22 #else 22 #else
23 const bool kDefaultClearCanvasSetting = true; 23 const bool kDefaultClearCanvasSetting = true;
24 #endif 24 #endif
25 25
26 } // namespace 26 } // namespace
27 27
28 namespace cc { 28 namespace cc {
29 29
30 RecordingSource::RecordingSource() 30 RecordingSource::RecordingSource()
31 : slow_down_raster_scale_factor_for_debug_(0), 31 : slow_down_raster_scale_factor_for_debug_(0),
32 generate_discardable_images_metadata_(false),
33 requires_clear_(false), 32 requires_clear_(false),
34 is_solid_color_(false), 33 is_solid_color_(false),
35 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), 34 clear_canvas_with_debug_color_(kDefaultClearCanvasSetting),
36 solid_color_(SK_ColorTRANSPARENT), 35 solid_color_(SK_ColorTRANSPARENT),
37 background_color_(SK_ColorTRANSPARENT) {} 36 background_color_(SK_ColorTRANSPARENT) {}
38 37
39 RecordingSource::~RecordingSource() {} 38 RecordingSource::~RecordingSource() {}
40 39
41 void RecordingSource::UpdateInvalidationForNewViewport( 40 void RecordingSource::UpdateInvalidationForNewViewport(
42 const gfx::Rect& old_recorded_viewport, 41 const gfx::Rect& old_recorded_viewport,
43 const gfx::Rect& new_recorded_viewport, 42 const gfx::Rect& new_recorded_viewport,
44 Region* invalidation) { 43 Region* invalidation) {
45 // Invalidate newly-exposed and no-longer-exposed areas. 44 // Invalidate newly-exposed and no-longer-exposed areas.
46 Region newly_exposed_region(new_recorded_viewport); 45 Region newly_exposed_region(new_recorded_viewport);
47 newly_exposed_region.Subtract(old_recorded_viewport); 46 newly_exposed_region.Subtract(old_recorded_viewport);
48 invalidation->Union(newly_exposed_region); 47 invalidation->Union(newly_exposed_region);
49 48
50 Region no_longer_exposed_region(old_recorded_viewport); 49 Region no_longer_exposed_region(old_recorded_viewport);
51 no_longer_exposed_region.Subtract(new_recorded_viewport); 50 no_longer_exposed_region.Subtract(new_recorded_viewport);
52 invalidation->Union(no_longer_exposed_region); 51 invalidation->Union(no_longer_exposed_region);
53 } 52 }
54 53
55 void RecordingSource::FinishDisplayItemListUpdate() { 54 void RecordingSource::FinishDisplayItemListUpdate() {
56 TRACE_EVENT0("cc", "RecordingSource::FinishDisplayItemListUpdate"); 55 TRACE_EVENT0("cc", "RecordingSource::FinishDisplayItemListUpdate");
57 DetermineIfSolidColor(); 56 DetermineIfSolidColor();
58 display_list_->EmitTraceSnapshot(); 57 display_list_->EmitTraceSnapshot();
59 if (generate_discardable_images_metadata_) 58 display_list_->GenerateDiscardableImagesMetadata();
60 display_list_->GenerateDiscardableImagesMetadata();
61 } 59 }
62 60
63 void RecordingSource::SetNeedsDisplayRect(const gfx::Rect& layer_rect) { 61 void RecordingSource::SetNeedsDisplayRect(const gfx::Rect& layer_rect) {
64 if (!layer_rect.IsEmpty()) { 62 if (!layer_rect.IsEmpty()) {
65 // Clamp invalidation to the layer bounds. 63 // Clamp invalidation to the layer bounds.
66 invalidation_.Union(gfx::IntersectRects(layer_rect, gfx::Rect(size_))); 64 invalidation_.Union(gfx::IntersectRects(layer_rect, gfx::Rect(size_)));
67 } 65 }
68 } 66 }
69 67
70 bool RecordingSource::UpdateAndExpandInvalidation( 68 bool RecordingSource::UpdateAndExpandInvalidation(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 112
115 recorded_viewport_ = gfx::Rect(); 113 recorded_viewport_ = gfx::Rect();
116 display_list_ = nullptr; 114 display_list_ = nullptr;
117 painter_reported_memory_usage_ = 0; 115 painter_reported_memory_usage_ = 0;
118 } 116 }
119 117
120 void RecordingSource::SetSlowdownRasterScaleFactor(int factor) { 118 void RecordingSource::SetSlowdownRasterScaleFactor(int factor) {
121 slow_down_raster_scale_factor_for_debug_ = factor; 119 slow_down_raster_scale_factor_for_debug_ = factor;
122 } 120 }
123 121
124 void RecordingSource::SetGenerateDiscardableImagesMetadata(
125 bool generate_metadata) {
126 generate_discardable_images_metadata_ = generate_metadata;
127 }
128
129 void RecordingSource::SetBackgroundColor(SkColor background_color) { 122 void RecordingSource::SetBackgroundColor(SkColor background_color) {
130 background_color_ = background_color; 123 background_color_ = background_color;
131 } 124 }
132 125
133 void RecordingSource::SetRequiresClear(bool requires_clear) { 126 void RecordingSource::SetRequiresClear(bool requires_clear) {
134 requires_clear_ = requires_clear; 127 requires_clear_ = requires_clear;
135 } 128 }
136 129
137 const DisplayItemList* RecordingSource::GetDisplayItemList() { 130 const DisplayItemList* RecordingSource::GetDisplayItemList() {
138 return display_list_.get(); 131 return display_list_.get();
(...skipping 15 matching lines...) Expand all
154 147
155 TRACE_EVENT1("cc", "RecordingSource::DetermineIfSolidColor", "opcount", 148 TRACE_EVENT1("cc", "RecordingSource::DetermineIfSolidColor", "opcount",
156 display_list_->ApproximateOpCount()); 149 display_list_->ApproximateOpCount());
157 gfx::Size layer_size = GetSize(); 150 gfx::Size layer_size = GetSize();
158 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); 151 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height());
159 display_list_->Raster(&canvas, nullptr, gfx::Rect(layer_size), 1.f); 152 display_list_->Raster(&canvas, nullptr, gfx::Rect(layer_size), 1.f);
160 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); 153 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_);
161 } 154 }
162 155
163 } // namespace cc 156 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/recording_source.h ('k') | cc/layers/recording_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698