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

Unified Diff: cc/picture.cc

Issue 11412255: cc: Use skia::RefPtr in place of raw pointers and SkAutoTUnref. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ref() Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture.h ('k') | cc/render_pass.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture.cc
diff --git a/cc/picture.cc b/cc/picture.cc
index 50eefd867096b0a492e579052da5dbc14028d5b2..b7445e62f68774b9e29914608a870beba504a76b 100644
--- a/cc/picture.cc
+++ b/cc/picture.cc
@@ -18,7 +18,8 @@ scoped_refptr<Picture> Picture::Create() {
Picture::Picture() {
}
-Picture::Picture(SkPicture* picture, gfx::Rect layer_rect,
+Picture::Picture(const skia::RefPtr<SkPicture>& picture,
+ gfx::Rect layer_rect,
gfx::Rect opaque_rect) :
layer_rect_(layer_rect),
opaque_rect_(opaque_rect),
@@ -31,8 +32,8 @@ Picture::~Picture() {
scoped_refptr<Picture> Picture::Clone() {
// SkPicture is not thread-safe to rasterize with, so return a thread-safe
// clone of it.
- DCHECK(picture_.get());
- SkPicture* clone = picture_->clone();
+ DCHECK(picture_);
+ skia::RefPtr<SkPicture> clone = skia::AdoptRef(picture_->clone());
return make_scoped_refptr(new Picture(clone, layer_rect_, opaque_rect_));
}
@@ -41,8 +42,8 @@ void Picture::Record(ContentLayerClient* painter, gfx::Rect layer_rect,
TRACE_EVENT0("cc", "Picture::Record");
// Record() should only be called once.
- DCHECK(!picture_.get());
- picture_.reset(new SkPicture);
+ DCHECK(!picture_);
+ picture_ = skia::AdoptRef(new SkPicture);
SkCanvas* canvas = picture_->beginRecording(
layer_rect.width(),
@@ -80,7 +81,7 @@ void Picture::Record(ContentLayerClient* painter, gfx::Rect layer_rect,
void Picture::Raster(SkCanvas* canvas) {
TRACE_EVENT0("cc", "Picture::Raster");
- DCHECK(picture_.get());
+ DCHECK(picture_);
canvas->save();
canvas->translate(layer_rect_.x(), layer_rect_.y());
canvas->drawPicture(*picture_);
« no previous file with comments | « cc/picture.h ('k') | cc/render_pass.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698