Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: cc/resources/picture_pile_impl.cc

Issue 236633008: Switching Chromium to use new Skia SkPictureRecorder API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698