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

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: Update to ToT 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
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/skpicture_content_layer_updater.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/skpicture_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698