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 <algorithm> | 5 #include <algorithm> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/base/region.h" | 9 #include "cc/base/region.h" |
10 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 239 |
240 return picture; | 240 return picture; |
241 } | 241 } |
242 | 242 |
243 void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect, | 243 void PicturePileImpl::AnalyzeInRect(gfx::Rect content_rect, |
244 float contents_scale, | 244 float contents_scale, |
245 PicturePileImpl::Analysis* analysis) { | 245 PicturePileImpl::Analysis* analysis) { |
246 DCHECK(analysis); | 246 DCHECK(analysis); |
247 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); | 247 TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect"); |
248 | 248 |
249 content_rect.Intersect(gfx::Rect(gfx::ToCeiledSize( | 249 gfx::Rect layer_rect = gfx::ToEnclosingRect( |
enne (OOO)
2013/05/13 17:48:52
layer_rect is tiling_.total_size(). No need for s
| |
250 gfx::ScaleSize(tiling_.total_size(), contents_scale)))); | 250 gfx::ScaleRect(content_rect, 1.0f / contents_scale)); |
251 | |
252 layer_rect.Intersect(gfx::Rect(tiling_.total_size())); | |
251 | 253 |
252 SkBitmap empty_bitmap; | 254 SkBitmap empty_bitmap; |
253 empty_bitmap.setConfig(SkBitmap::kNo_Config, | 255 empty_bitmap.setConfig(SkBitmap::kNo_Config, |
254 content_rect.width(), | 256 layer_rect.width(), |
255 content_rect.height()); | 257 layer_rect.height()); |
256 skia::AnalysisDevice device(empty_bitmap); | 258 skia::AnalysisDevice device(empty_bitmap); |
257 skia::AnalysisCanvas canvas(&device); | 259 skia::AnalysisCanvas canvas(&device); |
258 | 260 |
259 Raster(&canvas, content_rect, contents_scale, NULL); | 261 Raster(&canvas, layer_rect, 1.0f, NULL); |
260 | 262 |
261 analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); | 263 analysis->is_solid_color = canvas.getColorIfSolid(&analysis->solid_color); |
262 analysis->has_text = canvas.hasText(); | 264 analysis->has_text = canvas.hasText(); |
263 } | 265 } |
264 | 266 |
265 PicturePileImpl::Analysis::Analysis() | 267 PicturePileImpl::Analysis::Analysis() |
266 : is_solid_color(false), | 268 : is_solid_color(false), |
267 has_text(false) { | 269 has_text(false) { |
268 } | 270 } |
269 | 271 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 layer_rect_, | 327 layer_rect_, |
326 *picture_list_iterator_); | 328 *picture_list_iterator_); |
327 if (pixel_ref_iterator_) | 329 if (pixel_ref_iterator_) |
328 return; | 330 return; |
329 } | 331 } |
330 ++tile_iterator_; | 332 ++tile_iterator_; |
331 } while (AdvanceToTileWithPictures()); | 333 } while (AdvanceToTileWithPictures()); |
332 } | 334 } |
333 | 335 |
334 } // namespace cc | 336 } // namespace cc |
OLD | NEW |