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

Side by Side Diff: cc/resources/display_list_recording_source.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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/resources/display_list_recording_source.h ('k') | cc/resources/drawing_display_item.h » ('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/resources/display_list_recording_source.h" 5 #include "cc/resources/display_list_recording_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/base/region.h" 9 #include "cc/base/region.h"
10 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
(...skipping 10 matching lines...) Expand all
21 // We don't perform solid color analysis on images that have more than 10 skia 21 // We don't perform solid color analysis on images that have more than 10 skia
22 // operations. 22 // operations.
23 const int kOpCountThatIsOkToAnalyze = 10; 23 const int kOpCountThatIsOkToAnalyze = 10;
24 24
25 } // namespace 25 } // namespace
26 26
27 namespace cc { 27 namespace cc {
28 28
29 DisplayListRecordingSource::DisplayListRecordingSource() 29 DisplayListRecordingSource::DisplayListRecordingSource()
30 : slow_down_raster_scale_factor_for_debug_(0), 30 : slow_down_raster_scale_factor_for_debug_(0),
31 can_use_lcd_text_(true),
31 requires_clear_(false), 32 requires_clear_(false),
32 is_solid_color_(false), 33 is_solid_color_(false),
33 solid_color_(SK_ColorTRANSPARENT), 34 solid_color_(SK_ColorTRANSPARENT),
34 background_color_(SK_ColorTRANSPARENT), 35 background_color_(SK_ColorTRANSPARENT),
35 pixel_record_distance_(kPixelDistanceToRecord), 36 pixel_record_distance_(kPixelDistanceToRecord),
36 is_suitable_for_gpu_rasterization_(true) { 37 is_suitable_for_gpu_rasterization_(true) {
37 } 38 }
38 39
39 DisplayListRecordingSource::~DisplayListRecordingSource() { 40 DisplayListRecordingSource::~DisplayListRecordingSource() {
40 } 41 }
41 42
42 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( 43 bool DisplayListRecordingSource::UpdateAndExpandInvalidation(
43 ContentLayerClient* painter, 44 ContentLayerClient* painter,
44 Region* invalidation, 45 Region* invalidation,
46 bool can_use_lcd_text,
45 const gfx::Size& layer_size, 47 const gfx::Size& layer_size,
46 const gfx::Rect& visible_layer_rect, 48 const gfx::Rect& visible_layer_rect,
47 int frame_number, 49 int frame_number,
48 RecordingMode recording_mode) { 50 RecordingMode recording_mode) {
49 bool updated = false; 51 bool updated = false;
50 52
51 if (size_ != layer_size) { 53 if (size_ != layer_size) {
52 size_ = layer_size; 54 size_ = layer_size;
53 updated = true; 55 updated = true;
54 } 56 }
55 57
58 if (can_use_lcd_text_ != can_use_lcd_text) {
59 can_use_lcd_text_ = can_use_lcd_text;
60 invalidation->Union(gfx::Rect(GetSize()));
61 updated = true;
62 }
63
56 gfx::Rect old_recorded_viewport = recorded_viewport_; 64 gfx::Rect old_recorded_viewport = recorded_viewport_;
57 recorded_viewport_ = visible_layer_rect; 65 recorded_viewport_ = visible_layer_rect;
58 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_); 66 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_);
59 recorded_viewport_.Intersect(gfx::Rect(GetSize())); 67 recorded_viewport_.Intersect(gfx::Rect(GetSize()));
60 68
61 if (recorded_viewport_ != old_recorded_viewport) { 69 if (recorded_viewport_ != old_recorded_viewport) {
62 // Invalidate newly-exposed and no-longer-exposed areas. 70 // Invalidate newly-exposed and no-longer-exposed areas.
63 Region newly_exposed_region(recorded_viewport_); 71 Region newly_exposed_region(recorded_viewport_);
64 newly_exposed_region.Subtract(old_recorded_viewport); 72 newly_exposed_region.Subtract(old_recorded_viewport);
65 invalidation->Union(newly_exposed_region); 73 invalidation->Union(newly_exposed_region);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 145 }
138 146
139 void DisplayListRecordingSource::SetUnsuitableForGpuRasterizationForTesting() { 147 void DisplayListRecordingSource::SetUnsuitableForGpuRasterizationForTesting() {
140 is_suitable_for_gpu_rasterization_ = false; 148 is_suitable_for_gpu_rasterization_ = false;
141 } 149 }
142 150
143 bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const { 151 bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const {
144 return is_suitable_for_gpu_rasterization_; 152 return is_suitable_for_gpu_rasterization_;
145 } 153 }
146 154
147 scoped_refptr<RasterSource> DisplayListRecordingSource::CreateRasterSource( 155 scoped_refptr<RasterSource> DisplayListRecordingSource::CreateRasterSource()
148 bool can_use_lcd_text) const { 156 const {
149 return scoped_refptr<RasterSource>( 157 return scoped_refptr<RasterSource>(
150 DisplayListRasterSource::CreateFromDisplayListRecordingSource( 158 DisplayListRasterSource::CreateFromDisplayListRecordingSource(this));
151 this, can_use_lcd_text));
152 } 159 }
153 160
154 gfx::Size DisplayListRecordingSource::GetTileGridSizeForTesting() const { 161 gfx::Size DisplayListRecordingSource::GetTileGridSizeForTesting() const {
155 return gfx::Size(); 162 return gfx::Size();
156 } 163 }
157 164
158 void DisplayListRecordingSource::DetermineIfSolidColor() { 165 void DisplayListRecordingSource::DetermineIfSolidColor() {
159 DCHECK(display_list_.get()); 166 DCHECK(display_list_.get());
160 is_solid_color_ = false; 167 is_solid_color_ = false;
161 solid_color_ = SK_ColorTRANSPARENT; 168 solid_color_ = SK_ColorTRANSPARENT;
162 169
163 if (display_list_->ApproximateOpCount() > kOpCountThatIsOkToAnalyze) 170 if (display_list_->ApproximateOpCount() > kOpCountThatIsOkToAnalyze)
164 return; 171 return;
165 172
166 gfx::Size layer_size = GetSize(); 173 gfx::Size layer_size = GetSize();
167 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); 174 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height());
168 display_list_->Raster(&canvas, nullptr, 1.f); 175 display_list_->Raster(&canvas, nullptr, 1.f);
169 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); 176 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_);
170 } 177 }
171 178
172 void DisplayListRecordingSource::Clear() { 179 void DisplayListRecordingSource::Clear() {
173 recorded_viewport_ = gfx::Rect(); 180 recorded_viewport_ = gfx::Rect();
174 display_list_ = NULL; 181 display_list_ = NULL;
175 is_solid_color_ = false; 182 is_solid_color_ = false;
176 } 183 }
177 184
178 } // namespace cc 185 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/display_list_recording_source.h ('k') | cc/resources/drawing_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698