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

Side by Side Diff: src/image/SkSurface_Picture.cpp

Issue 214953003: split SkPictureRecorder out of SkPicture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: added guard 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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImagePriv.h" 10 #include "SkImagePriv.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 SkSurface_Picture::~SkSurface_Picture() { 41 SkSurface_Picture::~SkSurface_Picture() {
42 SkSafeUnref(fPicture); 42 SkSafeUnref(fPicture);
43 } 43 }
44 44
45 SkCanvas* SkSurface_Picture::onNewCanvas() { 45 SkCanvas* SkSurface_Picture::onNewCanvas() {
46 if (!fPicture) { 46 if (!fPicture) {
47 fPicture = SkNEW(SkPicture); 47 fPicture = SkNEW(SkPicture);
48 } 48 }
49 // TODO: remove eventually
49 SkCanvas* canvas = fPicture->beginRecording(this->width(), this->height()); 50 SkCanvas* canvas = fPicture->beginRecording(this->width(), this->height());
50 canvas->ref(); // our caller will call unref() 51 canvas->ref(); // our caller will call unref()
51 return canvas; 52 return canvas;
52 } 53 }
53 54
54 SkSurface* SkSurface_Picture::onNewSurface(const SkImageInfo& info) { 55 SkSurface* SkSurface_Picture::onNewSurface(const SkImageInfo& info) {
55 return SkSurface::NewPicture(info.fWidth, info.fHeight); 56 return SkSurface::NewPicture(info.fWidth, info.fHeight);
56 } 57 }
57 58
58 SkImage* SkSurface_Picture::onNewImageSnapshot() { 59 SkImage* SkSurface_Picture::onNewImageSnapshot() {
(...skipping 24 matching lines...) Expand all
83 /////////////////////////////////////////////////////////////////////////////// 84 ///////////////////////////////////////////////////////////////////////////////
84 85
85 86
86 SkSurface* SkSurface::NewPicture(int width, int height) { 87 SkSurface* SkSurface::NewPicture(int width, int height) {
87 if ((width | height) < 0) { 88 if ((width | height) < 0) {
88 return NULL; 89 return NULL;
89 } 90 }
90 91
91 return SkNEW_ARGS(SkSurface_Picture, (width, height)); 92 return SkNEW_ARGS(SkSurface_Picture, (width, height));
92 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698