Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: include/core/SkImageDecoder.h

Issue 101973005: SkDecodingImageGenerator now uses SkStreamRewindable (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebased again Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/images/SkDecodingImageGenerator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 * Pre-allocated memory. 342 * Pre-allocated memory.
343 */ 343 */
344 void* fAddr; 344 void* fAddr;
345 345
346 /** 346 /**
347 * Rowbytes of the allocated memory. 347 * Rowbytes of the allocated memory.
348 */ 348 */
349 size_t fRowBytes; 349 size_t fRowBytes;
350 }; 350 };
351 351
352 /**
353 * Decode memory.
354 * @param info Output parameter. Returns info about the encoded image.
355 * @param target Contains the address of pixel memory to decode into
356 * (which must be large enough to hold the width in info) and
357 * the row bytes to use. If NULL, returns info and does not
358 * decode pixels.
359 * @return bool Whether the function succeeded.
360 *
361 * Sample usage:
362 * <code>
363 * // Determine the image's info: width/height/config
364 * SkImageInfo info;
365 * bool success = DecodeMemoryToTarget(src, size, &info, NULL);
366 * if (!success) return;
367 * // Allocate space for the result:
368 * SkBitmapFactory::Target target;
369 * target.fAddr = malloc/other allocation
370 * target.fRowBytes = ...
371 * // Now decode the actual pixels into target. &info is optional,
372 * // and could be NULL
373 * success = DecodeMemoryToTarget(src, size, &info, &target);
374 * </code>
375 */
376 static bool DecodeMemoryToTarget(const void* buffer, size_t size, SkImageInf o* info,
377 const Target* target);
378
379 /** Decode the image stored in the specified SkStreamRewindable, and store t he result 352 /** Decode the image stored in the specified SkStreamRewindable, and store t he result
380 in bitmap. Return true for success or false on failure. 353 in bitmap. Return true for success or false on failure.
381 354
382 @param prefConfig If the PrefConfigTable is not set, prefer this config. 355 @param prefConfig If the PrefConfigTable is not set, prefer this config.
383 See NOTE ABOUT PREFERRED CONFIGS. 356 See NOTE ABOUT PREFERRED CONFIGS.
384 357
385 @param format On success, if format is non-null, it is set to the format 358 @param format On success, if format is non-null, it is set to the format
386 of the decoded stream. On failure it is ignored. 359 of the decoded stream. On failure it is ignored.
387 */ 360 */
388 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, 361 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 DECLARE_DECODER_CREATOR(WBMPImageDecoder); 534 DECLARE_DECODER_CREATOR(WBMPImageDecoder);
562 DECLARE_DECODER_CREATOR(WEBPImageDecoder); 535 DECLARE_DECODER_CREATOR(WEBPImageDecoder);
563 536
564 537
565 // Typedefs to make registering decoder and formatter callbacks easier. 538 // Typedefs to make registering decoder and formatter callbacks easier.
566 // These have to be defined outside SkImageDecoder. :( 539 // These have to be defined outside SkImageDecoder. :(
567 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; 540 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg;
568 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; 541 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg;
569 542
570 #endif 543 #endif
OLDNEW
« no previous file with comments | « no previous file | src/images/SkDecodingImageGenerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698