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

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

Issue 935333002: Update from https://crrev.com/316786 (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 11 matching lines...) Expand all
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 can_use_lcd_text_(true),
32 requires_clear_(false),
32 is_solid_color_(false), 33 is_solid_color_(false),
33 solid_color_(SK_ColorTRANSPARENT), 34 solid_color_(SK_ColorTRANSPARENT),
35 background_color_(SK_ColorTRANSPARENT),
34 pixel_record_distance_(kPixelDistanceToRecord), 36 pixel_record_distance_(kPixelDistanceToRecord),
35 is_suitable_for_gpu_rasterization_(true) { 37 is_suitable_for_gpu_rasterization_(true) {
36 } 38 }
37 39
38 DisplayListRecordingSource::~DisplayListRecordingSource() { 40 DisplayListRecordingSource::~DisplayListRecordingSource() {
39 } 41 }
40 42
41 bool DisplayListRecordingSource::UpdateAndExpandInvalidation( 43 bool DisplayListRecordingSource::UpdateAndExpandInvalidation(
42 ContentLayerClient* painter, 44 ContentLayerClient* painter,
43 Region* invalidation, 45 Region* invalidation,
44 bool can_use_lcd_text, 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
56 if (can_use_lcd_text_ != can_use_lcd_text) { 58 if (can_use_lcd_text_ != can_use_lcd_text) {
57 can_use_lcd_text_ = can_use_lcd_text; 59 can_use_lcd_text_ = can_use_lcd_text;
58 invalidation->Union(gfx::Rect(GetSize())); 60 invalidation->Union(gfx::Rect(GetSize()));
59 updated = true; 61 updated = true;
60 } 62 }
61 63
62 gfx::Rect old_recorded_viewport = recorded_viewport_; 64 gfx::Rect old_recorded_viewport = recorded_viewport_;
63 // TODO(wangxianzhu): Blink slimming paint doesn't support incremental 65 recorded_viewport_ = visible_layer_rect;
64 // painting for now so we must record for the whole layer. Should measure 66 recorded_viewport_.Inset(-pixel_record_distance_, -pixel_record_distance_);
65 // performance and determine the best choice. Consider display item caching. 67 recorded_viewport_.Intersect(gfx::Rect(GetSize()));
66 recorded_viewport_ = gfx::Rect(GetSize());
67 68
68 if (recorded_viewport_ != old_recorded_viewport) { 69 if (recorded_viewport_ != old_recorded_viewport) {
69 // Invalidate newly-exposed and no-longer-exposed areas. 70 // Invalidate newly-exposed and no-longer-exposed areas.
70 Region newly_exposed_region(recorded_viewport_); 71 Region newly_exposed_region(recorded_viewport_);
71 newly_exposed_region.Subtract(old_recorded_viewport); 72 newly_exposed_region.Subtract(old_recorded_viewport);
72 invalidation->Union(newly_exposed_region); 73 invalidation->Union(newly_exposed_region);
73 74
74 Region no_longer_exposed_region(old_recorded_viewport); 75 Region no_longer_exposed_region(old_recorded_viewport);
75 no_longer_exposed_region.Subtract(recorded_viewport_); 76 no_longer_exposed_region.Subtract(recorded_viewport_);
76 invalidation->Union(no_longer_exposed_region); 77 invalidation->Union(no_longer_exposed_region);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 129
129 void DisplayListRecordingSource::SetEmptyBounds() { 130 void DisplayListRecordingSource::SetEmptyBounds() {
130 size_ = gfx::Size(); 131 size_ = gfx::Size();
131 Clear(); 132 Clear();
132 } 133 }
133 134
134 void DisplayListRecordingSource::SetSlowdownRasterScaleFactor(int factor) { 135 void DisplayListRecordingSource::SetSlowdownRasterScaleFactor(int factor) {
135 slow_down_raster_scale_factor_for_debug_ = factor; 136 slow_down_raster_scale_factor_for_debug_ = factor;
136 } 137 }
137 138
139 void DisplayListRecordingSource::SetBackgroundColor(SkColor background_color) {
140 background_color_ = background_color;
141 }
142
143 void DisplayListRecordingSource::SetRequiresClear(bool requires_clear) {
144 requires_clear_ = requires_clear;
145 }
146
138 void DisplayListRecordingSource::SetUnsuitableForGpuRasterizationForTesting() { 147 void DisplayListRecordingSource::SetUnsuitableForGpuRasterizationForTesting() {
139 is_suitable_for_gpu_rasterization_ = false; 148 is_suitable_for_gpu_rasterization_ = false;
140 } 149 }
141 150
142 bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const { 151 bool DisplayListRecordingSource::IsSuitableForGpuRasterization() const {
143 return is_suitable_for_gpu_rasterization_; 152 return is_suitable_for_gpu_rasterization_;
144 } 153 }
145 154
146 scoped_refptr<RasterSource> DisplayListRecordingSource::CreateRasterSource() 155 scoped_refptr<RasterSource> DisplayListRecordingSource::CreateRasterSource()
147 const { 156 const {
(...skipping 19 matching lines...) Expand all
167 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); 176 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_);
168 } 177 }
169 178
170 void DisplayListRecordingSource::Clear() { 179 void DisplayListRecordingSource::Clear() {
171 recorded_viewport_ = gfx::Rect(); 180 recorded_viewport_ = gfx::Rect();
172 display_list_ = NULL; 181 display_list_ = NULL;
173 is_solid_color_ = false; 182 is_solid_color_ = false;
174 } 183 }
175 184
176 } // 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