OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2009 The Android Open Source Project | 3 * Copyright 2009 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 #include "SkImageEncoder.h" | 9 #include "SkImageEncoder.h" |
10 | 10 #include "SkImageDecoder_libpng.h" |
11 template SkImageEncoder_EncodeReg* SkImageEncoder_EncodeReg::gHead; | 11 #include "SkImageDecoder_libjpeg.h" |
| 12 #include "SkImageDecoder_libwebp.h" |
| 13 #if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) |
| 14 #include "SkImageDecoder_ktx.h" |
| 15 #endif |
| 16 #if defined(SK_BUILD_FOR_WIN) |
| 17 #include "SkImageDecoder_WIC.h" |
| 18 #endif |
| 19 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 20 #include "SkImageDecoder_CG.h" |
| 21 #endif |
12 | 22 |
13 SkImageEncoder* SkImageEncoder::Create(Type t) { | 23 SkImageEncoder* SkImageEncoder::Create(Type t) { |
14 SkImageEncoder* codec = NULL; | 24 SkImageEncoder* codec = NULL; |
15 const SkImageEncoder_EncodeReg* curr = SkImageEncoder_EncodeReg::Head(); | 25 #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUIL
D_FOR_WIN) |
16 while (curr) { | 26 if ((codec = SkCreatePNGImageEncoder(t)) != NULL) { |
17 if ((codec = curr->factory()(t)) != NULL) { | 27 return codec; |
18 return codec; | |
19 } | |
20 curr = curr->next(); | |
21 } | 28 } |
| 29 #endif |
| 30 if ((codec = SkCreateJPEGImageEncoder(t)) != NULL) { |
| 31 return codec; |
| 32 } |
| 33 if ((codec = SkCreateWEBPImageEncoder(t)) != NULL) { |
| 34 return codec; |
| 35 } |
| 36 #if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) |
| 37 if ((codec = SkCreateKTXImageEncoder(t)) != NULL) { |
| 38 return codec; |
| 39 } |
| 40 #endif |
| 41 #if defined(SK_BUILD_FOR_WIN) |
| 42 if ((codec = SkCreateImageEncoder_WIC(t)) != NULL) { |
| 43 return codec; |
| 44 } |
| 45 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 46 if ((codec = SkCreateImageEncoder_CG(t)) != NULL) { |
| 47 return codec; |
| 48 } |
| 49 #endif |
22 return NULL; | 50 return NULL; |
23 } | 51 } |
OLD | NEW |