blob: 4f604a203a87867e1788ea5ddc1b7600972d9e85 [file] [log] [blame]
scroggo@google.com7def5e12013-05-31 14:00:10 +00001/*
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.
14int SkForceLinking(bool doNotPassTrue) {
15 if (doNotPassTrue) {
16 SkASSERT(false);
17 CreateJPEGImageDecoder();
18 CreateWEBPImageDecoder();
19 CreateBMPImageDecoder();
20 CreateICOImageDecoder();
djsollen748783d2014-08-28 12:04:41 -070021 CreateWBMPImageDecoder();
22 // Only link hardware texture codecs on platforms that build them. See images.gyp
23#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
robertphillips@google.com8cf81e02014-05-22 18:40:29 +000024 CreatePKMImageDecoder();
krajcevski99ffe242014-06-03 13:04:35 -070025 CreateKTXImageDecoder();
krajcevski95b1b3d2014-08-07 12:58:38 -070026 CreateASTCImageDecoder();
djsollen748783d2014-08-28 12:04:41 -070027#endif
scroggo@google.com7def5e12013-05-31 14:00:10 +000028 // Only link GIF and PNG on platforms that build them. See images.gyp
scroggo@google.comd5936922013-05-31 14:27:55 +000029#if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_NACL) \
30 && !defined(SK_BUILD_FOR_IOS)
scroggo@google.com7def5e12013-05-31 14:00:10 +000031 CreateGIFImageDecoder();
32#endif
scroggo@google.comd5936922013-05-31 14:27:55 +000033#if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_IOS)
scroggo@google.com7def5e12013-05-31 14:00:10 +000034 CreatePNGImageDecoder();
35#endif
caryclark936b7342014-07-11 12:14:51 -070036#if defined(SK_BUILD_FOR_IOS)
37 CreatePNGImageEncoder_IOS();
38#endif
scroggo@google.com7def5e12013-05-31 14:00:10 +000039 return -1;
40 }
41 return 0;
42}