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

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

Issue 670453002: Remove image decoder and encoder autoregistration (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-decoder-01-skpicture
Patch Set: Created 6 years, 2 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #ifndef SkImageEncoder_DEFINED 8 #ifndef SkImageEncoder_DEFINED
9 #define SkImageEncoder_DEFINED 9 #define SkImageEncoder_DEFINED
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 /** 80 /**
81 * Encode bitmap 'bm' in the desired format, writing results to 81 * Encode bitmap 'bm' in the desired format, writing results to
82 * stream 'stream', at quality level 'quality' (which can be in 82 * stream 'stream', at quality level 'quality' (which can be in
83 * range 0-100). 83 * range 0-100).
84 * 84 *
85 * This must be overridden by each SkImageEncoder implementation. 85 * This must be overridden by each SkImageEncoder implementation.
86 */ 86 */
87 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) = 0; 87 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) = 0;
88 }; 88 };
89 89
90 // This macro declares a global (i.e., non-class owned) creation entry point
91 // for each encoder (e.g., CreateJPEGImageEncoder)
92 #define DECLARE_ENCODER_CREATOR(codec) \
93 SkImageEncoder *Create ## codec ();
94
95 // This macro defines the global creation entry point for each encoder. Each
96 // encoder implementation that registers with the encoder factory must call it.
97 #define DEFINE_ENCODER_CREATOR(codec) \
98 SkImageEncoder *Create ## codec () { \
99 return SkNEW( Sk ## codec ); \
100 }
101
102 // All the encoders known by Skia. Note that, depending on the compiler settings ,
103 // not all of these will be available
104 /** An ARGBImageEncoder will always write out
105 * bitmap.width() * bitmap.height() * 4
106 * bytes.
107 */
108 DECLARE_ENCODER_CREATOR(ARGBImageEncoder);
109 DECLARE_ENCODER_CREATOR(JPEGImageEncoder);
110 DECLARE_ENCODER_CREATOR(PNGImageEncoder);
111 DECLARE_ENCODER_CREATOR(KTXImageEncoder);
112 DECLARE_ENCODER_CREATOR(WEBPImageEncoder);
113
114 #ifdef SK_BUILD_FOR_IOS
115 DECLARE_ENCODER_CREATOR(PNGImageEncoder_IOS);
116 #endif 90 #endif
117
118 // Typedef to make registering encoder callback easier
119 // This has to be defined outside SkImageEncoder. :(
120 typedef SkTRegistry<SkImageEncoder*(*)(SkImageEncoder::Type)> SkImageEncoder_Enc odeReg;
121 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698