OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkImageDecoder_DEFINED | 8 #ifndef SkImageDecoder_DEFINED |
9 #define SkImageDecoder_DEFINED | 9 #define SkImageDecoder_DEFINED |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 kASTC_Format, | 40 kASTC_Format, |
41 | 41 |
42 kLastKnownFormat = kKTX_Format, | 42 kLastKnownFormat = kKTX_Format, |
43 }; | 43 }; |
44 | 44 |
45 /** Return the format of image this decoder can decode. If this decoder can
decode multiple | 45 /** Return the format of image this decoder can decode. If this decoder can
decode multiple |
46 formats, kUnknown_Format will be returned. | 46 formats, kUnknown_Format will be returned. |
47 */ | 47 */ |
48 virtual Format getFormat() const; | 48 virtual Format getFormat() const; |
49 | 49 |
| 50 /** If planes or rowBytes is NULL, decodes the header and computes component
Sizes |
| 51 for memory allocation. |
| 52 Otherwise, decodes the YUV planes into the provided image planes and |
| 53 updates componentSizes to the final image size. |
| 54 Returns whether the decoding was successful. |
| 55 */ |
| 56 bool decodeYUV8Planes(SkStream* stream, SkISize componentSizes[3], void* pla
nes[3], |
| 57 size_t rowBytes[3], SkYUVColorSpace*); |
| 58 |
50 /** Return the format of the SkStreamRewindable or kUnknown_Format if it can
not be determined. | 59 /** Return the format of the SkStreamRewindable or kUnknown_Format if it can
not be determined. |
51 Rewinds the stream before returning. | 60 Rewinds the stream before returning. |
52 */ | 61 */ |
53 static Format GetStreamFormat(SkStreamRewindable*); | 62 static Format GetStreamFormat(SkStreamRewindable*); |
54 | 63 |
55 /** Return a readable string of the Format provided. | 64 /** Return a readable string of the Format provided. |
56 */ | 65 */ |
57 static const char* GetFormatName(Format); | 66 static const char* GetFormatName(Format); |
58 | 67 |
59 /** Return a readable string of the value returned by getFormat(). | 68 /** Return a readable string of the value returned by getFormat(). |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ | 341 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ |
333 return false; | 342 return false; |
334 } | 343 } |
335 | 344 |
336 // If the decoder wants to support tiled based decoding, | 345 // If the decoder wants to support tiled based decoding, |
337 // this method must be overridden. This guy is called by decodeRegion(...) | 346 // this method must be overridden. This guy is called by decodeRegion(...) |
338 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { | 347 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { |
339 return false; | 348 return false; |
340 } | 349 } |
341 | 350 |
| 351 /** If planes or rowBytes is NULL, decodes the header and computes component
Sizes |
| 352 for memory allocation. |
| 353 Otherwise, decodes the YUV planes into the provided image planes and |
| 354 updates componentSizes to the final image size. |
| 355 Returns whether the decoding was successful. |
| 356 */ |
| 357 virtual bool onDecodeYUV8Planes(SkStream* stream, SkISize componentSizes[3],
void* planes[3], |
| 358 size_t rowBytes[3], SkYUVColorSpace*) { |
| 359 return false; |
| 360 } |
| 361 |
342 /* | 362 /* |
343 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are | 363 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are |
344 * both sampled by sampleSize from an original Bitmap. | 364 * both sampled by sampleSize from an original Bitmap. |
345 * | 365 * |
346 * @param dst the destination bitmap. | 366 * @param dst the destination bitmap. |
347 * @param src the source bitmap that is sampled by sampleSize from the | 367 * @param src the source bitmap that is sampled by sampleSize from the |
348 * original bitmap. | 368 * original bitmap. |
349 * @param sampleSize the sample size that src is sampled from the original b
itmap. | 369 * @param sampleSize the sample size that src is sampled from the original b
itmap. |
350 * @param (dstX, dstY) the upper-left point of the dest bitmap in terms of | 370 * @param (dstX, dstY) the upper-left point of the dest bitmap in terms of |
351 * the coordinate in the original bitmap. | 371 * the coordinate in the original bitmap. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 497 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
478 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 498 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
479 DECLARE_DECODER_CREATOR(ASTCImageDecoder); | 499 DECLARE_DECODER_CREATOR(ASTCImageDecoder); |
480 | 500 |
481 // Typedefs to make registering decoder and formatter callbacks easier. | 501 // Typedefs to make registering decoder and formatter callbacks easier. |
482 // These have to be defined outside SkImageDecoder. :( | 502 // These have to be defined outside SkImageDecoder. :( |
483 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 503 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
484 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 504 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
485 | 505 |
486 #endif | 506 #endif |
OLD | NEW |