Start making all .cpp files compile-able on all platforms.
I sometimes dream to hone our build process down to something as simple as
$ find src -name '*.cpp' | xargs c++ <some cflags> -c -o skia.o
To start, it helps if we can compile all files on all platforms. Each
non-portable file guards itself with defines provided by SkTypes.h. This does
not convert all non-portable code, but it's a good representative chunk.
E.g. instead of having to remember which SkDebug_*.cpp to compile on which
platform we can just compile all three and let the code itself sort it out.
This has the nice side effect of making non-portable code declare the
conditions under which it can compile explicitly.
I've been testing mostly with the CMake build as it's easiest, but this should
apply equally to BUILD, Gyp, and GN files... to any build system really.
BUG=skia:4269
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot
Review URL: https://codereview.chromium.org/1411283005
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 74fda4b..43c5c6c 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -6,6 +6,7 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#ifndef UNICODE
#define UNICODE
@@ -2265,3 +2266,4 @@
return new SkXPSDevice(this->fXpsFactory.get());
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/doc/SkDocument_XPS.cpp b/src/doc/SkDocument_XPS.cpp
index 57fa0b8..0e241d9 100644
--- a/src/doc/SkDocument_XPS.cpp
+++ b/src/doc/SkDocument_XPS.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#include "SkDocument.h"
#include "SkXPSDevice.h"
#include "SkStream.h"
@@ -75,3 +78,5 @@
}
return new SkDocument_XPS(stream.detach(), delete_wstream, dpi);
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/doc/SkDocument_XPS_None.cpp b/src/doc/SkDocument_XPS_None.cpp
index 9d51ea2..32b18fb 100644
--- a/src/doc/SkDocument_XPS_None.cpp
+++ b/src/doc/SkDocument_XPS_None.cpp
@@ -4,6 +4,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
+#include "SkTypes.h"
+#if !defined(SK_BUILD_FOR_WIN32)
+
#include "SkDocument.h"
SkDocument* SkDocument::CreateXPS(SkWStream*, SkScalar) { return nullptr; }
SkDocument* SkDocument::CreateXPS(const char path[], SkScalar) { return nullptr; }
+
+#endif//!defined(SK_BUILD_FOR_WIN32)
diff --git a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
index 39a6673..1df4a95 100644
--- a/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
+++ b/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
@@ -5,6 +5,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_ANDROID)
+
#include "gl/GrGLInterface.h"
#include "gl/GrGLAssembleInterface.h"
#include "gl/GrGLUtil.h"
@@ -227,3 +230,5 @@
const GrGLInterface* GrGLCreateNativeInterface() {
return GrGLAssembleInterface(nullptr, android_get_gl_proc);
}
+
+#endif//defined(SK_BUILD_FOR_ANDROID)
diff --git a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
index 9a2abfe..83e5593 100644
--- a/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
+++ b/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
@@ -5,6 +5,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC)
#include "gl/GrGLInterface.h"
@@ -56,3 +58,5 @@
GLProcGetter getter;
return GrGLAssembleGLInterface(&getter, mac_get_gl_proc);
}
+
+#endif//defined(SK_BUILD_FOR_MAC)
diff --git a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
index fa4126a..41585c8 100644
--- a/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
+++ b/src/gpu/gl/mac/SkCreatePlatformGLContext_mac.cpp
@@ -5,6 +5,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC)
+
#include "gl/SkGLContext.h"
#include "AvailabilityMacros.h"
@@ -117,3 +120,5 @@
}
return ctx;
}
+
+#endif//defined(SK_BUILD_FOR_MAC)
diff --git a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
index c2fcca5..b0eaa54 100644
--- a/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
+++ b/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
@@ -5,6 +5,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "gl/GrGLInterface.h"
#include "gl/GrGLAssembleInterface.h"
@@ -85,3 +87,5 @@
}
return nullptr;
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkDebug_android.cpp b/src/ports/SkDebug_android.cpp
index 4ab9ad2..0a1b59a 100644
--- a/src/ports/SkDebug_android.cpp
+++ b/src/ports/SkDebug_android.cpp
@@ -6,6 +6,8 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_ANDROID)
+
#include <stdio.h>
#define LOG_TAG "skia"
@@ -30,3 +32,5 @@
va_end(args1);
}
+
+#endif//defined(SK_BUILD_FOR_ANDROID)
diff --git a/src/ports/SkDebug_nacl.cpp b/src/ports/SkDebug_nacl.cpp
deleted file mode 100644
index 6e35f09..0000000
--- a/src/ports/SkDebug_nacl.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#include "SkTypes.h"
-
-static const size_t kBufferSize = 2048;
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/var.h"
-
-extern pp::Instance* gPluginInstance;
-
-namespace {
-static const char* kLogPrefix = "SkDebugf:";
-}
-
-void SkDebugf(const char format[], ...) {
- if (gPluginInstance) {
- char buffer[kBufferSize + 1];
- va_list args;
- va_start(args, format);
- sprintf(buffer, kLogPrefix);
- vsnprintf(buffer + strlen(kLogPrefix), kBufferSize, format, args);
- va_end(args);
- pp::Var msg = pp::Var(buffer);
- gPluginInstance->PostMessage(msg);
- }
-}
diff --git a/src/ports/SkDebug_stdio.cpp b/src/ports/SkDebug_stdio.cpp
index 9e72d47..230c5f2 100644
--- a/src/ports/SkDebug_stdio.cpp
+++ b/src/ports/SkDebug_stdio.cpp
@@ -6,6 +6,7 @@
*/
#include "SkTypes.h"
+#if !defined(SK_BUILD_FOR_WIN32) && !defined(SK_BUILD_FOR_ANDROID)
#include <stdarg.h>
#include <stdio.h>
@@ -16,3 +17,4 @@
vfprintf(stderr, format, args);
va_end(args);
}
+#endif//!defined(SK_BUILD_FOR_WIN32) && !defined(SK_BUILD_FOR_ANDROID)
diff --git a/src/ports/SkDebug_win.cpp b/src/ports/SkDebug_win.cpp
index 67c2397..6e05766 100644
--- a/src/ports/SkDebug_win.cpp
+++ b/src/ports/SkDebug_win.cpp
@@ -9,6 +9,7 @@
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
static const size_t kBufferSize = 2048;
@@ -31,3 +32,4 @@
OutputDebugStringA(buffer);
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 772fe74..25030be 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -7,6 +7,7 @@
*/
#include "SkTypes.h" // Keep this before any #ifdef ...
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
#ifdef SK_BUILD_FOR_MAC
#import <ApplicationServices/ApplicationServices.h>
@@ -2491,3 +2492,5 @@
///////////////////////////////////////////////////////////////////////////////
SkFontMgr* SkFontMgr::Factory() { return new SkFontMgr_Mac; }
+
+#endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index e263cc2..76b8764 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#include "SkAdvancedTypefaceMetrics.h"
#include "SkBase64.h"
#include "SkColorPriv.h"
@@ -2511,3 +2514,5 @@
///////////////////////////////////////////////////////////////////////////////
SkFontMgr* SkFontMgr_New_GDI() { return new SkFontMgrGDI; }
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 0fd121e..11244c5 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_ANDROID)
+
#include "SkFixed.h"
#include "SkFontDescriptor.h"
#include "SkFontHost_FreeType_common.h"
@@ -586,3 +589,5 @@
return new SkFontMgr_Android(custom);
}
+
+#endif//defined(SK_BUILD_FOR_ANDROID)
diff --git a/src/ports/SkFontMgr_android_factory.cpp b/src/ports/SkFontMgr_android_factory.cpp
index 96d8931..99f654d 100644
--- a/src/ports/SkFontMgr_android_factory.cpp
+++ b/src/ports/SkFontMgr_android_factory.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_ANDROID)
#include "SkFontMgr.h"
#include "SkFontMgr_android.h"
@@ -41,3 +43,5 @@
return SkFontMgr_New_Android(nullptr);
}
+
+#endif//defined(SK_BUILD_FOR_ANDROID)
diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp
index 83b1c4a..ba2296b 100644
--- a/src/ports/SkFontMgr_android_parser.cpp
+++ b/src/ports/SkFontMgr_android_parser.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+// Despite the name and location, this is portable code.
+
#include "SkFontMgr_android_parser.h"
#include "SkStream.h"
#include "SkTDArray.h"
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index e40c5e4..585d809 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#include "SkDWrite.h"
#include "SkDWriteFontFileStream.h"
#include "SkFontMgr.h"
@@ -1103,3 +1106,4 @@
}
return new SkFontMgr_Indirect(impl.get(), proxy);
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkFontMgr_win_dw_factory.cpp b/src/ports/SkFontMgr_win_dw_factory.cpp
index 85ed56d..52e22ae 100644
--- a/src/ports/SkFontMgr_win_dw_factory.cpp
+++ b/src/ports/SkFontMgr_win_dw_factory.cpp
@@ -5,9 +5,14 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32) // And !SKIA_GDI?
+
#include "SkFontMgr.h"
#include "SkTypeface_win.h"
SkFontMgr* SkFontMgr::Factory() {
return SkFontMgr_New_DirectWrite();
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkFontMgr_win_gdi_factory.cpp b/src/ports/SkFontMgr_win_gdi_factory.cpp
index de68ae8..c1ca822 100644
--- a/src/ports/SkFontMgr_win_gdi_factory.cpp
+++ b/src/ports/SkFontMgr_win_gdi_factory.cpp
@@ -5,9 +5,14 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32) // And SKIA_GDI?
+
#include "SkFontMgr.h"
#include "SkTypeface_win.h"
SkFontMgr* SkFontMgr::Factory() {
return SkFontMgr_New_GDI();
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkImageDecoder_CG.cpp b/src/ports/SkImageDecoder_CG.cpp
index bd94764..4be5874 100644
--- a/src/ports/SkImageDecoder_CG.cpp
+++ b/src/ports/SkImageDecoder_CG.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+
#include "SkCGUtils.h"
#include "SkColorPriv.h"
#include "SkImageDecoder.h"
@@ -401,3 +404,5 @@
}
static SkImageDecoder_FormatReg gFormatReg(get_format_cg);
+
+#endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
diff --git a/src/ports/SkImageDecoder_WIC.cpp b/src/ports/SkImageDecoder_WIC.cpp
index 3cc9a32..fa40883 100644
--- a/src/ports/SkImageDecoder_WIC.cpp
+++ b/src/ports/SkImageDecoder_WIC.cpp
@@ -8,6 +8,8 @@
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
// Workaround for:
// http://connect.microsoft.com/VisualStudio/feedback/details/621653/
// http://crbug.com/225822
@@ -462,3 +464,5 @@
}
static SkImageDecoder_FormatReg gFormatReg(get_format_wic);
+
+#endif // defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkOSFile_win.cpp b/src/ports/SkOSFile_win.cpp
index 14af458..395a3c8 100644
--- a/src/ports/SkOSFile_win.cpp
+++ b/src/ports/SkOSFile_win.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#include "SkOSFile.h"
#include "SkTFitsIn.h"
@@ -240,3 +243,5 @@
}
return self.fHandle != (HANDLE)~0 && get_the_file(self.fHandle, name, dataPtr, getDir);
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkOSLibrary_posix.cpp b/src/ports/SkOSLibrary_posix.cpp
index cca55f1..1571e20 100644
--- a/src/ports/SkOSLibrary_posix.cpp
+++ b/src/ports/SkOSLibrary_posix.cpp
@@ -5,6 +5,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if !defined(SK_BUILD_FOR_WIN32)
+
#include "SkOSLibrary.h"
#include <dlfcn.h>
@@ -16,3 +19,4 @@
void* GetProcedureAddress(void* library, const char* functionName) {
return dlsym(library, functionName);
}
+#endif//!defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkOSLibrary_win.cpp b/src/ports/SkOSLibrary_win.cpp
index ca80415..69754db 100644
--- a/src/ports/SkOSLibrary_win.cpp
+++ b/src/ports/SkOSLibrary_win.cpp
@@ -5,6 +5,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#include "SkOSLibrary.h"
#include <windows.h>
@@ -15,3 +18,5 @@
void* GetProcedureAddress(void* library, const char* functionName) {
return ::GetProcAddress((HMODULE)library, functionName);
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkRemotableFontMgr_win_dw.cpp b/src/ports/SkRemotableFontMgr_win_dw.cpp
index aaef3a4..6c021a1 100644
--- a/src/ports/SkRemotableFontMgr_win_dw.cpp
+++ b/src/ports/SkRemotableFontMgr_win_dw.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkDWrite.h"
#include "SkDWriteFontFileStream.h"
@@ -504,3 +506,4 @@
return new SkRemotableFontMgr_DirectWrite(sysFontCollection.get(), localeName, localeNameLen);
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkScalerContext_win_dw.cpp b/src/ports/SkScalerContext_win_dw.cpp
index 3a2db14..097db86 100644
--- a/src/ports/SkScalerContext_win_dw.cpp
+++ b/src/ports/SkScalerContext_win_dw.cpp
@@ -6,6 +6,8 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#undef GetGlyphIndices
#include "SkDWrite.h"
@@ -776,3 +778,5 @@
path->transform(fSkXform);
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkTLS_win.cpp b/src/ports/SkTLS_win.cpp
index cdfb465..8bc55a0 100644
--- a/src/ports/SkTLS_win.cpp
+++ b/src/ports/SkTLS_win.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkTLS.h"
#include "SkMutex.h"
@@ -73,3 +75,5 @@
#endif
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkTime_win.cpp b/src/ports/SkTime_win.cpp
index 2bd5062..2589d43 100644
--- a/src/ports/SkTime_win.cpp
+++ b/src/ports/SkTime_win.cpp
@@ -5,6 +5,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkTime.h"
@@ -39,3 +41,4 @@
dt->fSecond = SkToU8(st.wSecond);
}
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 144d4c7..38d09e8 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -6,6 +6,8 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
// SkTypes will include Windows.h, which will pull in all of the GDI defines.
// GDI #defines GetGlyphIndices to GetGlyphIndicesA or GetGlyphIndicesW, but
// IDWriteFontFace has a method called GetGlyphIndices. Since this file does
@@ -459,3 +461,4 @@
return info;
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/SkThreadUtils_win.cpp b/src/utils/SkThreadUtils_win.cpp
index 07cceee..0da339a 100644
--- a/src/utils/SkThreadUtils_win.cpp
+++ b/src/utils/SkThreadUtils_win.cpp
@@ -6,6 +6,7 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkThreadUtils.h"
#include "SkThreadUtils_win.h"
@@ -96,3 +97,5 @@
WaitForSingleObject(winData->fHandle, INFINITE);
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/mac/SkCreateCGImageRef.cpp b/src/utils/mac/SkCreateCGImageRef.cpp
index 0cbf704..3fd9057 100644
--- a/src/utils/mac/SkCreateCGImageRef.cpp
+++ b/src/utils/mac/SkCreateCGImageRef.cpp
@@ -5,6 +5,10 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+
#include "SkCGUtils.h"
#include "SkBitmap.h"
#include "SkColorPriv.h"
@@ -306,3 +310,5 @@
*dst = tmp;
return true;
}
+
+#endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
diff --git a/src/utils/mac/SkStream_mac.cpp b/src/utils/mac/SkStream_mac.cpp
index e62ced2..36e5194 100644
--- a/src/utils/mac/SkStream_mac.cpp
+++ b/src/utils/mac/SkStream_mac.cpp
@@ -5,6 +5,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+
#include "SkCGUtils.h"
#include "SkStream.h"
@@ -74,3 +77,5 @@
return CGDataProviderCreateWithData(data, data->data(), data->size(),
unref_proc);
}
+
+#endif//defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
diff --git a/src/utils/win/SkAutoCoInitialize.cpp b/src/utils/win/SkAutoCoInitialize.cpp
index 78326a5..83f23bd 100644
--- a/src/utils/win/SkAutoCoInitialize.cpp
+++ b/src/utils/win/SkAutoCoInitialize.cpp
@@ -6,6 +6,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -27,3 +30,5 @@
bool SkAutoCoInitialize::succeeded() {
return SUCCEEDED(this->fHR) || RPC_E_CHANGED_MODE == this->fHR;
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp
index 2254961..2fdd611 100644
--- a/src/utils/win/SkDWrite.cpp
+++ b/src/utils/win/SkDWrite.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkDWrite.h"
#include "SkHRESULT.h"
@@ -122,3 +124,5 @@
}
return S_OK;
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index 0e3d4fc..d4bf8a2 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkTypes.h"
#include "SkDWriteFontFileStream.h"
@@ -229,3 +231,5 @@
*lastWriteTime = 0;
return E_NOTIMPL;
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/win/SkDWriteGeometrySink.cpp b/src/utils/win/SkDWriteGeometrySink.cpp
index 066d4a4..9f6a97c 100644
--- a/src/utils/win/SkDWriteGeometrySink.cpp
+++ b/src/utils/win/SkDWriteGeometrySink.cpp
@@ -6,6 +6,7 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkDWriteGeometrySink.h"
#include "SkFloatUtils.h"
@@ -144,3 +145,5 @@
*geometryToPath = new SkDWriteGeometrySink(path);
return S_OK;
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/win/SkHRESULT.cpp b/src/utils/win/SkHRESULT.cpp
index d565986..d956299 100644
--- a/src/utils/win/SkHRESULT.cpp
+++ b/src/utils/win/SkHRESULT.cpp
@@ -6,6 +6,7 @@
*/
#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#include "SkHRESULT.h"
@@ -35,3 +36,5 @@
errorText = nullptr;
}
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/win/SkIStream.cpp b/src/utils/win/SkIStream.cpp
index f1dbcb2..fdb6ce6 100644
--- a/src/utils/win/SkIStream.cpp
+++ b/src/utils/win/SkIStream.cpp
@@ -6,6 +6,8 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -275,3 +277,4 @@
pStatstg->grfMode = STGM_WRITE;
return S_OK;
}
+#endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index ef07bea..bc22795 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -6,6 +6,9 @@
* found in the LICENSE file.
*/
+#include "SkTypes.h"
+#if defined(SK_BUILD_FOR_WIN32)
+
#include "SkWGL.h"
#include "SkTDArray.h"
@@ -455,3 +458,5 @@
, fDC(dc)
, fGLRC(glrc) {
}
+
+#endif//defined(SK_BUILD_FOR_WIN32)