OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkImageDecoder_DEFINED | 10 #ifndef SkImageDecoder_DEFINED |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 * @param info Output parameter. Returns info about the encoded image. | 370 * @param info Output parameter. Returns info about the encoded image. |
371 * @param target Contains the address of pixel memory to decode into | 371 * @param target Contains the address of pixel memory to decode into |
372 * (which must be large enough to hold the width in info) and | 372 * (which must be large enough to hold the width in info) and |
373 * the row bytes to use. If NULL, returns info and does not | 373 * the row bytes to use. If NULL, returns info and does not |
374 * decode pixels. | 374 * decode pixels. |
375 * @return bool Whether the function succeeded. | 375 * @return bool Whether the function succeeded. |
376 * | 376 * |
377 * Sample usage: | 377 * Sample usage: |
378 * <code> | 378 * <code> |
379 * // Determine the image's info: width/height/config | 379 * // Determine the image's info: width/height/config |
380 * SkImage::Info info; | 380 * SkImageInfo info; |
381 * bool success = DecodeMemoryToTarget(src, size, &info, NULL); | 381 * bool success = DecodeMemoryToTarget(src, size, &info, NULL); |
382 * if (!success) return; | 382 * if (!success) return; |
383 * // Allocate space for the result: | 383 * // Allocate space for the result: |
384 * SkBitmapFactory::Target target; | 384 * SkBitmapFactory::Target target; |
385 * target.fAddr = malloc/other allocation | 385 * target.fAddr = malloc/other allocation |
386 * target.fRowBytes = ... | 386 * target.fRowBytes = ... |
387 * // Now decode the actual pixels into target. &info is optional, | 387 * // Now decode the actual pixels into target. &info is optional, |
388 * // and could be NULL | 388 * // and could be NULL |
389 * success = DecodeMemoryToTarget(src, size, &info, &target); | 389 * success = DecodeMemoryToTarget(src, size, &info, &target); |
390 * </code> | 390 * </code> |
391 */ | 391 */ |
392 static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImage::I
nfo* info, | 392 static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImageInf
o* info, |
393 const SkBitmapFactory::Target* target); | 393 const SkBitmapFactory::Target* target); |
394 | 394 |
395 /** Decode the image stored in the specified SkStreamRewindable, and store t
he result | 395 /** Decode the image stored in the specified SkStreamRewindable, and store t
he result |
396 in bitmap. Return true for success or false on failure. | 396 in bitmap. Return true for success or false on failure. |
397 | 397 |
398 @param prefConfig If the PrefConfigTable is not set, prefer this config. | 398 @param prefConfig If the PrefConfigTable is not set, prefer this config. |
399 See NOTE ABOUT PREFERRED CONFIGS. | 399 See NOTE ABOUT PREFERRED CONFIGS. |
400 | 400 |
401 @param format On success, if format is non-null, it is set to the format | 401 @param format On success, if format is non-null, it is set to the format |
402 of the decoded stream. On failure it is ignored. | 402 of the decoded stream. On failure it is ignored. |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 DECLARE_DECODER_CREATOR(WBMPImageDecoder); | 577 DECLARE_DECODER_CREATOR(WBMPImageDecoder); |
578 DECLARE_DECODER_CREATOR(WEBPImageDecoder); | 578 DECLARE_DECODER_CREATOR(WEBPImageDecoder); |
579 | 579 |
580 | 580 |
581 // Typedefs to make registering decoder and formatter callbacks easier. | 581 // Typedefs to make registering decoder and formatter callbacks easier. |
582 // These have to be defined outside SkImageDecoder. :( | 582 // These have to be defined outside SkImageDecoder. :( |
583 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; | 583 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod
er_DecodeReg; |
584 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; | 584 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod
er_FormatReg; |
585 | 585 |
586 #endif | 586 #endif |
OLD | NEW |