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

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

Issue 1511183002: Revert of default SkPixelSerializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « debugger/QT/SkDebuggerGUI.cpp ('k') | src/image/SkImage.cpp » ('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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 SkImageEncoder_DEFINED 8 #ifndef SkImageEncoder_DEFINED
9 #define SkImageEncoder_DEFINED 9 #define SkImageEncoder_DEFINED
10 10
11 #include "SkImageInfo.h" 11 #include "SkImageInfo.h"
12 #include "SkTRegistry.h" 12 #include "SkTRegistry.h"
13 13
14 class SkBitmap; 14 class SkBitmap;
15 class SkPixelSerializer;
16 class SkPixmap;
17 class SkData; 15 class SkData;
18 class SkWStream; 16 class SkWStream;
19 17
20 class SkImageEncoder { 18 class SkImageEncoder {
21 public: 19 public:
22 // TODO (scroggo): Merge with SkEncodedFormat. 20 // TODO (scroggo): Merge with SkEncodedFormat.
23 enum Type { 21 enum Type {
24 kUnknown_Type, 22 kUnknown_Type,
25 kBMP_Type, 23 kBMP_Type,
26 kGIF_Type, 24 kGIF_Type,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 * Encode bitmap 'bm' in the desired format, writing results to 57 * Encode bitmap 'bm' in the desired format, writing results to
60 * stream 'stream', at quality level 'quality' (which can be in 58 * stream 'stream', at quality level 'quality' (which can be in
61 * range 0-100). Returns false on failure. 59 * range 0-100). Returns false on failure.
62 */ 60 */
63 bool encodeStream(SkWStream* stream, const SkBitmap& bm, int quality); 61 bool encodeStream(SkWStream* stream, const SkBitmap& bm, int quality);
64 62
65 static SkData* EncodeData(const SkImageInfo&, const void* pixels, size_t row Bytes, 63 static SkData* EncodeData(const SkImageInfo&, const void* pixels, size_t row Bytes,
66 Type, int quality); 64 Type, int quality);
67 static SkData* EncodeData(const SkBitmap&, Type, int quality); 65 static SkData* EncodeData(const SkBitmap&, Type, int quality);
68 66
69 static SkData* EncodeData(const SkPixmap&, Type, int quality);
70
71 static bool EncodeFile(const char file[], const SkBitmap&, Type, 67 static bool EncodeFile(const char file[], const SkBitmap&, Type,
72 int quality); 68 int quality);
73 static bool EncodeStream(SkWStream*, const SkBitmap&, Type, 69 static bool EncodeStream(SkWStream*, const SkBitmap&, Type,
74 int quality); 70 int quality);
75 71
76 /** Uses SkImageEncoder to serialize images that are not already
77 encoded as SkImageEncoder::kPNG_Type images. */
78 static SkPixelSerializer* CreatePixelSerializer();
79
80 protected: 72 protected:
81 /** 73 /**
82 * Encode bitmap 'bm' in the desired format, writing results to 74 * Encode bitmap 'bm' in the desired format, writing results to
83 * stream 'stream', at quality level 'quality' (which can be in 75 * stream 'stream', at quality level 'quality' (which can be in
84 * range 0-100). 76 * range 0-100).
85 * 77 *
86 * This must be overridden by each SkImageEncoder implementation. 78 * This must be overridden by each SkImageEncoder implementation.
87 */ 79 */
88 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) = 0; 80 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) = 0;
89 }; 81 };
(...skipping 21 matching lines...) Expand all
111 DECLARE_ENCODER_CREATOR(WEBPImageEncoder); 103 DECLARE_ENCODER_CREATOR(WEBPImageEncoder);
112 104
113 #ifdef SK_BUILD_FOR_IOS 105 #ifdef SK_BUILD_FOR_IOS
114 DECLARE_ENCODER_CREATOR(PNGImageEncoder_IOS); 106 DECLARE_ENCODER_CREATOR(PNGImageEncoder_IOS);
115 #endif 107 #endif
116 108
117 // Typedef to make registering encoder callback easier 109 // Typedef to make registering encoder callback easier
118 // This has to be defined outside SkImageEncoder. :( 110 // This has to be defined outside SkImageEncoder. :(
119 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc odeReg; 111 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc odeReg;
120 #endif 112 #endif
OLDNEW
« no previous file with comments | « debugger/QT/SkDebuggerGUI.cpp ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698