Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 kKTX_Format, | 39 kKTX_Format, |
| 40 | 40 |
| 41 kLastKnownFormat = kKTX_Format, | 41 kLastKnownFormat = kKTX_Format, |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 /** Return the format of image this decoder can decode. If this decoder can decode multiple | 44 /** Return the format of image this decoder can decode. If this decoder can decode multiple |
| 45 formats, kUnknown_Format will be returned. | 45 formats, kUnknown_Format will be returned. |
| 46 */ | 46 */ |
| 47 virtual Format getFormat() const; | 47 virtual Format getFormat() const; |
| 48 | 48 |
| 49 | |
| 50 /** Returns the sizes of each component of the image | |
| 51 */ | |
| 52 virtual bool getComponentSizes(SkStream* stream, SkISize sizes[3]) { | |
| 53 return this->onGetComponentSizes(stream, sizes); | |
| 54 } | |
| 55 | |
| 56 /* Assigns buffers for YUV decoding | |
| 57 */ | |
| 58 void setYUVBuffers(void* yuv[3], size_t rowBytes[3]) { | |
| 59 this->onSetYUVBuffers(yuv, rowBytes); | |
| 60 } | |
| 61 | |
| 49 /** Return the format of the SkStreamRewindable or kUnknown_Format if it can not be determined. | 62 /** Return the format of the SkStreamRewindable or kUnknown_Format if it can not be determined. |
| 50 Rewinds the stream before returning. | 63 Rewinds the stream before returning. |
| 51 */ | 64 */ |
| 52 static Format GetStreamFormat(SkStreamRewindable*); | 65 static Format GetStreamFormat(SkStreamRewindable*); |
| 53 | 66 |
| 54 /** Return a readable string of the Format provided. | 67 /** Return a readable string of the Format provided. |
| 55 */ | 68 */ |
| 56 static const char* GetFormatName(Format); | 69 static const char* GetFormatName(Format); |
| 57 | 70 |
| 58 /** Return a readable string of the value returned by getFormat(). | 71 /** Return a readable string of the value returned by getFormat(). |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 377 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height) { | 390 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height) { |
| 378 return false; | 391 return false; |
| 379 } | 392 } |
| 380 | 393 |
| 381 // If the decoder wants to support tiled based decoding, | 394 // If the decoder wants to support tiled based decoding, |
| 382 // this method must be overridden. This guy is called by decodeRegion(...) | 395 // this method must be overridden. This guy is called by decodeRegion(...) |
| 383 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { | 396 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) { |
| 384 return false; | 397 return false; |
| 385 } | 398 } |
| 386 | 399 |
| 400 /* If the decoder wants to support YUV based decoding, this method must be o verridden. | |
| 401 */ | |
| 402 virtual void onSetYUVBuffers(void* yuv[3], size_t rowBytes[3]) {} | |
|
scroggo
2014/07/25 20:48:34
Why not create a new entry point? Right now the cl
| |
| 403 | |
| 404 /** Returns the sizes of each component of the image | |
| 405 */ | |
| 406 virtual bool onGetComponentSizes(SkStream*, SkISize sizes[3]) { | |
| 407 return false; | |
| 408 } | |
| 409 | |
| 387 /* | 410 /* |
| 388 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are | 411 * Crop a rectangle from the src Bitmap to the dest Bitmap. src and dst are |
| 389 * both sampled by sampleSize from an original Bitmap. | 412 * both sampled by sampleSize from an original Bitmap. |
| 390 * | 413 * |
| 391 * @param dst the destination bitmap. | 414 * @param dst the destination bitmap. |
| 392 * @param src the source bitmap that is sampled by sampleSize from the | 415 * @param src the source bitmap that is sampled by sampleSize from the |
| 393 * original bitmap. | 416 * original bitmap. |
| 394 * @param sampleSize the sample size that src is sampled from the original b itmap. | 417 * @param sampleSize the sample size that src is sampled from the original b itmap. |
| 395 * @param (dstX, dstY) the upper-left point of the dest bitmap in terms of | 418 * @param (dstX, dstY) the upper-left point of the dest bitmap in terms of |
| 396 * the coordinate in the original bitmap. | 419 * the coordinate in the original bitmap. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 548 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
| 526 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 549 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
| 527 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 550 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
| 528 | 551 |
| 529 // Typedefs to make registering decoder and formatter callbacks easier. | 552 // Typedefs to make registering decoder and formatter callbacks easier. |
| 530 // These have to be defined outside SkImageDecoder. :( | 553 // These have to be defined outside SkImageDecoder. :( |
| 531 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; | 554 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; |
| 532 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; | 555 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; |
| 533 | 556 |
| 534 #endif | 557 #endif |
| OLD | NEW |