| 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 | |
| 59 /** Return the format of the SkStreamRewindable or kUnknown_Format if it can
not be determined. | 50 /** Return the format of the SkStreamRewindable or kUnknown_Format if it can
not be determined. |
| 60 Rewinds the stream before returning. | 51 Rewinds the stream before returning. |
| 61 */ | 52 */ |
| 62 static Format GetStreamFormat(SkStreamRewindable*); | 53 static Format GetStreamFormat(SkStreamRewindable*); |
| 63 | 54 |
| 64 /** Return a readable string of the Format provided. | 55 /** Return a readable string of the Format provided. |
| 65 */ | 56 */ |
| 66 static const char* GetFormatName(Format); | 57 static const char* GetFormatName(Format); |
| 67 | 58 |
| 68 /** Return a readable string of the value returned by getFormat(). | 59 /** Return a readable string of the value returned by getFormat(). |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ | 332 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ |
| 342 return false; | 333 return false; |
| 343 } | 334 } |
| 344 | 335 |
| 345 // If the decoder wants to support tiled based decoding, | 336 // If the decoder wants to support tiled based decoding, |
| 346 // this method must be overridden. This guy is called by decodeRegion(...) | 337 // this method must be overridden. This guy is called by decodeRegion(...) |
| 347 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { | 338 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { |
| 348 return false; | 339 return false; |
| 349 } | 340 } |
| 350 | 341 |
| 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 | |
| 362 /* | 342 /* |
| 363 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are | 343 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are |
| 364 * both sampled by sampleSize from an original Bitmap. | 344 * both sampled by sampleSize from an original Bitmap. |
| 365 * | 345 * |
| 366 * @param dst the destination bitmap. | 346 * @param dst the destination bitmap. |
| 367 * @param src the source bitmap that is sampled by sampleSize from the | 347 * @param src the source bitmap that is sampled by sampleSize from the |
| 368 * original bitmap. | 348 * original bitmap. |
| 369 * @param sampleSize the sample size that src is sampled from the original b
itmap. | 349 * @param sampleSize the sample size that src is sampled from the original b
itmap. |
| 370 * @param (dstX, dstY) the upper-left point of the dest bitmap in terms of | 350 * @param (dstX, dstY) the upper-left point of the dest bitmap in terms of |
| 371 * the coordinate in the original bitmap. | 351 * the coordinate in the original bitmap. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 477 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
| 498 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 478 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
| 499 DECLARE_DECODER_CREATOR(ASTCImageDecoder); | 479 DECLARE_DECODER_CREATOR(ASTCImageDecoder); |
| 500 | 480 |
| 501 // Typedefs to make registering decoder and formatter callbacks easier. | 481 // Typedefs to make registering decoder and formatter callbacks easier. |
| 502 // These have to be defined outside SkImageDecoder. :( | 482 // These have to be defined outside SkImageDecoder. :( |
| 503 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 483 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
| 504 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 484 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
| 505 | 485 |
| 506 #endif | 486 #endif |
| OLD | NEW |