| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |