Add UWP support

Bug: skia:11102
Change-Id: I4ed9e44099cd780c5cdede3eb179c0e6a92d3ce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345219
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Chris Bracken <cbracken@google.com>
This commit is contained in:
James Clarke 2021-02-09 06:22:41 -08:00 committed by Skia Commit-Bot
parent a0e407d4b7
commit b8c0dab90b
7 changed files with 34 additions and 8 deletions

View File

@ -30,6 +30,7 @@ Igalia <*@igalia.com>
Intel <*@intel.com>
Ion Rosca <rosca@adobe.com>
Jacek Caban <cjacek@gmail.com>
James Clarke <james@clarkezone.io>
Jeff Muizelaar <jmuizelaar@mozilla.com>
Jongdeok Kim <jongdeok.kim@navercorp.com>
Lee Salzman <lsalzman@mozilla.com>
@ -69,4 +70,4 @@ Zhuo Qingliang <zhuo.dev@gmail.com>
Mainframe North <*@mainframe.co.uk>
JetBrains <*@jetbrains.com>
Vibe Inc <*@vibe.us>
Scene Group Ltd. <*@scenegroup.co>
Scene Group Ltd. <*@scenegroup.co>

View File

@ -94,6 +94,12 @@ config("skia_private") {
}
}
config("skia_winuwp") {
if (skia_enable_winuwp) {
defines = [ "WINUWP" ]
}
}
# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
config("skia_library") {
visibility = [ "./*" ]
@ -248,6 +254,7 @@ template("optional") {
if (defined(invoker.public_include_dirs)) {
include_dirs = invoker.public_include_dirs
}
configs = [ ":skia_winuwp" ]
}
source_set(target_name) {
check_includes = false
@ -263,6 +270,7 @@ template("optional") {
if (defined(invoker.configs_to_remove)) {
configs -= invoker.configs_to_remove
}
configs += [ ":skia_winuwp" ]
}
} else {
source_set(target_name) {
@ -283,6 +291,7 @@ template("optional") {
sources = invoker.sources_when_disabled
}
configs += skia_library_configs
configs += [ ":skia_winuwp" ]
}
}
}
@ -864,7 +873,7 @@ optional("gpu") {
sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
} else if (is_ios) {
sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
} else if (is_win) {
} else if (is_win && !skia_enable_winuwp) {
sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
if (target_cpu != "arm64") {
libs += [ "OpenGL32.lib" ]
@ -1284,12 +1293,17 @@ component("skia") {
"src/ports/SkOSLibrary_win.cpp",
]
libs += [
"FontSub.lib",
"Ole32.lib",
"OleAut32.lib",
"User32.lib",
"Usp10.lib",
]
if (!skia_enable_winuwp) {
libs += [
"FontSub.lib",
"User32.lib",
"Usp10.lib",
]
}
} else {
sources += [
"src/ports/SkOSFile_posix.cpp",
@ -1842,7 +1856,7 @@ if (skia_enable_tools) {
sources += [ "tools/AutoreleasePool.mm" ]
frameworks += [ "Foundation.framework" ]
}
} else if (is_win) {
} else if (is_win && !skia_enable_winuwp) {
libs += [ "DbgHelp.lib" ]
}

View File

@ -19,7 +19,6 @@ declare_args() {
skia_enable_fontmgr_empty = false
skia_enable_fontmgr_fuchsia = is_fuchsia
skia_enable_fontmgr_win = is_win
skia_enable_fontmgr_win_gdi = is_win
skia_enable_gpu = true
skia_enable_icu_ubrk_safeclone = false
skia_enable_pdf = true
@ -29,6 +28,7 @@ declare_args() {
skia_enable_svg = true
skia_enable_tools = is_skia_dev_build
skia_enable_gpu_debug_layers = is_skia_dev_build && is_debug
skia_enable_winuwp = false
skia_generate_workarounds = false
skia_include_multiframe_procs = false
skia_lex = false
@ -106,6 +106,7 @@ declare_args() {
skia_enable_fontmgr_custom_embedded = skia_use_freetype && !is_fuchsia
skia_enable_fontmgr_custom_empty = skia_use_freetype
skia_enable_fontmgr_fontconfig = skia_use_freetype && skia_use_fontconfig
skia_enable_fontmgr_win_gdi = is_win && !skia_enable_winuwp
skia_enable_fontmgr_FontConfigInterface =
skia_use_freetype && skia_use_fontconfig
skia_enable_nvpr = !skia_enable_flutter_defines

View File

@ -1288,12 +1288,15 @@ SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWrite(IDWriteFactory* factory,
int defaultFamilyNameLen = 1;
NONCLIENTMETRICSW metrics;
metrics.cbSize = sizeof(metrics);
#ifndef SK_WINUWP
if (nullptr == fallback) {
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(metrics), &metrics, 0)) {
defaultFamilyName = metrics.lfMessageFont.lfFaceName;
defaultFamilyNameLen = LF_FACESIZE;
}
}
#endif //SK_WINUWP
WCHAR localeNameStorage[LOCALE_NAME_MAX_LENGTH];
const WCHAR* localeName = L"";

View File

@ -6,7 +6,7 @@
*/
#include "include/core/SkTypes.h"
#if defined(SK_BUILD_FOR_WIN) && !defined(_M_ARM64)
#if defined(SK_BUILD_FOR_WIN) && !defined(_M_ARM64) && !defined(WINUWP)
#include "src/utils/win/SkWGL.h"

View File

@ -318,6 +318,10 @@ bool SkXPSDevice::endSheet() {
}
static HRESULT subset_typeface(const SkXPSDevice::TypefaceUse& current) {
//The CreateFontPackage API is only supported on desktop, not in UWP
#ifdef SK_WINUWP
return E_NOTIMPL;
#else
//CreateFontPackage wants unsigned short.
//Microsoft, Y U NO stdint.h?
std::vector<unsigned short> keepList;
@ -410,6 +414,7 @@ static HRESULT subset_typeface(const SkXPSDevice::TypefaceUse& current) {
"Could not set new stream for subsetted font.");
return S_OK;
#endif //SK_WINUWP
}
bool SkXPSDevice::endPortfolio() {

View File

@ -205,6 +205,7 @@
const DWORD machineType = IMAGE_FILE_MACHINE_ARM64;
#endif
#if !defined(SK_WINUWP)
while (StackWalk64(machineType,
GetCurrentProcess(),
GetCurrentThread(),
@ -231,6 +232,7 @@
SkDebugf("%s +%x\n", symbol->Name, offset);
}
#endif //SK_WINUWP
// Exit NOW. Don't notify other threads, don't call anything registered with atexit().
_exit(1);