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

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

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. Created 5 years, 11 months 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
« no previous file with comments | « gm/dftext.cpp ('k') | include/core/SkPicture.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 * 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode); 236 Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode);
237 Result decode(SkStream* stream, SkBitmap* bitmap, Mode mode) { 237 Result decode(SkStream* stream, SkBitmap* bitmap, Mode mode) {
238 return this->decode(stream, bitmap, kUnknown_SkColorType, mode); 238 return this->decode(stream, bitmap, kUnknown_SkColorType, mode);
239 } 239 }
240 240
241 /** 241 /**
242 * Given a stream, build an index for doing tile-based decode. 242 * Given a stream, build an index for doing tile-based decode.
243 * The built index will be saved in the decoder, and the image size will 243 * The built index will be saved in the decoder, and the image size will
244 * be returned in width and height. 244 * be returned in width and height.
245 * 245 *
246 * Takes ownership of the SkStreamRewindable, on success or failure.
247 *
246 * Return true for success or false on failure. 248 * Return true for success or false on failure.
247 */ 249 */
248 bool buildTileIndex(SkStreamRewindable*, int *width, int *height); 250 bool buildTileIndex(SkStreamRewindable*, int *width, int *height);
249 251
250 /** 252 /**
251 * Decode a rectangle subset in the image. 253 * Decode a rectangle subset in the image.
252 * The method can only be called after buildTileIndex(). 254 * The method can only be called after buildTileIndex().
253 * 255 *
254 * Return true for success. 256 * Return true for success.
255 * Return false if the index is never built or failing in decoding. 257 * Return false if the index is never built or failing in decoding.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol orType pref, Mode, 302 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol orType pref, Mode,
301 Format* format = NULL); 303 Format* format = NULL);
302 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { 304 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) {
303 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_ Mode, NULL); 305 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_ Mode, NULL);
304 } 306 }
305 307
306 protected: 308 protected:
307 // must be overridden in subclasses. This guy is called by decode(...) 309 // must be overridden in subclasses. This guy is called by decode(...)
308 virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; 310 virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0;
309 311
310 // If the decoder wants to support tiled based decoding, 312 // If the decoder wants to support tiled based decoding, this method must be overridden.
311 // this method must be overridden. This guy is called by buildTileIndex(...) 313 // This is called by buildTileIndex(...)
312 virtual bool onBuildTileIndex(SkStreamRewindable*, int* /*width*/, int* /*he ight*/) { 314 virtual bool onBuildTileIndex(SkStreamRewindable*, int* /*width*/, int* /*he ight*/);
313 return false;
314 }
315 315
316 // If the decoder wants to support tiled based decoding, 316 // If the decoder wants to support tiled based decoding,
317 // this method must be overridden. This guy is called by decodeRegion(...) 317 // this method must be overridden. This guy is called by decodeRegion(...)
318 virtual bool onDecodeSubset(SkBitmap*, const SkIRect&) { 318 virtual bool onDecodeSubset(SkBitmap*, const SkIRect&) {
319 return false; 319 return false;
320 } 320 }
321 321
322 /** If planes or rowBytes is NULL, decodes the header and computes component Sizes 322 /** If planes or rowBytes is NULL, decodes the header and computes component Sizes
323 for memory allocation. 323 for memory allocation.
324 Otherwise, decodes the YUV planes into the provided image planes and 324 Otherwise, decodes the YUV planes into the provided image planes and
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 DECLARE_DECODER_CREATOR(PKMImageDecoder); 460 DECLARE_DECODER_CREATOR(PKMImageDecoder);
461 DECLARE_DECODER_CREATOR(KTXImageDecoder); 461 DECLARE_DECODER_CREATOR(KTXImageDecoder);
462 DECLARE_DECODER_CREATOR(ASTCImageDecoder); 462 DECLARE_DECODER_CREATOR(ASTCImageDecoder);
463 463
464 // Typedefs to make registering decoder and formatter callbacks easier. 464 // Typedefs to make registering decoder and formatter callbacks easier.
465 // These have to be defined outside SkImageDecoder. :( 465 // These have to be defined outside SkImageDecoder. :(
466 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; 466 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg;
467 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; 467 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg;
468 468
469 #endif 469 #endif
OLDNEW
« no previous file with comments | « gm/dftext.cpp ('k') | include/core/SkPicture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698