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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 paint.setColor(DebugColors::MissingPictureFillColor()); | 326 paint.setColor(DebugColors::MissingPictureFillColor()); |
327 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 327 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
328 canvas->drawPaint(paint); | 328 canvas->drawPaint(paint); |
329 #endif // NDEBUG | 329 #endif // NDEBUG |
330 } | 330 } |
331 | 331 |
332 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { | 332 skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() { |
333 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); | 333 TRACE_EVENT0("cc", "PicturePileImpl::GetFlattenedPicture"); |
334 | 334 |
335 gfx::Rect layer_rect(tiling_.total_size()); | 335 gfx::Rect layer_rect(tiling_.total_size()); |
336 skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture); | 336 SkPictureRecorder recorder; |
337 if (layer_rect.IsEmpty()) | 337 SkCanvas* canvas = |
338 return picture; | 338 recorder.beginRecording(layer_rect.width(), |
339 | 339 layer_rect.height(), |
340 SkCanvas* canvas = picture->beginRecording( | 340 SkPicture::kUsePathBoundsForClip_RecordingFlag); |
341 layer_rect.width(), | 341 if (!layer_rect.IsEmpty()) |
342 layer_rect.height(), | 342 RasterToBitmap(canvas, layer_rect, 1.0, NULL); |
343 SkPicture::kUsePathBoundsForClip_RecordingFlag); | 343 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); |
344 | |
345 RasterToBitmap(canvas, layer_rect, 1.0, NULL); | |
346 picture->endRecording(); | |
347 | |
348 return picture; | 344 return picture; |
349 } | 345 } |
350 | 346 |
351 void PicturePileImpl::AnalyzeInRect( | 347 void PicturePileImpl::AnalyzeInRect( |
352 const gfx::Rect& content_rect, | 348 const gfx::Rect& content_rect, |
353 float contents_scale, | 349 float contents_scale, |
354 PicturePileImpl::Analysis* analysis) { | 350 PicturePileImpl::Analysis* analysis) { |
355 AnalyzeInRect(content_rect, contents_scale, analysis, NULL); | 351 AnalyzeInRect(content_rect, contents_scale, analysis, NULL); |
356 } | 352 } |
357 | 353 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 ++it) { | 439 ++it) { |
444 Picture* picture = it->second.GetPicture(); | 440 Picture* picture = it->second.GetPicture(); |
445 if (picture && (processed_pictures.count(picture) == 0)) { | 441 if (picture && (processed_pictures.count(picture) == 0)) { |
446 picture->EmitTraceSnapshot(); | 442 picture->EmitTraceSnapshot(); |
447 processed_pictures.insert(picture); | 443 processed_pictures.insert(picture); |
448 } | 444 } |
449 } | 445 } |
450 } | 446 } |
451 | 447 |
452 } // namespace cc | 448 } // namespace cc |
OLD | NEW |