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 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 * - its internal context is the same | 143 * - its internal context is the same |
144 * - it can somehow convert its texture into one that is valid for the prov
ided context. | 144 * - it can somehow convert its texture into one that is valid for the prov
ided context. |
145 * | 145 * |
146 * Regarding the GrTextureParams parameter: | 146 * Regarding the GrTextureParams parameter: |
147 * | 147 * |
148 * If the context (the provided one or the generator's intrinsic one) deter
mines that to | 148 * If the context (the provided one or the generator's intrinsic one) deter
mines that to |
149 * support the specified usage, it must return a different sized texture it
may, | 149 * support the specified usage, it must return a different sized texture it
may, |
150 * so the caller must inspect the texture's width/height and compare them t
o the generator's | 150 * so the caller must inspect the texture's width/height and compare them t
o the generator's |
151 * getInfo() width/height. For readback usage use GrTextureParams::ClampNoF
ilter() | 151 * getInfo() width/height. For readback usage use GrTextureParams::ClampNoF
ilter() |
152 */ | 152 */ |
153 GrTexture* generateTexture(GrContext*, const GrTextureParams&, const SkIRect
* subset = nullptr); | 153 GrTexture* generateTexture(GrContext*, const SkIRect* subset = nullptr); |
154 | 154 |
155 /** | 155 /** |
156 * If the default image decoder system can interpret the specified (encoded
) data, then | 156 * If the default image decoder system can interpret the specified (encoded
) data, then |
157 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way | 157 * this returns a new ImageGenerator for it. Otherwise this returns NULL. E
ither way |
158 * the caller is still responsible for managing their ownership of the data
. | 158 * the caller is still responsible for managing their ownership of the data
. |
159 */ | 159 */ |
160 static SkImageGenerator* NewFromEncoded(SkData*); | 160 static SkImageGenerator* NewFromEncoded(SkData*); |
161 | 161 |
162 /** Return a new image generator backed by the specified picture. If the si
ze is empty or | 162 /** Return a new image generator backed by the specified picture. If the si
ze is empty or |
163 * the picture is NULL, this returns NULL. | 163 * the picture is NULL, this returns NULL. |
(...skipping 24 matching lines...) Expand all Loading... |
188 SkImageGenerator(const SkImageInfo& info); | 188 SkImageGenerator(const SkImageInfo& info); |
189 | 189 |
190 virtual SkData* onRefEncodedData(); | 190 virtual SkData* onRefEncodedData(); |
191 | 191 |
192 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, | 192 virtual bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBy
tes, |
193 SkPMColor ctable[], int* ctableCount); | 193 SkPMColor ctable[], int* ctableCount); |
194 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); | 194 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3]); |
195 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], | 195 virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBy
tes[3], |
196 SkYUVColorSpace* colorSpace); | 196 SkYUVColorSpace* colorSpace); |
197 | 197 |
198 virtual GrTexture* onGenerateTexture(GrContext*, const GrTextureParams&, con
st SkIRect*) { | 198 virtual GrTexture* onGenerateTexture(GrContext*, const SkIRect*) { |
199 return nullptr; | 199 return nullptr; |
200 } | 200 } |
201 | 201 |
202 bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitm
ap::Allocator*); | 202 bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitm
ap::Allocator*); |
203 | 203 |
204 private: | 204 private: |
205 const SkImageInfo fInfo; | 205 const SkImageInfo fInfo; |
206 const uint32_t fUniqueID; | 206 const uint32_t fUniqueID; |
207 | 207 |
208 // This is our default impl, which may be different on different platforms. | 208 // This is our default impl, which may be different on different platforms. |
209 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. | 209 // It is called from NewFromEncoded() after it has checked for any runtime f
actory. |
210 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. | 210 // The SkData will never be NULL, as that will have been checked by NewFromE
ncoded. |
211 static SkImageGenerator* NewFromEncodedImpl(SkData*); | 211 static SkImageGenerator* NewFromEncodedImpl(SkData*); |
212 }; | 212 }; |
213 | 213 |
214 #endif // SkImageGenerator_DEFINED | 214 #endif // SkImageGenerator_DEFINED |
OLD | NEW |