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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 private: | 22 private: |
23 SkPicture* fPicture; | 23 SkPicture* fPicture; |
24 | 24 |
25 typedef SkImage_Base INHERITED; | 25 typedef SkImage_Base INHERITED; |
26 }; | 26 }; |
27 | 27 |
28 /////////////////////////////////////////////////////////////////////////////// | 28 /////////////////////////////////////////////////////////////////////////////// |
29 | 29 |
30 SkImage_Picture::SkImage_Picture(SkPicture* pict) : INHERITED(pict->width(), pic
t->height()) { | 30 SkImage_Picture::SkImage_Picture(SkPicture* pict) : INHERITED(pict->width(), pic
t->height()) { |
31 pict->endRecording(); | 31 pict->endRecording(); // TODO: remove eventually |
32 pict->ref(); | 32 pict->ref(); |
33 fPicture = pict; | 33 fPicture = pict; |
34 } | 34 } |
35 | 35 |
36 SkImage_Picture::~SkImage_Picture() { | 36 SkImage_Picture::~SkImage_Picture() { |
37 fPicture->unref(); | 37 fPicture->unref(); |
38 } | 38 } |
39 | 39 |
40 void SkImage_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, | 40 void SkImage_Picture::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, |
41 const SkPaint* paint) { | 41 const SkPaint* paint) { |
(...skipping 15 matching lines...) Expand all Loading... |
57 * needs to mutate them later on. | 57 * needs to mutate them later on. |
58 */ | 58 */ |
59 SkAutoTUnref<SkPicture> playback(SkNEW_ARGS(SkPicture, (*srcPicture))); | 59 SkAutoTUnref<SkPicture> playback(SkNEW_ARGS(SkPicture, (*srcPicture))); |
60 | 60 |
61 return SkNEW_ARGS(SkImage_Picture, (playback)); | 61 return SkNEW_ARGS(SkImage_Picture, (playback)); |
62 } | 62 } |
63 | 63 |
64 SkPicture* SkPictureImageGetPicture(SkImage* pictureImage) { | 64 SkPicture* SkPictureImageGetPicture(SkImage* pictureImage) { |
65 return static_cast<SkImage_Picture*>(pictureImage)->getPicture(); | 65 return static_cast<SkImage_Picture*>(pictureImage)->getPicture(); |
66 } | 66 } |
OLD | NEW |