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