blob: e4dc60a4480b76e7a7ce3f6bddc16ce98b850e51 [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();
21 CreateWBMPImageDecoder();
scroggo@google.com7def5e12013-05-31 14:00:10 +000022 // Only link GIF and PNG on platforms that build them. See images.gyp
scroggo@google.comd5936922013-05-31 14:27:55 +000023#if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_NACL) \
24 && !defined(SK_BUILD_FOR_IOS)
scroggo@google.com7def5e12013-05-31 14:00:10 +000025 CreateGIFImageDecoder();
26#endif
scroggo@google.comd5936922013-05-31 14:27:55 +000027#if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_IOS)
scroggo@google.com7def5e12013-05-31 14:00:10 +000028 CreatePNGImageDecoder();
29#endif
30 return -1;
31 }
32 return 0;
33}