Skip to content

Commit e1e7ca5

Browse files
committed
Merge branch 'm132-public' into SkRuntimeEffect-binding
2 parents a34686e + ef51e6d commit e1e7ca5

10 files changed

+214
-9
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
key: linux-aarch64-skia-${{ github.sha }}-3rd-party
2626
- name: Pre-fetch skia deps
2727
if: ${{ steps.cache-skia.outputs.cache-hit != 'true' }}
28-
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m131-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m131-minimize-download.patch
28+
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m132-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m132-minimize-download.patch
2929
- name: Set up QEMU
3030
uses: docker/setup-qemu-action@v3
3131
- name: Build skia 3rd-Party

patch/skia-m132-colrv1-freetype.diff

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
diff --git a/src/core/SkFontDescriptor.h b/src/core/SkFontDescriptor.h
2+
index a3018ee..5eadbed 100644
3+
--- a/src/core/SkFontDescriptor.h
4+
+++ b/src/core/SkFontDescriptor.h
5+
@@ -82,7 +82,7 @@ private:
6+
skia_private::AutoSTMalloc<4, SkFontArguments::Palette::Override> fPaletteOverrides;
7+
};
8+
9+
-class SkFontDescriptor : SkNoncopyable {
10+
+class SK_SPI SkFontDescriptor : SkNoncopyable {
11+
public:
12+
SkFontDescriptor();
13+
// Does not affect ownership of SkStream.
14+
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
15+
index 7798b91..7637709 100644
16+
--- a/src/ports/SkFontHost_FreeType.cpp
17+
+++ b/src/ports/SkFontHost_FreeType.cpp
18+
@@ -32,7 +32,6 @@
19+
#include "src/core/SkMask.h"
20+
#include "src/core/SkMaskGamma.h"
21+
#include "src/core/SkScalerContext.h"
22+
-#include "src/ports/SkFontHost_FreeType_common.h"
23+
#include "src/ports/SkFontScanner_FreeType_priv.h"
24+
#include "src/ports/SkTypeface_FreeType.h"
25+
#include "src/sfnt/SkOTUtils.h"
26+
@@ -52,6 +51,7 @@
27+
#ifdef FT_COLOR_H // 2.10.0
28+
# include <freetype/ftcolor.h>
29+
#endif
30+
+#include "src/ports/SkFontHost_FreeType_common.h"
31+
#include <freetype/freetype.h>
32+
#include <freetype/ftlcdfil.h>
33+
#include <freetype/ftmodapi.h>
34+
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
35+
index be5bc52..12bd7fe 100644
36+
--- a/src/ports/SkFontHost_FreeType_common.cpp
37+
+++ b/src/ports/SkFontHost_FreeType_common.cpp
38+
@@ -6,7 +6,6 @@
39+
* found in the LICENSE file.
40+
*/
41+
42+
-#include "src/ports/SkFontHost_FreeType_common.h"
43+
44+
#include "include/core/SkBitmap.h"
45+
#include "include/core/SkCanvas.h"
46+
@@ -34,6 +33,7 @@
47+
#ifdef FT_COLOR_H
48+
# include <freetype/ftcolor.h>
49+
#endif
50+
+#include "src/ports/SkFontHost_FreeType_common.h"
51+
#include <freetype/ftimage.h>
52+
#include <freetype/ftoutln.h>
53+
#include <freetype/ftsizes.h>
54+
@@ -1575,6 +1575,41 @@ bool SkScalerContextFTUtils::drawCOLRv1Glyph(FT_Face face, const SkGlyph& glyph,
55+
face, glyph.getGlyphID(),
56+
FT_COLOR_INCLUDE_ROOT_TRANSFORM, &activePaints);
57+
}
58+
+/*
59+
+ * This content is mostly just
60+
+ * SkTypeface_FreeType::FaceRec::setupPalette()
61+
+ + + SkScalerContext_FreeType_Base::drawCOLRv1Glyph()
62+
+ +*/
63+
+bool SkScalerContextFTUtils::skia_colrv1_start_glyph(SkCanvas* canvas,
64+
+ FT_Face face,
65+
+ uint16_t glyphId,
66+
+ FT_UShort palette_index,
67+
+ FT_Color_Root_Transform rootTransform
68+
+ ) {
69+
+ uint32_t fForegroundColor{SK_ColorBLACK};
70+
+ FT_Palette_Data paletteData;
71+
+ FT_Palette_Data_Get(face, &paletteData);
72+
+
73+
+ FT_Color* ftPalette = nullptr;
74+
+ FT_Palette_Select(face, palette_index, &ftPalette);
75+
+ std::unique_ptr<SkColor[]> ptr_palette(new SkColor[paletteData.num_palette_entries]);
76+
+ for (int i = 0; i < paletteData.num_palette_entries; ++i) {
77+
+ ptr_palette[i] = SkColorSetARGB(ftPalette[i].alpha,
78+
+ ftPalette[i].red,
79+
+ ftPalette[i].green,
80+
+ ftPalette[i].blue);
81+
+ }
82+
+ SkSpan<SkColor> palette(ptr_palette.get(), paletteData.num_palette_entries);
83+
+
84+
+ VisitedSet activePaints;
85+
+ bool haveLayers = colrv1_start_glyph(canvas, palette,
86+
+ fForegroundColor, // FT_Palette_Get_Foreground_Color?
87+
+ face, glyphId,
88+
+ FT_COLOR_INCLUDE_ROOT_TRANSFORM,
89+
+ &activePaints);
90+
+ SkASSERTF(haveLayers, "Could not get COLRv1 layers from '%s'.", face->family_name);
91+
+ return haveLayers;
92+
+}
93+
#endif // TT_SUPPORT_COLRV1
94+
95+
#ifdef FT_COLOR_H
96+
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
97+
index cd19ec7..40842c5 100644
98+
--- a/src/ports/SkFontHost_FreeType_common.h
99+
+++ b/src/ports/SkFontHost_FreeType_common.h
100+
@@ -20,6 +20,7 @@ class SkCanvas;
101+
// These are forward declared to avoid pimpl but also hide the FreeType implementation.
102+
typedef struct FT_FaceRec_* FT_Face;
103+
typedef signed long FT_Pos;
104+
+typedef unsigned short FT_UShort; /* freetype/fttypes.h */
105+
106+
107+
#ifdef SK_DEBUG
108+
@@ -31,7 +32,13 @@ const char* SkTraceFtrGetError(int);
109+
#define SK_TRACEFTR(ERR, ...) do { sk_ignore_unused_variable(ERR); } while (false)
110+
#endif
111+
112+
-struct SkScalerContextFTUtils {
113+
+struct SK_SPI SkScalerContextFTUtils {
114+
+ static bool skia_colrv1_start_glyph(SkCanvas* canvas,
115+
+ FT_Face face,
116+
+ uint16_t glyphId,
117+
+ FT_UShort palette_index,
118+
+ FT_Color_Root_Transform rootTransform
119+
+ );
120+
SkColor fForegroundColor;
121+
SkScalerContext::Flags fFlags;
122+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
diff --git a/DEPS b/DEPS
2+
index 16d496c..eb6a7cb 100644
3+
--- a/DEPS
4+
+++ b/DEPS
5+
@@ -31,53 +31,18 @@ vars = {
6+
# ./tools/git-sync-deps
7+
deps = {
8+
"buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@b138e6ce86ae843c42a1a08f37903207bebcca75",
9+
- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@7fea539cc99bed8fd315cfbc5026952a133ac3ae",
10+
- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8",
11+
- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b",
12+
- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting.
13+
- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well.
14+
- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@2a86250e561c56e9b1b9af5774f1253d9d66be97",
15+
- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07",
16+
- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794",
17+
- "third_party/externals/abseil-cpp" : "https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git@65a55c2ba891f6d2492477707f4a2e327a0b40dc",
18+
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123",
19+
- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe",
20+
- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@a896e3d066448b3530dbcaa48869fafefd738f57",
21+
"third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@624da0f593bb8d7e146b9f42b06d8e6c80d032a3",
22+
"third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@83af801b552111e37d9466a887e1783a0fb5f196",
23+
"third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@a070f9ebbe88dc71b248af9731dd49ec93f4e6e6",
24+
- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0",
25+
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4",
26+
- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13",
27+
- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456",
28+
- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000",
29+
- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1",
30+
- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0",
31+
"third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@ccfbe1c82a3b6dbe8647ceb36a3f9ee711fba3cf",
32+
- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3",
33+
"third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429",
34+
"third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f",
35+
- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96",
36+
- "third_party/externals/microhttpd" : "https://android.googlesource.com/platform/external/libmicrohttpd@748945ec6f1c67b7efc934ab0808e1d32f2fb98d",
37+
- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419",
38+
- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553",
39+
- "third_party/externals/partition_alloc" : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@ce13777cb731e0a60c606d1741091fd11a0574d7",
40+
- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394",
41+
"third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406",
42+
- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@76855a9baecc97fa144ce70d7ae43a9f878e14c8",
43+
"third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191",
44+
- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories.
45+
- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well.
46+
"third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@a2dfb2276ea5f9467eb84c9a19ecf917d92e4135",
47+
- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3",
48+
"third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@996c728cf7dcfb29845cfa15222822318f047810",
49+
- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@9117e042b93d4ff08d2406542708170f77aaa2a3",
50+
- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@3ee3bea02164c5a816fe6c16ef4e3a810edb7620",
51+
- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@cbcad3c0587dddc768d76641ea00f5c45ab5a278",
52+
- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@15f2de809304aba619ee327f3273425418ca83de",
53+
- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@87ab6b39a97d084a2ef27db85e3cbaf5d2622a09",
54+
- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095",
55+
- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
56+
"third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8",
57+
"third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596",
58+
59+
diff --git a/bin/activate-emsdk b/bin/activate-emsdk
60+
index 687ca9f..7167d8d 100755
61+
--- a/bin/activate-emsdk
62+
+++ b/bin/activate-emsdk
63+
@@ -17,6 +17,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')
64+
EMSDK_VERSION = '3.1.44'
65+
66+
def main():
67+
+ return
68+
if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']:
69+
# This platform cannot install emsdk at the provided version. See
70+
# https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5

scripts/build_Linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ git clone https://gn.googlesource.com/gn && \
6060

6161
# Build skia
6262
cd skia && \
63-
patch -p1 < ../patch/skia-m131-minimize-download.patch && \
64-
patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \
63+
patch -p1 < ../patch/skia-m132-minimize-download.patch && \
64+
patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \
6565
python3 tools/git-sync-deps && \
6666
cp -f ../gn/out/gn bin/gn && \
6767
bin/gn gen out/Release --args="

scripts/build_Windows.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export PATH="${PWD}/depot_tools:$PATH"
44

55
# Build skia
66
cd skia && \
7-
patch -p1 < ../patch/skia-m131-minimize-download.patch && \
8-
patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \
7+
patch -p1 < ../patch/skia-m132-minimize-download.patch && \
8+
patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \
99
python tools/git-sync-deps && \
1010
bin/gn gen out/Release --args='
1111
is_official_build=true

scripts/build_macOS.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ function apply_patch {
2222
}
2323

2424
cd skia && \
25-
patch -p1 < ../patch/skia-m131-minimize-download.patch && \
26-
patch -p1 < ../patch/skia-m123-colrv1-freetype.diff && \
25+
patch -p1 < ../patch/skia-m132-minimize-download.patch && \
26+
patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \
2727
python3 tools/git-sync-deps && \
2828
bin/gn gen out/Release --args="
2929
is_official_build=true

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
pass
1313

1414
NAME = 'skia-python'
15-
__version__ = '131.0b10'
15+
__version__ = '132.0b11'
1616

1717
SKIA_PATH = os.getenv('SKIA_PATH', 'skia')
1818
SKIA_OUT_PATH = os.getenv(

skia

Submodule skia updated from f7f63e2 to b1fb88a

src/skia/PathEffect.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ py::class_<SkPathEffect, sk_sp<SkPathEffect>, SkFlattenable>
138138
~skia.TrimPathEffect
139139
)docstring");
140140

141+
/* SkPathEffect::DashInfo withdrawn from public API in m132 */
142+
/*
141143
py::class_<SkPathEffect::DashInfo>(patheffect, "DashInfo")
142144
.def(py::init<>())
143145
.def_property_readonly("fIntervals",
@@ -160,6 +162,7 @@ py::class_<SkPathEffect::DashInfo>(patheffect, "DashInfo")
160162
Offset into the dashed interval pattern.
161163
)docstring")
162164
;
165+
*/
163166

164167
/*
165168
py::class_<SkPathEffect::PointData> pointdata(patheffect, "PointData",
@@ -195,6 +198,8 @@ pointdata
195198
;
196199
*/
197200

201+
/* SkPathEffect::DashType withdrawn from public API in m132 */
202+
/*
198203
py::enum_<SkPathEffect::DashType>(patheffect, "DashType",
199204
R"docstring(
200205
If the :py:class:`PathEffect` can be represented as a dash pattern, asADash
@@ -215,6 +220,7 @@ py::enum_<SkPathEffect::DashType>(patheffect, "DashType",
215220
.value("kDash_DashType", SkPathEffect::DashType::kDash_DashType,
216221
"fills in all of the info parameter")
217222
.export_values();
223+
*/
218224

219225
patheffect
220226
.def("filterPath", py::overload_cast<SkPath*, const SkPath&, SkStrokeRec*, const SkRect*>(&SkPathEffect::filterPath, py::const_),
@@ -251,7 +257,10 @@ patheffect
251257
py::arg("results"), py::arg("src"), py::arg("stroke_rec"),
252258
py::arg("matrix"), py::arg("cullR"))
253259
*/
260+
/* SkPathEffect::asADash withdrawn from public API in m132 */
261+
/*
254262
.def("asADash", &SkPathEffect::asADash, py::arg("info"))
263+
*/
255264
.def_static("MakeSum",
256265
[] (const SkPathEffect& first, const SkPathEffect& second) {
257266
auto first_ = first.serialize();

tests/test_patheffect.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,17 @@ def patheffect_dashinfo():
104104
return skia.PathEffect.DashInfo()
105105

106106

107+
@pytest.mark.xfail(reason='Withdrawn from public API in m132')
107108
def test_PathEffect_DashInfo_fIntervals(patheffect_dashinfo):
108109
assert isinstance(patheffect_dashinfo.fIntervals, list)
109110

110111

112+
@pytest.mark.xfail(reason='Withdrawn from public API in m132')
111113
def test_PathEffect_DashInfo_fCount(patheffect_dashinfo):
112114
assert isinstance(patheffect_dashinfo.fCount, int)
113115

114116

117+
@pytest.mark.xfail(reason='Withdrawn from public API in m132')
115118
def test_PathEffect_DashInfo_fPhase(patheffect_dashinfo):
116119
assert isinstance(patheffect_dashinfo.fPhase, float)
117120

@@ -191,6 +194,7 @@ def test_PathEffect_asPoints(patheffect):
191194
patheffect.asPoints(results, path, rec, matrix, None), bool)
192195

193196

197+
@pytest.mark.xfail(reason='Withdrawn from public API in m132')
194198
def test_PathEffect_asADash(patheffect):
195199
dashinfo = skia.PathEffect.DashInfo()
196200
assert isinstance(patheffect.asADash(dashinfo), skia.PathEffect.DashType)

0 commit comments

Comments
 (0)