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

Side by Side Diff: src/ports/SkImageEncoder_WIC.cpp

Issue 2250683003: Add test for platform encoders, turn off platform encoders by default (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Test on windows Created 4 years, 4 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 | « src/ports/SkImageEncoder_CG.cpp ('k') | 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 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 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #if defined(SK_BUILD_FOR_WIN32) 10 #if defined(SK_BUILD_FOR_WIN32)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 //Undo this #define if it has been done so that we link against the symbols 43 //Undo this #define if it has been done so that we link against the symbols
44 //we intended to link against on all SDKs. 44 //we intended to link against on all SDKs.
45 #if defined(CLSID_WICImagingFactory) 45 #if defined(CLSID_WICImagingFactory)
46 #undef CLSID_WICImagingFactory 46 #undef CLSID_WICImagingFactory
47 #endif 47 #endif
48 48
49 class SkImageEncoder_WIC : public SkImageEncoder { 49 class SkImageEncoder_WIC : public SkImageEncoder {
50 public: 50 public:
51 SkImageEncoder_WIC(Type t) : fType(t) {} 51 SkImageEncoder_WIC(Type t) : fType(t) {}
52 52
53 // DO NOT USE this constructor. This exists only so SkForceLinking can
54 // link the WIC image encoder.
55 SkImageEncoder_WIC() {}
56
57 protected: 53 protected:
58 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality); 54 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
59 55
60 private: 56 private:
61 Type fType; 57 Type fType;
62 }; 58 };
63 59
64 bool SkImageEncoder_WIC::onEncode(SkWStream* stream 60 bool SkImageEncoder_WIC::onEncode(SkWStream* stream
65 , const SkBitmap& bitmapOrig 61 , const SkBitmap& bitmapOrig
66 , int quality) 62 , int quality)
67 { 63 {
68 GUID type; 64 GUID type;
69 switch (fType) { 65 switch (fType) {
70 case kBMP_Type:
msarett 2016/08/16 21:26:51 These don't work. I'm guessing that they've never
71 type = GUID_ContainerFormatBmp;
72 break;
73 case kICO_Type:
74 type = GUID_ContainerFormatIco;
75 break;
76 case kJPEG_Type: 66 case kJPEG_Type:
77 type = GUID_ContainerFormatJpeg; 67 type = GUID_ContainerFormatJpeg;
78 break; 68 break;
79 case kPNG_Type: 69 case kPNG_Type:
80 type = GUID_ContainerFormatPng; 70 type = GUID_ContainerFormatPng;
81 break; 71 break;
82 default: 72 default:
83 return false; 73 return false;
84 } 74 }
85 75
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 211
222 if (SUCCEEDED(hr)) { 212 if (SUCCEEDED(hr)) {
223 hr = piEncoder->Commit(); 213 hr = piEncoder->Commit();
224 } 214 }
225 215
226 return SUCCEEDED(hr); 216 return SUCCEEDED(hr);
227 } 217 }
228 218
229 /////////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////////
230 220
221 #ifdef SK_USE_WIC_ENCODER
231 static SkImageEncoder* sk_imageencoder_wic_factory(SkImageEncoder::Type t) { 222 static SkImageEncoder* sk_imageencoder_wic_factory(SkImageEncoder::Type t) {
232 switch (t) { 223 switch (t) {
233 case SkImageEncoder::kBMP_Type:
234 case SkImageEncoder::kICO_Type:
235 case SkImageEncoder::kPNG_Type: 224 case SkImageEncoder::kPNG_Type:
236 case SkImageEncoder::kJPEG_Type: 225 case SkImageEncoder::kJPEG_Type:
237 break; 226 break;
238 default: 227 default:
239 return nullptr; 228 return nullptr;
240 } 229 }
241 return new SkImageEncoder_WIC(t); 230 return new SkImageEncoder_WIC(t);
242 } 231 }
243 232
244 static SkImageEncoder_EncodeReg gEReg(sk_imageencoder_wic_factory); 233 static SkImageEncoder_EncodeReg gEReg(sk_imageencoder_wic_factory);
234 #endif
245 235
246 DEFINE_ENCODER_CREATOR(ImageEncoder_WIC); 236 SkImageEncoder* CreateImageEncoder_WIC(SkImageEncoder::Type type) {
237 return new SkImageEncoder_WIC(type);
238 }
247 239
248 #endif // defined(SK_BUILD_FOR_WIN32) 240 #endif // defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/ports/SkImageEncoder_CG.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698