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

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

Issue 1776153003: Deprecate SkImageDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Suggest an alternative Created 4 years, 9 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 | « no previous file | no next file » | 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
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkImage.h" 12 #include "SkImage.h"
13 #include "SkPngChunkReader.h" 13 #include "SkPngChunkReader.h"
14 #include "SkRect.h" 14 #include "SkRect.h"
15 #include "SkRefCnt.h" 15 #include "SkRefCnt.h"
16 #include "SkTRegistry.h" 16 #include "SkTRegistry.h"
17 #include "SkTypes.h" 17 #include "SkTypes.h"
18 18
19 class SkStream; 19 class SkStream;
20 class SkStreamRewindable; 20 class SkStreamRewindable;
21 21
22 /** \class SkImageDecoder 22 /** \class SkImageDecoder
23 23
24 DEPRECATED Please use SkImage::NewFromEncoded() or SkImageGenerator::NewFrom Encoded().
25
24 Base class for decoding compressed images into a SkBitmap 26 Base class for decoding compressed images into a SkBitmap
25 */ 27 */
26 class SkImageDecoder : SkNoncopyable { 28 class SkImageDecoder : SkNoncopyable {
27 public: 29 public:
28 virtual ~SkImageDecoder(); 30 virtual ~SkImageDecoder();
29 31
30 // TODO (scroggo): Merge with SkEncodedFormat 32 // TODO (scroggo): Merge with SkEncodedFormat
31 enum Format { 33 enum Format {
32 kUnknown_Format, 34 kUnknown_Format,
33 kBMP_Format, 35 kBMP_Format,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 If an SkPngChunkReader is installed via setPeeker, it may be used to 220 If an SkPngChunkReader is installed via setPeeker, it may be used to
219 peek into meta data during the decode. 221 peek into meta data during the decode.
220 */ 222 */
221 Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode); 223 Result decode(SkStream*, SkBitmap* bitmap, SkColorType pref, Mode);
222 Result decode(SkStream* stream, SkBitmap* bitmap, Mode mode) { 224 Result decode(SkStream* stream, SkBitmap* bitmap, Mode mode) {
223 return this->decode(stream, bitmap, kUnknown_SkColorType, mode); 225 return this->decode(stream, bitmap, kUnknown_SkColorType, mode);
224 } 226 }
225 227
226 /** Given a stream, this will try to find an appropriate decoder object. 228 /** Given a stream, this will try to find an appropriate decoder object.
227 If none is found, the method returns NULL. 229 If none is found, the method returns NULL.
230
231 DEPRECATED Please use SkImage::NewFromEncoded() or SkImageGenerator::New FromEncoded().
228 */ 232 */
229 static SkImageDecoder* Factory(SkStreamRewindable*); 233 static SkImageDecoder* Factory(SkStreamRewindable*);
230 234
231 /** Decode the image stored in the specified file, and store the result 235 /** Decode the image stored in the specified file, and store the result
232 in bitmap. Return true for success or false on failure. 236 in bitmap. Return true for success or false on failure.
233 237
234 @param pref Prefer this colortype. 238 @param pref Prefer this colortype.
235 239
236 @param format On success, if format is non-null, it is set to the format 240 @param format On success, if format is non-null, it is set to the format
237 of the decoded file. On failure it is ignored. 241 of the decoded file. On failure it is ignored.
242
243 DEPRECATED Do not use.
238 */ 244 */
239 static bool DecodeFile(const char file[], SkBitmap* bitmap, SkColorType pref , Mode, 245 static bool DecodeFile(const char file[], SkBitmap* bitmap, SkColorType pref , Mode,
240 Format* format = NULL); 246 Format* format = NULL);
241 static bool DecodeFile(const char file[], SkBitmap* bitmap) { 247 static bool DecodeFile(const char file[], SkBitmap* bitmap) {
242 return DecodeFile(file, bitmap, kUnknown_SkColorType, kDecodePixels_Mode , NULL); 248 return DecodeFile(file, bitmap, kUnknown_SkColorType, kDecodePixels_Mode , NULL);
243 } 249 }
244 250
245 /** Decode the image stored in the specified memory buffer, and store the 251 /** Decode the image stored in the specified memory buffer, and store the
246 result in bitmap. Return true for success or false on failure. 252 result in bitmap. Return true for success or false on failure.
247 253
248 @param pref Prefer this colortype. 254 @param pref Prefer this colortype.
249 255
250 @param format On success, if format is non-null, it is set to the format 256 @param format On success, if format is non-null, it is set to the format
251 of the decoded buffer. On failure it is ignored. 257 of the decoded buffer. On failure it is ignored.
258
259 DEPRECATED Please use SkImage::NewFromEncoded() or SkImageGenerator::New FromEncoded().
252 */ 260 */
253 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap, SkColorType pref, 261 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap, SkColorType pref,
254 Mode, Format* format = NULL); 262 Mode, Format* format = NULL);
255 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap){ 263 static bool DecodeMemory(const void* buffer, size_t size, SkBitmap* bitmap){
256 return DecodeMemory(buffer, size, bitmap, kUnknown_SkColorType, kDecodeP ixels_Mode, NULL); 264 return DecodeMemory(buffer, size, bitmap, kUnknown_SkColorType, kDecodeP ixels_Mode, NULL);
257 } 265 }
258 266
259 /** Decode the image stored in the specified SkStreamRewindable, and store t he result 267 /** Decode the image stored in the specified SkStreamRewindable, and store t he result
260 in bitmap. Return true for success or false on failure. 268 in bitmap. Return true for success or false on failure.
261 269
262 @param pref Prefer this colortype. 270 @param pref Prefer this colortype.
263 271
264 @param format On success, if format is non-null, it is set to the format 272 @param format On success, if format is non-null, it is set to the format
265 of the decoded stream. On failure it is ignored. 273 of the decoded stream. On failure it is ignored.
274
275 DEPRECATED Please use SkImage::NewFromEncoded() or SkImageGenerator::New FromEncoded().
266 */ 276 */
267 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol orType pref, Mode, 277 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap, SkCol orType pref, Mode,
268 Format* format = NULL); 278 Format* format = NULL);
269 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) { 279 static bool DecodeStream(SkStreamRewindable* stream, SkBitmap* bitmap) {
270 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_ Mode, NULL); 280 return DecodeStream(stream, bitmap, kUnknown_SkColorType, kDecodePixels_ Mode, NULL);
271 } 281 }
272 282
273 protected: 283 protected:
274 // must be overridden in subclasses. This guy is called by decode(...) 284 // must be overridden in subclasses. This guy is called by decode(...)
275 virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0; 285 virtual Result onDecode(SkStream*, SkBitmap* bitmap, Mode) = 0;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 DECLARE_DECODER_CREATOR(PKMImageDecoder); 404 DECLARE_DECODER_CREATOR(PKMImageDecoder);
395 DECLARE_DECODER_CREATOR(KTXImageDecoder); 405 DECLARE_DECODER_CREATOR(KTXImageDecoder);
396 DECLARE_DECODER_CREATOR(ASTCImageDecoder); 406 DECLARE_DECODER_CREATOR(ASTCImageDecoder);
397 407
398 // Typedefs to make registering decoder and formatter callbacks easier. 408 // Typedefs to make registering decoder and formatter callbacks easier.
399 // These have to be defined outside SkImageDecoder. :( 409 // These have to be defined outside SkImageDecoder. :(
400 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg; 410 typedef SkTRegistry<SkImageDecoder*(*)(SkStreamRewindable*)> SkImageDecod er_DecodeReg;
401 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg; 411 typedef SkTRegistry<SkImageDecoder::Format(*)(SkStreamRewindable*)> SkImageDecod er_FormatReg;
402 412
403 #endif 413 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698