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

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

Issue 12567025: Integrating SkSurface with SkDeferredCanvas (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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"
11 #include "SkPicture.h" 11 #include "SkPicture.h"
12 12
13 /** 13 /**
14 * What does it mean to ask for more than one canvas from a picture? 14 * What does it mean to ask for more than one canvas from a picture?
15 * How do we return an Image and then "continue" recording? 15 * How do we return an Image and then "continue" recording?
16 */ 16 */
17 class SkSurface_Picture : public SkSurface_Base { 17 class SkSurface_Picture : public SkSurface_Base {
18 public: 18 public:
19 SkSurface_Picture(int width, int height); 19 SkSurface_Picture(int width, int height);
20 virtual ~SkSurface_Picture(); 20 virtual ~SkSurface_Picture();
21 21
22 virtual SkCanvas* onNewCanvas() SK_OVERRIDE; 22 virtual SkCanvas* onNewCanvas() SK_OVERRIDE;
23 virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE; 23 virtual SkSurface* onNewSurface(const SkImage::Info&) SK_OVERRIDE;
24 virtual SkImage* onNewImageShapshot() SK_OVERRIDE; 24 virtual SkImage* onNewImageShapshot() SK_OVERRIDE;
25 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, 25 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y,
26 const SkPaint*) SK_OVERRIDE; 26 const SkPaint*) SK_OVERRIDE;
27 virtual void onCopyOnWrite(SkImage*, SkCanvas*) SK_OVERRIDE; 27 virtual void onCopyOnWrite(SkImage*, SkCanvas*, bool overwrite) SK_OVERRIDE;
28 28
29 private: 29 private:
30 SkPicture* fPicture; 30 SkPicture* fPicture;
31 SkPicture* fRecordingPicture; 31 SkPicture* fRecordingPicture;
32 32
33 typedef SkSurface_Base INHERITED; 33 typedef SkSurface_Base INHERITED;
34 }; 34 };
35 35
36 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
37 37
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 void SkSurface_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, 71 void SkSurface_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
72 const SkPaint* paint) { 72 const SkPaint* paint) {
73 if (!fPicture) { 73 if (!fPicture) {
74 return; 74 return;
75 } 75 }
76 SkImagePrivDrawPicture(canvas, fPicture, x, y, paint); 76 SkImagePrivDrawPicture(canvas, fPicture, x, y, paint);
77 } 77 }
78 78
79 void SkSurface_Picture::onCopyOnWrite(SkImage* cachedImage, SkCanvas*) { 79 void SkSurface_Picture::onCopyOnWrite(SkImage* cachedImage, SkCanvas*, bool) {
80 // We always spawn a copy of the recording picture when we 80 // We always spawn a copy of the recording picture when we
81 // are asked for a snapshot, so we never need to do anything here. 81 // are asked for a snapshot, so we never need to do anything here.
82 } 82 }
83 83
84 /////////////////////////////////////////////////////////////////////////////// 84 ///////////////////////////////////////////////////////////////////////////////
85 85
86 86
87 SkSurface* SkSurface::NewPicture(int width, int height) { 87 SkSurface* SkSurface::NewPicture(int width, int height) {
88 if ((width | height) < 0) { 88 if ((width | height) < 0) {
89 return NULL; 89 return NULL;
90 } 90 }
91 91
92 return SkNEW_ARGS(SkSurface_Picture, (width, height)); 92 return SkNEW_ARGS(SkSurface_Picture, (width, height));
93 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698