| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkImageEncoder.h" | 8 #include "SkImageEncoder.h" |
| 9 #include "SkForceLinking.h" | 9 #include "SkForceLinking.h" |
| 10 | 10 |
| 11 // This method is required to fool the linker into not discarding the pre-main | 11 // This method is required to fool the linker into not discarding the pre-main |
| 12 // initialization and registration of the encoder classes. Passing true will | 12 // initialization and registration of the encoder classes. Passing true will |
| 13 // cause memory leaks. | 13 // cause memory leaks. |
| 14 int SkForceLinking(bool doNotPassTrue) { | 14 int SkForceLinking(bool doNotPassTrue) { |
| 15 if (doNotPassTrue) { | 15 if (doNotPassTrue) { |
| 16 SkASSERT(false); | 16 SkASSERT(false); |
| 17 #if defined(SK_HAS_JPEG_LIBRARY) | 17 #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUIL
D_FOR_IOS) && \ |
| 18 defined(SK_HAS_JPEG_LIBRARY) |
| 18 CreateJPEGImageEncoder(); | 19 CreateJPEGImageEncoder(); |
| 19 #endif | 20 #endif |
| 20 #if defined(SK_HAS_WEBP_LIBRARY) | 21 #if defined(SK_HAS_WEBP_LIBRARY) |
| 21 CreateWEBPImageEncoder(); | 22 CreateWEBPImageEncoder(); |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 // Only link hardware texture codecs on platforms that build them. See i
mages.gyp | 25 // Only link hardware texture codecs on platforms that build them. See i
mages.gyp |
| 25 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK | 26 #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 26 CreateKTXImageEncoder(); | 27 CreateKTXImageEncoder(); |
| 27 #endif | 28 #endif |
| 28 | 29 |
| 29 #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUIL
D_FOR_IOS) && \ | 30 #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUIL
D_FOR_IOS) && \ |
| 30 defined(SK_HAS_PNG_LIBRARY) | 31 defined(SK_HAS_PNG_LIBRARY) |
| 31 CreatePNGImageEncoder(); | 32 CreatePNGImageEncoder(); |
| 32 #endif | 33 #endif |
| 33 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) | 34 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) |
| 34 CreatePNGImageEncoder_CG(); | 35 CreatePNGImageEncoder_CG(); |
| 35 #endif | 36 #endif |
| 36 #if defined(SK_BUILD_FOR_WIN) | 37 #if defined(SK_BUILD_FOR_WIN) |
| 37 CreateImageEncoder_WIC(); | 38 CreateImageEncoder_WIC(); |
| 38 #endif | 39 #endif |
| 39 return -1; | 40 return -1; |
| 40 } | 41 } |
| 41 return 0; | 42 return 0; |
| 42 } | 43 } |
| OLD | NEW |