| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 #ifndef SkImageDecoder_DEFINED | 8 #ifndef SkImageDecoder_DEFINED |
| 11 #define SkImageDecoder_DEFINED | 9 #define SkImageDecoder_DEFINED |
| 12 | 10 |
| 13 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 14 #include "SkImage.h" | 12 #include "SkImage.h" |
| 15 #include "SkRect.h" | 13 #include "SkRect.h" |
| 16 #include "SkRefCnt.h" | 14 #include "SkRefCnt.h" |
| 17 #include "SkTRegistry.h" | 15 #include "SkTRegistry.h" |
| 18 #include "SkTypes.h" | 16 #include "SkTypes.h" |
| 19 | 17 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 @param format On success, if format is non-null, it is set to the format | 346 @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. | 347 of the decoded stream. On failure it is ignored. |
| 350 */ | 348 */ |
| 351 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol
orType pref, Mode, | 349 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol
orType pref, Mode, |
| 352 Format* format = NULL); | 350 Format* format = NULL); |
| 353 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { | 351 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { |
| 354 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_
Mode, NULL); | 352 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_
Mode, NULL); |
| 355 } | 353 } |
| 356 | 354 |
| 357 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG | 355 #ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG |
| 358 bool decode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref, Mode mode) { | 356 bool decode(SkStream* stream, SkBitmap* bitmap, SkBitmap::Config pref, Mode
mode) { |
| 359 return this->decode(stream, bitmap, SkBitmapConfigToColorType(pref), mod
e); | 357 return this->decode(stream, bitmap, SkBitmapConfigToColorType(pref), mod
e); |
| 360 } | 358 } |
| 361 bool decodeSubset(SkBitmap* bm, const SkIRect& subset, SkBitmap::Config pref
) { | 359 bool decodeSubset(SkBitmap* bm, const SkIRect& subset, SkBitmap::Config pref
) { |
| 362 return this->decodeSubset(bm, subset, SkBitmapConfigToColorType(pref)); | 360 return this->decodeSubset(bm, subset, SkBitmapConfigToColorType(pref)); |
| 363 } | 361 } |
| 364 static bool DecodeFile(const char file[], SkBitmap* bitmap, SkBitmapConfig p
ref, Mode mode, | 362 static bool DecodeFile(const char file[], SkBitmap* bitmap, SkBitmap::Config
pref, Mode mode, |
| 365 Format* format = NULL) { | 363 Format* format = NULL) { |
| 366 return DecodeFile(file, bitmap, SkBitmapConfigToColorType(pref), mode, f
ormat); | 364 return DecodeFile(file, bitmap, SkBitmapConfigToColorType(pref), mode, f
ormat); |
| 367 } | 365 } |
| 368 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap, | 366 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap, |
| 369 SkBitmap::Config pref, Mode mode, Format* format =
NULL) { | 367 SkBitmap::Config pref, Mode mode, Format* format =
NULL) { |
| 370 return DecodeMemory(buffer, size, bitmap, SkBitmapConfigToColorType(pref
), mode, format); | 368 return DecodeMemory(buffer, size, bitmap, SkBitmapConfigToColorType(pref
), mode, format); |
| 371 } | 369 } |
| 372 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkBit
map::Config pref, | 370 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkBit
map::Config pref, |
| 373 Mode mode, Format* format = NULL) { | 371 Mode mode, Format* format = NULL) { |
| 374 return DecodeStream(stream, bitmap, SkBitmapConfigToColorType(pref), mod
e, format); | 372 return DecodeStream(stream, bitmap, SkBitmapConfigToColorType(pref), mod
e, format); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 527 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
| 530 DECLARE_DECODER_CREATOR(PKMImageDecoder); | 528 DECLARE_DECODER_CREATOR(PKMImageDecoder); |
| 531 DECLARE_DECODER_CREATOR(KTXImageDecoder); | 529 DECLARE_DECODER_CREATOR(KTXImageDecoder); |
| 532 | 530 |
| 533 // Typedefs to make registering decoder and formatter callbacks easier. | 531 // Typedefs to make registering decoder and formatter callbacks easier. |
| 534 // These have to be defined outside SkImageDecoder. :( | 532 // These have to be defined outside SkImageDecoder. :( |
| 535 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 533 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
| 536 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 534 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
| 537 | 535 |
| 538 #endif | 536 #endif |
| OLD | NEW |