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

Side by Side Diff: cc/playback/display_list_raster_source.cc

Issue 1531013004: cc: Do solid color analysis before scheduling tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments updated. Created 4 years, 11 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
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/playback/display_list_raster_source.h" 5 #include "cc/playback/display_list_raster_source.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "cc/base/region.h" 8 #include "cc/base/region.h"
9 #include "cc/debug/debug_colors.h" 9 #include "cc/debug/debug_colors.h"
10 #include "cc/playback/display_item_list.h" 10 #include "cc/playback/display_item_list.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return picture; 210 return picture;
211 } 211 }
212 212
213 size_t DisplayListRasterSource::GetPictureMemoryUsage() const { 213 size_t DisplayListRasterSource::GetPictureMemoryUsage() const {
214 if (!display_list_) 214 if (!display_list_)
215 return 0; 215 return 0;
216 return display_list_->ApproximateMemoryUsage() + 216 return display_list_->ApproximateMemoryUsage() +
217 painter_reported_memory_usage_; 217 painter_reported_memory_usage_;
218 } 218 }
219 219
220 void DisplayListRasterSource::PerformSolidColorAnalysis( 220 bool DisplayListRasterSource::PerformSolidColorAnalysis(
221 const gfx::Rect& content_rect, 221 const gfx::Rect& content_rect,
222 float contents_scale, 222 float contents_scale,
223 DisplayListRasterSource::SolidColorAnalysis* analysis) const { 223 SkColor* color) const {
224 DCHECK(analysis);
225 TRACE_EVENT0("cc", "DisplayListRasterSource::PerformSolidColorAnalysis"); 224 TRACE_EVENT0("cc", "DisplayListRasterSource::PerformSolidColorAnalysis");
226 225
227 gfx::Rect layer_rect = 226 gfx::Rect layer_rect =
228 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); 227 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale);
229 228
230 layer_rect.Intersect(gfx::Rect(size_)); 229 layer_rect.Intersect(gfx::Rect(size_));
231 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); 230 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height());
232 RasterForAnalysis(&canvas, layer_rect, 1.0f); 231 RasterForAnalysis(&canvas, layer_rect, 1.0f);
233 analysis->is_solid_color = canvas.GetColorIfSolid(&analysis->solid_color); 232 return canvas.GetColorIfSolid(color);
234 } 233 }
235 234
236 void DisplayListRasterSource::GetDiscardableImagesInRect( 235 void DisplayListRasterSource::GetDiscardableImagesInRect(
237 const gfx::Rect& layer_rect, 236 const gfx::Rect& layer_rect,
238 float raster_scale, 237 float raster_scale,
239 std::vector<DrawImage>* images) const { 238 std::vector<DrawImage>* images) const {
240 DCHECK_EQ(0u, images->size()); 239 DCHECK_EQ(0u, images->size());
241 display_list_->GetDiscardableImagesInRect(layer_rect, raster_scale, images); 240 display_list_->GetDiscardableImagesInRect(layer_rect, raster_scale, images);
242 } 241 }
243 242
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 293 }
295 294
296 scoped_refptr<DisplayListRasterSource> 295 scoped_refptr<DisplayListRasterSource>
297 DisplayListRasterSource::CreateCloneWithoutLCDText() const { 296 DisplayListRasterSource::CreateCloneWithoutLCDText() const {
298 bool can_use_lcd_text = false; 297 bool can_use_lcd_text = false;
299 return scoped_refptr<DisplayListRasterSource>( 298 return scoped_refptr<DisplayListRasterSource>(
300 new DisplayListRasterSource(this, can_use_lcd_text)); 299 new DisplayListRasterSource(this, can_use_lcd_text));
301 } 300 }
302 301
303 } // namespace cc 302 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698