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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 return 0; | 216 return 0; |
217 return display_list_->ApproximateMemoryUsage() + | 217 return display_list_->ApproximateMemoryUsage() + |
218 painter_reported_memory_usage_; | 218 painter_reported_memory_usage_; |
219 } | 219 } |
220 | 220 |
221 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, | 221 bool RasterSource::PerformSolidColorAnalysis(const gfx::Rect& content_rect, |
222 float raster_scale, | 222 float raster_scale, |
223 SkColor* color) const { | 223 SkColor* color) const { |
224 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); | 224 TRACE_EVENT0("cc", "RasterSource::PerformSolidColorAnalysis"); |
225 | 225 |
226 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( | 226 gfx::Rect layer_rect = |
227 content_rect, 1.f / raster_scale); | 227 gfx::ScaleToEnclosingRect(content_rect, 1.f / raster_scale); |
228 | 228 |
229 layer_rect.Intersect(gfx::Rect(size_)); | 229 layer_rect.Intersect(gfx::Rect(size_)); |
230 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); | 230 skia::AnalysisCanvas canvas(layer_rect.width(), layer_rect.height()); |
231 canvas.translate(-layer_rect.x(), -layer_rect.y()); | 231 canvas.translate(-layer_rect.x(), -layer_rect.y()); |
232 RasterCommon(&canvas, &canvas); | 232 RasterCommon(&canvas, &canvas); |
233 return canvas.GetColorIfSolid(color); | 233 return canvas.GetColorIfSolid(color); |
234 } | 234 } |
235 | 235 |
236 void RasterSource::GetDiscardableImagesInRect( | 236 void RasterSource::GetDiscardableImagesInRect( |
237 const gfx::Rect& layer_rect, | 237 const gfx::Rect& layer_rect, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 bool can_use_lcd_text = false; | 304 bool can_use_lcd_text = false; |
305 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); | 305 return scoped_refptr<RasterSource>(new RasterSource(this, can_use_lcd_text)); |
306 } | 306 } |
307 | 307 |
308 RasterSource::PlaybackSettings::PlaybackSettings() | 308 RasterSource::PlaybackSettings::PlaybackSettings() |
309 : playback_to_shared_canvas(false), | 309 : playback_to_shared_canvas(false), |
310 skip_images(false), | 310 skip_images(false), |
311 use_image_hijack_canvas(true) {} | 311 use_image_hijack_canvas(true) {} |
312 | 312 |
313 } // namespace cc | 313 } // namespace cc |
OLD | NEW |