scroggo@google.com | 7def5e1 | 2013-05-31 14:00:10 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "SkForceLinking.h" |
| 9 | #include "SkImageDecoder.h" |
| 10 | |
| 11 | // This method is required to fool the linker into not discarding the pre-main |
| 12 | // initialization and registration of the decoder classes. Passing true will |
| 13 | // cause memory leaks. |
| 14 | int SkForceLinking(bool doNotPassTrue) { |
| 15 | if (doNotPassTrue) { |
| 16 | SkASSERT(false); |
| 17 | CreateJPEGImageDecoder(); |
| 18 | CreateWEBPImageDecoder(); |
| 19 | CreateBMPImageDecoder(); |
| 20 | CreateICOImageDecoder(); |
djsollen | 748783d | 2014-08-28 12:04:41 -0700 | [diff] [blame] | 21 | CreateWBMPImageDecoder(); |
| 22 | // Only link hardware texture codecs on platforms that build them. See images.gyp |
| 23 | #ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK |
robertphillips@google.com | 8cf81e0 | 2014-05-22 18:40:29 +0000 | [diff] [blame] | 24 | CreatePKMImageDecoder(); |
krajcevski | 99ffe24 | 2014-06-03 13:04:35 -0700 | [diff] [blame] | 25 | CreateKTXImageDecoder(); |
krajcevski | 95b1b3d | 2014-08-07 12:58:38 -0700 | [diff] [blame] | 26 | CreateASTCImageDecoder(); |
djsollen | 748783d | 2014-08-28 12:04:41 -0700 | [diff] [blame] | 27 | #endif |
scroggo@google.com | 7def5e1 | 2013-05-31 14:00:10 +0000 | [diff] [blame] | 28 | // Only link GIF and PNG on platforms that build them. See images.gyp |
scroggo@google.com | d593692 | 2013-05-31 14:27:55 +0000 | [diff] [blame] | 29 | #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_NACL) \ |
| 30 | && !defined(SK_BUILD_FOR_IOS) |
scroggo@google.com | 7def5e1 | 2013-05-31 14:00:10 +0000 | [diff] [blame] | 31 | CreateGIFImageDecoder(); |
| 32 | #endif |
scroggo@google.com | d593692 | 2013-05-31 14:27:55 +0000 | [diff] [blame] | 33 | #if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_IOS) |
scroggo@google.com | 7def5e1 | 2013-05-31 14:00:10 +0000 | [diff] [blame] | 34 | CreatePNGImageDecoder(); |
| 35 | #endif |
caryclark | 936b734 | 2014-07-11 12:14:51 -0700 | [diff] [blame] | 36 | #if defined(SK_BUILD_FOR_IOS) |
| 37 | CreatePNGImageEncoder_IOS(); |
| 38 | #endif |
scroggo@google.com | 7def5e1 | 2013-05-31 14:00:10 +0000 | [diff] [blame] | 39 | return -1; |
| 40 | } |
| 41 | return 0; |
| 42 | } |