| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { | 341 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { |
| 342 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_
Mode, NULL); | 342 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_
Mode, NULL); |
| 343 } | 343 } |
| 344 | 344 |
| 345 protected: | 345 protected: |
| 346 // must be overridden in subclasses. This guy is called by decode(...) | 346 // must be overridden in subclasses. This guy is called by decode(...) |
| 347 virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; | 347 virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; |
| 348 | 348 |
| 349 // If the decoder wants to support tiled based decoding, | 349 // If the decoder wants to support tiled based decoding, |
| 350 // this method must be overridden. This guy is called by buildTileIndex(...) | 350 // this method must be overridden. This guy is called by buildTileIndex(...) |
| 351 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ | 351 virtual bool onBuildTileIndex(SkStreamRewindable*, int* /*width*/, int* /*he
ight*/) { |
| 352 return false; | 352 return false; |
| 353 } | 353 } |
| 354 | 354 |
| 355 // If the decoder wants to support tiled based decoding, | 355 // If the decoder wants to support tiled based decoding, |
| 356 // this method must be overridden. This guy is called by decodeRegion(...) | 356 // this method must be overridden. This guy is called by decodeRegion(...) |
| 357 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { | 357 virtual bool onDecodeSubset(SkBitmap*, const SkIRect&) { |
| 358 return false; | 358 return false; |
| 359 } | 359 } |
| 360 | 360 |
| 361 /** If planes or rowBytes is NULL, decodes the header and computes component
Sizes | 361 /** If planes or rowBytes is NULL, decodes the header and computes component
Sizes |
| 362 for memory allocation. | 362 for memory allocation. |
| 363 Otherwise, decodes the YUV planes into the provided image planes and | 363 Otherwise, decodes the YUV planes into the provided image planes and |
| 364 updates componentSizes to the final image size. | 364 updates componentSizes to the final image size. |
| 365 Returns whether the decoding was successful. | 365 Returns whether the decoding was successful. |
| 366 */ | 366 */ |
| 367 virtual bool onDecodeYUV8Planes(SkStream* stream, SkISize componentSizes[3],
void* planes[3], | 367 virtual bool onDecodeYUV8Planes(SkStream*, SkISize[3] /*componentSizes*/, |
| 368 size_t rowBytes[3], SkYUVColorSpace*) { | 368 void*[3] /*planes*/, size_t[3] /*rowBytes*/, |
| 369 SkYUVColorSpace*) { |
| 369 return false; | 370 return false; |
| 370 } | 371 } |
| 371 | 372 |
| 372 /* | 373 /* |
| 373 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are | 374 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are |
| 374 * both sampled by sampleSize from an original Bitmap. | 375 * both sampled by sampleSize from an original Bitmap. |
| 375 * | 376 * |
| 376 * @param dst the destination bitmap. | 377 * @param dst the destination bitmap. |
| 377 * @param src the source bitmap that is sampled by sampleSize from the | 378 * @param src the source bitmap that is sampled by sampleSize from the |
| 378 * original bitmap. | 379 * original bitmap. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 508 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
| 508 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 509 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
| 509 DECLARE_DECODER_CREATOR(ASTCImageDecoder); | 510 DECLARE_DECODER_CREATOR(ASTCImageDecoder); |
| 510 | 511 |
| 511 // Typedefs to make registering decoder and formatter callbacks easier. | 512 // Typedefs to make registering decoder and formatter callbacks easier. |
| 512 // These have to be defined outside SkImageDecoder. :( | 513 // These have to be defined outside SkImageDecoder. :( |
| 513 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 514 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
| 514 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 515 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
| 515 | 516 |
| 516 #endif | 517 #endif |
| OLD | NEW |