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 #ifndef SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
10 | 10 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 bool isTextureBacked() const; | 201 bool isTextureBacked() const; |
202 | 202 |
203 /** | 203 /** |
204 * Retrieves the backend API handle of the texture. If flushPendingGrContex
tIO then the | 204 * Retrieves the backend API handle of the texture. If flushPendingGrContex
tIO then the |
205 * GrContext will issue to the backend API any deferred IO operations on th
e texture before | 205 * GrContext will issue to the backend API any deferred IO operations on th
e texture before |
206 * returning. | 206 * returning. |
207 */ | 207 */ |
208 GrBackendObject getTextureHandle(bool flushPendingGrContextIO) const; | 208 GrBackendObject getTextureHandle(bool flushPendingGrContextIO) const; |
209 | 209 |
210 /** | 210 /** |
| 211 * Hints to image calls where the system might cache computed intermediates
(e.g. the results |
| 212 * of decoding or a read-back from the GPU. Passing kAllow signals that the
system's default |
| 213 * behavior is fine. Passing kDisallow signals that caching should be avoid
ed. |
| 214 */ |
| 215 enum CachingHint { |
| 216 kAllow_CachingHint, |
| 217 kDisallow_CachingHint, |
| 218 }; |
| 219 |
| 220 /** |
211 * Copy the pixels from the image into the specified buffer (pixels + rowBy
tes), | 221 * Copy the pixels from the image into the specified buffer (pixels + rowBy
tes), |
212 * converting them into the requested format (dstInfo). The image pixels ar
e read | 222 * converting them into the requested format (dstInfo). The image pixels ar
e read |
213 * starting at the specified (srcX,srcY) location. | 223 * starting at the specified (srcX,srcY) location. |
214 * | 224 * |
215 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan
gle | 225 * The specified ImageInfo and (srcX,srcY) offset specifies a source rectan
gle |
216 * | 226 * |
217 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); | 227 * srcR.setXYWH(srcX, srcY, dstInfo.width(), dstInfo.height()); |
218 * | 228 * |
219 * srcR is intersected with the bounds of the image. If this intersection i
s not empty, | 229 * srcR is intersected with the bounds of the image. If this intersection i
s not empty, |
220 * then we have two sets of pixels (of equal size). Replace the dst pixels
with the | 230 * then we have two sets of pixels (of equal size). Replace the dst pixels
with the |
221 * corresponding src pixels, performing any colortype/alphatype transformat
ions needed | 231 * corresponding src pixels, performing any colortype/alphatype transformat
ions needed |
222 * (in the case where the src and dst have different colortypes or alphatyp
es). | 232 * (in the case where the src and dst have different colortypes or alphatyp
es). |
223 * | 233 * |
224 * This call can fail, returning false, for several reasons: | 234 * This call can fail, returning false, for several reasons: |
225 * - If srcR does not intersect the image bounds. | 235 * - If srcR does not intersect the image bounds. |
226 * - If the requested colortype/alphatype cannot be converted from the imag
e's types. | 236 * - If the requested colortype/alphatype cannot be converted from the imag
e's types. |
227 */ | 237 */ |
228 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy
tes, | 238 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy
tes, |
229 int srcX, int srcY) const; | 239 int srcX, int srcY, CachingHint = kAllow_CachingHint) const; |
230 | 240 |
231 bool readPixels(const SkPixmap& dst, int srcX, int srcY) const; | 241 bool readPixels(const SkPixmap& dst, int srcX, int srcY, |
| 242 CachingHint = kAllow_CachingHint) const; |
| 243 |
| 244 /** |
| 245 * Copy the pixels from this image into the dst pixmap, converting as neede
d into dst's |
| 246 * colortype/alphatype. If the conversion cannot be performed, false is ret
urned. |
| 247 * |
| 248 * If dst's dimensions differ from the src dimension, the image will be sca
led, applying the |
| 249 * specified filter-quality. |
| 250 */ |
| 251 bool scalePixels(const SkPixmap& dst, SkFilterQuality, CachingHint = kAllow_
CachingHint) const; |
232 | 252 |
233 /** | 253 /** |
234 * Encode the image's pixels and return the result as a new SkData, which | 254 * Encode the image's pixels and return the result as a new SkData, which |
235 * the caller must manage (i.e. call unref() when they are done). | 255 * the caller must manage (i.e. call unref() when they are done). |
236 * | 256 * |
237 * If the image type cannot be encoded, or the requested encoder type is | 257 * If the image type cannot be encoded, or the requested encoder type is |
238 * not supported, this will return NULL. | 258 * not supported, this will return NULL. |
239 * | 259 * |
240 * Note: this will attempt to encode the image's pixels in the specified fo
rmat, | 260 * Note: this will attempt to encode the image's pixels in the specified fo
rmat, |
241 * even if the image returns a data from refEncoded(). That data will be ig
nored. | 261 * even if the image returns a data from refEncoded(). That data will be ig
nored. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 351 |
332 private: | 352 private: |
333 const int fWidth; | 353 const int fWidth; |
334 const int fHeight; | 354 const int fHeight; |
335 const uint32_t fUniqueID; | 355 const uint32_t fUniqueID; |
336 | 356 |
337 typedef SkRefCnt INHERITED; | 357 typedef SkRefCnt INHERITED; |
338 }; | 358 }; |
339 | 359 |
340 #endif | 360 #endif |
OLD | NEW |