OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #ifndef SkImageGenerator_DEFINED | 8 #ifndef SkImageGenerator_DEFINED |
9 #define SkImageGenerator_DEFINED | 9 #define SkImageGenerator_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 class SkData; | 15 class SkData; |
16 class SkImageGenerator; | 16 class SkImageGenerator; |
| 17 class SkMatrix; |
| 18 class SkPaint; |
| 19 class SkPicture; |
17 | 20 |
18 /** | 21 /** |
19 * Takes ownership of SkImageGenerator. If this method fails for | 22 * Takes ownership of SkImageGenerator. If this method fails for |
20 * whatever reason, it will return false and immediatetely delete | 23 * whatever reason, it will return false and immediatetely delete |
21 * the generator. If it succeeds, it will modify destination | 24 * the generator. If it succeeds, it will modify destination |
22 * bitmap. | 25 * bitmap. |
23 * | 26 * |
24 * If generator is NULL, will safely return false. | 27 * If generator is NULL, will safely return false. |
25 * | 28 * |
26 * If this fails or when the SkDiscardablePixelRef that is | 29 * If this fails or when the SkDiscardablePixelRef that is |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], | 122 bool getYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], |
120 SkYUVColorSpace* colorSpace); | 123 SkYUVColorSpace* colorSpace); |
121 | 124 |
122 /** | 125 /** |
123 * If the default image decoder system can interpret the specified (encoded
) data, then | 126 * If the default image decoder system can interpret the specified (encoded
) data, then |
124 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way | 127 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way |
125 * the caller is still responsible for managing their ownership of the data
. | 128 * the caller is still responsible for managing their ownership of the data
. |
126 */ | 129 */ |
127 static SkImageGenerator* NewFromEncoded(SkData*); | 130 static SkImageGenerator* NewFromEncoded(SkData*); |
128 | 131 |
| 132 /** Return a new image generator backed by the specified picture. If the si
ze is empty or |
| 133 * the picture is NULL, this returns NULL. |
| 134 * The optional matrix and paint arguments are passed to drawPicture() at r
asterization |
| 135 * time. |
| 136 */ |
| 137 static SkImageGenerator* NewFromPicture(const SkISize&, const SkPicture*, co
nst SkMatrix*, |
| 138 const SkPaint*); |
| 139 |
129 protected: | 140 protected: |
130 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} | 141 SkImageGenerator(const SkImageInfo& info) : fInfo(info) {} |
131 | 142 |
132 virtual SkData* onRefEncodedData(); | 143 virtual SkData* onRefEncodedData(); |
133 | 144 |
134 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, | 145 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, |
135 SkPMColor ctable[], int* ctableCount); | 146 SkPMColor ctable[], int* ctableCount); |
136 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 147 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); |
137 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 148 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
138 SkYUVColorSpace* colorSpace); | 149 SkYUVColorSpace* colorSpace); |
139 | 150 |
140 private: | 151 private: |
141 const SkImageInfo fInfo; | 152 const SkImageInfo fInfo; |
142 | 153 |
143 // This is our default impl, which may be different on different platforms. | 154 // This is our default impl, which may be different on different platforms. |
144 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. | 155 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. |
145 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. | 156 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. |
146 static SkImageGenerator* NewFromEncodedImpl(SkData*); | 157 static SkImageGenerator* NewFromEncodedImpl(SkData*); |
147 }; | 158 }; |
148 | 159 |
149 #endif // SkImageGenerator_DEFINED | 160 #endif // SkImageGenerator_DEFINED |
OLD | NEW |