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

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

Issue 14363003: Updates to skimage tool to use it for testing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Change getFormatName to use a switch statement. Created 7 years, 8 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 | Annotate | Revision Log
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
11 #define SkImageDecoder_DEFINED 11 #define SkImageDecoder_DEFINED
12 12
13 #include "SkBitmap.h" 13 #include "SkBitmap.h"
14 #include "SkBitmapFactory.h" 14 #include "SkBitmapFactory.h"
15 #include "SkImage.h" 15 #include "SkImage.h"
16 #include "SkRect.h" 16 #include "SkRect.h"
17 #include "SkRefCnt.h" 17 #include "SkRefCnt.h"
18 18
19 class SkStream; 19 class SkStream;
20 20
21 /** \class SkImageDecoder 21 /** \class SkImageDecoder
22 22
23 Base class for decoding compressed images into a SkBitmap 23 Base class for decoding compressed images into a SkBitmap
24 */ 24 */
25 class SkImageDecoder { 25 class SkImageDecoder {
26 public: 26 public:
27 virtual ~SkImageDecoder(); 27 virtual ~SkImageDecoder();
28 28
29 // Should be consistent with sFormatName
30 enum Format { 29 enum Format {
31 kUnknown_Format, 30 kUnknown_Format,
32 kBMP_Format, 31 kBMP_Format,
33 kGIF_Format, 32 kGIF_Format,
34 kICO_Format, 33 kICO_Format,
35 kJPEG_Format, 34 kJPEG_Format,
36 kPNG_Format, 35 kPNG_Format,
37 kWBMP_Format, 36 kWBMP_Format,
38 kWEBP_Format, 37 kWEBP_Format,
39 38
40 kLastKnownFormat = kWEBP_Format 39 kLastKnownFormat = kWEBP_Format
41 }; 40 };
42 41
43 /** Return the format of image this decoder can decode. If this decoder can decode multiple 42 /** Return the format of image this decoder can decode. If this decoder can decode multiple
44 formats, kUnknown_Format will be returned. 43 formats, returns the format of the data that was most recently decoded s uccessfully. Can
44 return kUnknown_Format.
45 */ 45 */
46 virtual Format getFormat() const; 46 virtual Format getFormat() const;
47 47
48 /** Return a readable string of the value returned by getFormat(). 48 /** Return a readable string of the value returned by getFormat().
49 */ 49 */
50 const char* getFormatName() const; 50 const char* getFormatName() const;
51 51
52 /** Returns true if the decoder should try to dither the resulting image. 52 /** Returns true if the decoder should try to dither the resulting image.
53 The default setting is true. 53 The default setting is true.
54 */ 54 */
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 Chooser* fChooser; 409 Chooser* fChooser;
410 SkBitmap::Allocator* fAllocator; 410 SkBitmap::Allocator* fAllocator;
411 int fSampleSize; 411 int fSampleSize;
412 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false 412 SkBitmap::Config fDefaultPref; // use if fUsePrefTable is false
413 SkBitmap::Config fPrefTable[6]; // use if fUsePrefTable is true 413 SkBitmap::Config fPrefTable[6]; // use if fUsePrefTable is true
414 bool fDitherImage; 414 bool fDitherImage;
415 bool fUsePrefTable; 415 bool fUsePrefTable;
416 mutable bool fShouldCancelDecode; 416 mutable bool fShouldCancelDecode;
417 bool fPreferQualityOverSpeed; 417 bool fPreferQualityOverSpeed;
418 418
419 /** Contains the image format name.
420 * This should be consistent with Format.
421 *
422 * The format name gives a more meaningful error message than enum.
423 */
424 static const char* sFormatName[];
425
426 // illegal 419 // illegal
427 SkImageDecoder(const SkImageDecoder&); 420 SkImageDecoder(const SkImageDecoder&);
428 SkImageDecoder& operator=(const SkImageDecoder&); 421 SkImageDecoder& operator=(const SkImageDecoder&);
429 }; 422 };
430 423
431 /** Calling newDecoder with a stream returns a new matching imagedecoder 424 /** Calling newDecoder with a stream returns a new matching imagedecoder
432 instance, or NULL if none can be found. The caller must manage its ownership 425 instance, or NULL if none can be found. The caller must manage its ownership
433 of the stream as usual, calling unref() when it is done, as the returned 426 of the stream as usual, calling unref() when it is done, as the returned
434 decoder may have called ref() (and if so, the decoder is responsible for 427 decoder may have called ref() (and if so, the decoder is responsible for
435 balancing its ownership when it is destroyed). 428 balancing its ownership when it is destroyed).
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 // not all of these will be available 461 // not all of these will be available
469 DECLARE_DECODER_CREATOR(BMPImageDecoder); 462 DECLARE_DECODER_CREATOR(BMPImageDecoder);
470 DECLARE_DECODER_CREATOR(GIFImageDecoder); 463 DECLARE_DECODER_CREATOR(GIFImageDecoder);
471 DECLARE_DECODER_CREATOR(ICOImageDecoder); 464 DECLARE_DECODER_CREATOR(ICOImageDecoder);
472 DECLARE_DECODER_CREATOR(JPEGImageDecoder); 465 DECLARE_DECODER_CREATOR(JPEGImageDecoder);
473 DECLARE_DECODER_CREATOR(PNGImageDecoder); 466 DECLARE_DECODER_CREATOR(PNGImageDecoder);
474 DECLARE_DECODER_CREATOR(WBMPImageDecoder); 467 DECLARE_DECODER_CREATOR(WBMPImageDecoder);
475 DECLARE_DECODER_CREATOR(WEBPImageDecoder); 468 DECLARE_DECODER_CREATOR(WEBPImageDecoder);
476 469
477 #endif 470 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | include/images/SkImageEncoder.h » ('j') | tools/skimage_main.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698