[Libreoffice-commits] core.git: external/skia vcl/skia
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 31 09:04:25 UTC 2020
external/skia/Library_skia.mk | 5 +++
external/skia/UnpackedTarball_skia.mk | 1
external/skia/windows-force-unicode-api.patch.0 | 31 ++++++++++++++++++++++++
vcl/skia/win/gdiimpl.cxx | 12 +--------
4 files changed, 39 insertions(+), 10 deletions(-)
New commits:
commit 7392abbe587cfe4d1547646e5cf2358e4f749981
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Mar 30 12:34:20 2020 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Mar 31 11:03:51 2020 +0200
build Skia on Windows with UNICODE set
Skia uses the Windows generic macros that map to the ANSI *A variants
or the unicode *W variants of functions/types, but in LO code we
mostly use explicitly the *W variants and do not set the UNICODE
define. So build Skia with UNICODE and explicitly use *W API
in SKia's API that we use.
Change-Id: I689797b30a412820f97d9ce88e9fe078ead2cf76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91376
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/external/skia/Library_skia.mk b/external/skia/Library_skia.mk
index a86c415339d3..62285ca09f8b 100644
--- a/external/skia/Library_skia.mk
+++ b/external/skia/Library_skia.mk
@@ -22,6 +22,11 @@ $(eval $(call gb_Library_add_defs,skia,\
))
ifeq ($(OS),WNT)
+# Skia can be built with or without UNICODE set, in LO sources we explicitly use the *W unicode
+# variants, so build Skia with UNICODE to make it also use the *W variants.
+$(eval $(call gb_Library_add_defs,skia,\
+ -DUNICODE -D_UNICODE \
+))
ifneq ($(gb_ENABLE_PCH),)
$(eval $(call gb_Library_add_cxxflags,skia, \
-FIsrc/utils/win/SkDWriteNTDDI_VERSION.h \
diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index 63ab183e3ebf..8e0df446af95 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -31,6 +31,7 @@ skia_patches := \
fontconfig-get-typeface.patch.0 \
windows-do-not-modify-logfont.patch.0 \
windows-text-gamma.patch.0 \
+ windows-force-unicode-api.patch.0 \
$(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
diff --git a/external/skia/windows-force-unicode-api.patch.0 b/external/skia/windows-force-unicode-api.patch.0
new file mode 100644
index 000000000000..f73de176dff3
--- /dev/null
+++ b/external/skia/windows-force-unicode-api.patch.0
@@ -0,0 +1,31 @@
+diff --git a/include/ports/SkTypeface_win.h b/include/ports/SkTypeface_win.h
+index f659adf0e9..34446fc7a1 100644
+--- ./include/ports/SkTypeface_win.h
++++ ./include/ports/SkTypeface_win.h
+@@ -26,7 +26,7 @@ typedef LOGFONTA LOGFONT;
+ * corresponding typeface for the specified logfont. The caller is responsible
+ * for calling unref() when it is finished.
+ */
+-SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&);
++SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONTW&);
+
+ /**
+ * Copy the LOGFONT associated with this typeface into the lf parameter. Note
+@@ -34,7 +34,7 @@ SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&);
+ * not track this (the paint does).
+ * typeface may be NULL, in which case we return the logfont for the default font.
+ */
+-SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf);
++SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONTW* lf);
+
+ /**
+ * Set an optional callback to ensure that the data behind a LOGFONT is loaded.
+@@ -42,7 +42,7 @@ SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf);
+ * Normally this is null, and is only required if the font data needs to be
+ * remotely (re)loaded.
+ */
+-SK_API void SkTypeface_SetEnsureLOGFONTAccessibleProc(void (*)(const LOGFONT&));
++SK_API void SkTypeface_SetEnsureLOGFONTAccessibleProc(void (*)(const LOGFONTW&));
+
+ // Experimental!
+ //
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index e7d0b576e37a..c90185b3e4bf 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -117,16 +117,8 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout)
assert(dynamic_cast<const WinFontInstance*>(&rLayout.GetFont()));
const WinFontInstance* pWinFont = static_cast<const WinFontInstance*>(&rLayout.GetFont());
const HFONT hLayoutFont = pWinFont->GetHFONT();
- LOGFONT logFont;
-// Bring back GetObject that got #undef-ed in include/postwin.hxx .
-// The GetObjectA/W() functions are type-unsafe, so they should match the LOGFONTA/W,
-// otherwise the font name will be incorrect and Skia will choose an incorrect font.
-#ifdef UNICODE
-#define GetObject GetObjectW
-#else
-#define GetObject GetObjectA
-#endif
- if (GetObject(hLayoutFont, sizeof(logFont), &logFont) == 0)
+ LOGFONTW logFont;
+ if (GetObjectW(hLayoutFont, sizeof(logFont), &logFont) == 0)
{
assert(false);
return false;
More information about the Libreoffice-commits
mailing list