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

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

Issue 13195002: Unit test improvements to fully validate the SkImage contract (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | « src/image/SkImagePriv.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "SkImage_Base.h" 8 #include "SkImage_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
11 11
12 class SkImage_Picture : public SkImage_Base { 12 class SkImage_Picture : public SkImage_Base {
13 public: 13 public:
14 SkImage_Picture(SkPicture*); 14 SkImage_Picture(SkPicture*);
15 virtual ~SkImage_Picture(); 15 virtual ~SkImage_Picture();
16 16
17 virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRI DE; 17 virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) SK_OVERRI DE;
18 18
19 SkPicture* getPicture() { return fPicture; }
20
19 private: 21 private:
20 SkPicture* fPicture; 22 SkPicture* fPicture;
21 23
22 typedef SkImage_Base INHERITED; 24 typedef SkImage_Base INHERITED;
23 }; 25 };
24 26
25 /////////////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////////
26 28
27 SkImage_Picture::SkImage_Picture(SkPicture* pict) : INHERITED(pict->width(), pic t->height()) { 29 SkImage_Picture::SkImage_Picture(SkPicture* pict) : INHERITED(pict->width(), pic t->height()) {
28 pict->endRecording(); 30 pict->endRecording();
(...skipping 16 matching lines...) Expand all
45 * its ability to continue recording (if needed). 47 * its ability to continue recording (if needed).
46 * 48 *
47 * Optimally this will shared as much data/buffers as it can with 49 * Optimally this will shared as much data/buffers as it can with
48 * srcPicture, and srcPicture will perform a copy-on-write as needed if it 50 * srcPicture, and srcPicture will perform a copy-on-write as needed if it
49 * needs to mutate them later on. 51 * needs to mutate them later on.
50 */ 52 */
51 SkAutoTUnref<SkPicture> playback(SkNEW_ARGS(SkPicture, (*srcPicture))); 53 SkAutoTUnref<SkPicture> playback(SkNEW_ARGS(SkPicture, (*srcPicture)));
52 54
53 return SkNEW_ARGS(SkImage_Picture, (playback)); 55 return SkNEW_ARGS(SkImage_Picture, (playback));
54 } 56 }
57
58 SkPicture* SkPictureImageGetPicture(SkImage* pictureImage) {
59 return static_cast<SkImage_Picture*>(pictureImage)->getPicture();
60 }
OLDNEW
« no previous file with comments | « src/image/SkImagePriv.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698