Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/raster_source.h" | 5 #include "cc/playback/raster_source.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 return 0; | 217 return 0; |
| 218 return display_list_->ApproximateMemoryUsage() + | 218 return display_list_->ApproximateMemoryUsage() + |
| 219 painter_reported_memory_usage_; | 219 painter_reported_memory_usage_; |
| 220 } | 220 } |
| 221 | 221 |
| 222 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, | 222 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, |
| 223 float contents_scale, | 223 float contents_scale, |
| 224 SkColor* color) const { | 224 SkColor* color) const { |
| 225 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); | 225 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); |
| 226 | 226 |
| 227 if (!display_list_->ShouldBeAnalyzedForSolidColor()) | |
|
vmpstr
2016/10/18 23:31:33
That's not quite correct, since the given content_
Xianzhu
2016/10/19 01:27:53
For my test, this does avoid big cost when analyzi
| |
| 228 return false; | |
| 229 | |
| 227 gfx::Rect layer_rect = | 230 gfx::Rect layer_rect = |
| 228 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); | 231 gfx::ScaleToEnclosingRect(content_rect, 1.0f / contents_scale); |
| 229 | 232 |
| 230 layer_rect.Intersect(gfx::Rect(size_)); | 233 layer_rect.Intersect(gfx::Rect(size_)); |
| 231 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); | 234 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); |
| 232 canvas.translate(-layer_rect.x(), -layer_rect.y()); | 235 canvas.translate(-layer_rect.x(), -layer_rect.y()); |
| 233 RasterCommon(&canvas, &canvas); | 236 RasterCommon(&canvas, &canvas); |
| 234 return canvas.GetColorIfSolid(color); | 237 return canvas.GetColorIfSolid(color); |
| 235 } | 238 } |
| 236 | 239 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 bool can_use_lcd_text = false; | 300 bool can_use_lcd_text = false; |
| 298 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); | 301 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); |
| 299 } | 302 } |
| 300 | 303 |
| 301 RasterSource::PlaybackSettings::PlaybackSettings() | 304 RasterSource::PlaybackSettings::PlaybackSettings() |
| 302 : playback_to_shared_canvas(false), | 305 : playback_to_shared_canvas(false), |
| 303 skip_images(false), | 306 skip_images(false), |
| 304 use_image_hijack_canvas(true) {} | 307 use_image_hijack_canvas(true) {} |
| 305 | 308 |
| 306 } // namespace cc | 309 } // namespace cc |
| OLD | NEW |