Chromium Code Reviews| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 layer_rect.width(), | 235 layer_rect.width(), |
| 236 layer_rect.height(), | 236 layer_rect.height(), |
| 237 SkPicture::kUsePathBoundsForClip_RecordingFlag); | 237 SkPicture::kUsePathBoundsForClip_RecordingFlag); |
| 238 | 238 |
| 239 Raster(canvas, layer_rect, 1.0); | 239 Raster(canvas, layer_rect, 1.0); |
| 240 picture->endRecording(); | 240 picture->endRecording(); |
| 241 | 241 |
| 242 return picture; | 242 return picture; |
| 243 } | 243 } |
| 244 | 244 |
| 245 void PicturePileImpl::AnalyzeInRect(const gfx::Rect& content_rect, | 245 void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect, |
| 246 float contents_scale, | 246 float contents_scale, |
| 247 PicturePileImpl::Analysis* analysis) { | 247 PicturePileImpl::Analysis* analysis) { |
| 248 DCHECK(analysis); | 248 DCHECK(analysis); |
| 249 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); | 249 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); |
| 250 | 250 |
| 251 gfx::Rect layer_rect = gfx::ToEnclosingRect( | 251 content_rect.Intersect(gfx::Rect(gfx::ToCeiledSize( |
|
vmpstr
2013/04/17 16:41:57
This layer_rect was unused, hence the diff looks l
| |
| 252 gfx::ScaleRect(content_rect, 1.f / contents_scale)); | 252 gfx::ScaleSize(tiling_.total_size(), contents_scale)))); |
| 253 | 253 |
| 254 SkBitmap empty_bitmap; | 254 SkBitmap empty_bitmap; |
| 255 empty_bitmap.setConfig(SkBitmap::kNo_Config, content_rect.width(), | 255 empty_bitmap.setConfig(SkBitmap::kNo_Config, |
| 256 content_rect.height()); | 256 content_rect.width(), |
| 257 content_rect.height()); | |
| 257 skia::AnalysisDevice device(empty_bitmap); | 258 skia::AnalysisDevice device(empty_bitmap); |
| 258 skia::AnalysisCanvas canvas(&device); | 259 skia::AnalysisCanvas canvas(&device); |
| 259 | 260 |
| 260 Raster(&canvas, content_rect, contents_scale); | 261 Raster(&canvas, content_rect, contents_scale); |
| 261 | 262 |
| 262 analysis->is_transparent = canvas.isTransparent(); | 263 analysis->is_transparent = canvas.isTransparent(); |
| 263 analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); | 264 analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); |
| 264 analysis->is_cheap_to_raster = canvas.isCheap(); | 265 analysis->is_cheap_to_raster = canvas.isCheap(); |
| 265 analysis->has_text = canvas.hasText(); | 266 analysis->has_text = canvas.hasText(); |
| 266 canvas.consumeLazyPixelRefs(&analysis->lazy_pixel_refs); | 267 canvas.consumeLazyPixelRefs(&analysis->lazy_pixel_refs); |
| 267 } | 268 } |
| 268 | 269 |
| 269 PicturePileImpl::Analysis::Analysis() | 270 PicturePileImpl::Analysis::Analysis() |
| 270 : is_solid_color(false), | 271 : is_solid_color(false), |
| 271 is_transparent(false), | 272 is_transparent(false), |
| 272 has_text(false), | 273 has_text(false), |
| 273 is_cheap_to_raster(false) { | 274 is_cheap_to_raster(false) { |
| 274 } | 275 } |
| 275 | 276 |
| 276 PicturePileImpl::Analysis::~Analysis() { | 277 PicturePileImpl::Analysis::~Analysis() { |
| 277 } | 278 } |
| 278 | 279 |
| 279 } // namespace cc | 280 } // namespace cc |
| OLD | NEW |