| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
| 6 #include "cc/base/region.h" | 6 #include "cc/base/region.h" |
| 7 #include "cc/debug/debug_colors.h" | 7 #include "cc/debug/debug_colors.h" |
| 8 #include "cc/debug/rendering_stats.h" | 8 #include "cc/debug/rendering_stats.h" |
| 9 #include "cc/resources/picture_pile_impl.h" | 9 #include "cc/resources/picture_pile_impl.h" |
| 10 #include "skia/ext/analysis_canvas.h" | 10 #include "skia/ext/analysis_canvas.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 void PicturePileImpl::AnalyzeInRect(const gfx::Rect& content_rect, | 222 void PicturePileImpl::AnalyzeInRect(const gfx::Rect& content_rect, |
| 223 float contents_scale, | 223 float contents_scale, |
| 224 PicturePileImpl::Analysis* analysis) { | 224 PicturePileImpl::Analysis* analysis) { |
| 225 DCHECK(analysis); | 225 DCHECK(analysis); |
| 226 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); | 226 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); |
| 227 | 227 |
| 228 gfx::Rect layer_rect = gfx::ToEnclosingRect( | 228 gfx::Rect layer_rect = gfx::ToEnclosingRect( |
| 229 gfx::ScaleRect(content_rect, 1.f / contents_scale)); | 229 gfx::ScaleRect(content_rect, 1.f / contents_scale)); |
| 230 | 230 |
| 231 SkBitmap emptyBitmap; | 231 SkBitmap empty_bitmap; |
| 232 emptyBitmap.setConfig(SkBitmap::kNo_Config, content_rect.width(), | 232 empty_bitmap.setConfig(SkBitmap::kNo_Config, content_rect.width(), |
| 233 content_rect.height()); | 233 content_rect.height()); |
| 234 skia::AnalysisDevice device(emptyBitmap); | 234 skia::AnalysisDevice device(empty_bitmap); |
| 235 skia::AnalysisCanvas canvas(&device); | 235 skia::AnalysisCanvas canvas(&device); |
| 236 | 236 |
| 237 int64 total_pixels_rasterized = 0; | 237 int64 total_pixels_rasterized = 0; |
| 238 Raster(&canvas, content_rect, contents_scale, &total_pixels_rasterized); | 238 Raster(&canvas, content_rect, contents_scale, &total_pixels_rasterized); |
| 239 | 239 |
| 240 analysis->is_transparent = canvas.isTransparent(); | 240 analysis->is_transparent = canvas.isTransparent(); |
| 241 analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); | 241 analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); |
| 242 analysis->is_cheap_to_raster = canvas.isCheap(); | 242 analysis->is_cheap_to_raster = canvas.isCheap(); |
| 243 canvas.consumeLazyPixelRefs(&analysis->lazy_pixel_refs); | 243 canvas.consumeLazyPixelRefs(&analysis->lazy_pixel_refs); |
| 244 } | 244 } |
| 245 | 245 |
| 246 PicturePileImpl::Analysis::Analysis() : | 246 PicturePileImpl::Analysis::Analysis() : |
| 247 is_solid_color(false), | 247 is_solid_color(false), |
| 248 is_transparent(false), | 248 is_transparent(false), |
| 249 is_cheap_to_raster(false) { | 249 is_cheap_to_raster(false) { |
| 250 } | 250 } |
| 251 | 251 |
| 252 PicturePileImpl::Analysis::~Analysis() { | 252 PicturePileImpl::Analysis::~Analysis() { |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace cc | 255 } // namespace cc |
| OLD | NEW |