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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 @param format On success, if format is non-null, it is set to the format | 348 @param format On success, if format is non-null, it is set to the format |
349 of the decoded stream. On failure it is ignored. | 349 of the decoded stream. On failure it is ignored. |
350 */ | 350 */ |
351 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol
orType pref, Mode, | 351 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol
orType pref, Mode, |
352 Format* format = NULL); | 352 Format* format = NULL); |
353 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { | 353 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { |
354 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_
Mode, NULL); | 354 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_
Mode, NULL); |
355 } | 355 } |
356 | 356 |
357 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG | |
358 bool decode(SkStream* stream, SkBitmap* bitmap, SkBitmap::Config pref, Mode
mode) { | |
359 return this->decode(stream, bitmap, SkBitmapConfigToColorType(pref), mod
e); | |
360 } | |
361 bool decodeSubset(SkBitmap* bm, const SkIRect& subset, SkBitmap::Config pref
) { | |
362 return this->decodeSubset(bm, subset, SkBitmapConfigToColorType(pref)); | |
363 } | |
364 static bool DecodeFile(const char file[], SkBitmap* bitmap, SkBitmap::Config
pref, Mode mode, | |
365 Format* format = NULL) { | |
366 return DecodeFile(file, bitmap, SkBitmapConfigToColorType(pref), mode, f
ormat); | |
367 } | |
368 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap, | |
369 SkBitmap::Config pref, Mode mode, Format* format =
NULL) { | |
370 return DecodeMemory(buffer, size, bitmap, SkBitmapConfigToColorType(pref
), mode, format); | |
371 } | |
372 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkBit
map::Config pref, | |
373 Mode mode, Format* format = NULL) { | |
374 return DecodeStream(stream, bitmap, SkBitmapConfigToColorType(pref), mod
e, format); | |
375 } | |
376 #endif | |
377 | |
378 protected: | 357 protected: |
379 // must be overridden in subclasses. This guy is called by decode(...) | 358 // must be overridden in subclasses. This guy is called by decode(...) |
380 virtual bool onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; | 359 virtual bool onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; |
381 | 360 |
382 // If the decoder wants to support tiled based decoding, | 361 // If the decoder wants to support tiled based decoding, |
383 // this method must be overridden. This guy is called by buildTileIndex(...) | 362 // this method must be overridden. This guy is called by buildTileIndex(...) |
384 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ | 363 virtual bool onBuildTileIndex(SkStreamRewindable*, int *width, int *height)
{ |
385 return false; | 364 return false; |
386 } | 365 } |
387 | 366 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 510 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
532 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 511 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
533 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 512 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
534 | 513 |
535 // Typedefs to make registering decoder and formatter callbacks easier. | 514 // Typedefs to make registering decoder and formatter callbacks easier. |
536 // These have to be defined outside SkImageDecoder. :( | 515 // These have to be defined outside SkImageDecoder. :( |
537 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 516 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
538 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 517 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
539 | 518 |
540 #endif | 519 #endif |
OLD | NEW |