From d59ac5e32c7f5eb9b672ec166d715a2ad56ceb3a Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 25 Jun 2025 17:58:06 +0100 Subject: [PATCH 01/43] Roll skia on m138 (canvaskit/0.40.0-456-g114d33c629 to canvaskit/0.40.0-457-ga46d5732d9) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index 114d33c6..a46d5732 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 114d33c62998ce5c16f899b9123c22000ca06ddd +Subproject commit a46d5732d9fca93eaec23e502e2eef814b707e6b From 45ece541eabb80d8b08c40e14720e5de2f3c7b72 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 25 Jun 2025 17:59:23 +0100 Subject: [PATCH 02/43] Upgrade skia to m139 (canvaskit/0.40.0-457-ga46d5732d9 to canvaskit/0.40.0-787-g0f94c19331) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index a46d5732..0f94c193 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit a46d5732d9fca93eaec23e502e2eef814b707e6b +Subproject commit 0f94c19331c51259e23bee547b2657b5ad7dff26 From 28d707bd1598e0e2060be461d62d489ea086d1ad Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 25 Jun 2025 18:03:50 +0100 Subject: [PATCH 03/43] Bump version up to 139.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f0e2b708..bbaf710a 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ pass NAME = 'skia-python' -__version__ = '138.0' +__version__ = '139.0' SKIA_PATH = os.getenv('SKIA_PATH', 'skia') SKIA_OUT_PATH = os.getenv( From 76c1c520ebf516c715e74ff1d633a3ddfe340c5e Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 25 Jun 2025 18:11:08 +0100 Subject: [PATCH 04/43] m139 patch plus adjustments --- patch/skia-m139-minimize-download.patch | 70 +++++++++++++++++++++++++ scripts/build_Linux.sh | 2 +- scripts/build_Windows.sh | 2 +- scripts/build_macOS.sh | 2 +- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 patch/skia-m139-minimize-download.patch diff --git a/patch/skia-m139-minimize-download.patch b/patch/skia-m139-minimize-download.patch new file mode 100644 index 00000000..0ac82872 --- /dev/null +++ b/patch/skia-m139-minimize-download.patch @@ -0,0 +1,70 @@ +diff --git a/DEPS b/DEPS +index 6b685a0..c2f3e74 100644 +--- a/DEPS ++++ b/DEPS +@@ -31,53 +31,18 @@ vars = { + # ./tools/git-sync-deps + deps = { + "buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@729495f2ffa69080907780591fa2a630b2556e98", +- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@5220e634850ec26f4b4b0f305ba2a69cf0bc55df", +- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8", +- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", +- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting. +- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well. +- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@d03fe7eda12dfce1578bf69da2814f89fd78c1e9", +- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07", +- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794", +- "third_party/externals/abseil-cpp" : "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp@04dc59d2c83238cb1fcb49083e5e416643a899ce", +- "third_party/externals/delaunator-cpp" : "https://skia.googlesource.com/external/github.com/skia-dev/delaunator-cpp.git@98305ef6c4e862f7d48df9cc647b690d796fec68", + "third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@dbe0a676450d9b8c71bf00688bb306409b779e90", +- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe", +- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@a896e3d066448b3530dbcaa48869fafefd738f57", + "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@8e49998f003d693213b538ef765814c7d21abada", + "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@1518bc83d26b434031bd12c706ac3c7dab3902fd", + "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@08b52ae2e44931eef163dbad71697f911fadc323", +- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0", + "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4", +- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13", +- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456", +- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000", +- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1", +- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0", + "third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@e14cbfaa85529d47f9f55b0f104a579c1061f9ad", +- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", + "third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429", + "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f", +- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96", +- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419", +- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", +- "third_party/externals/partition_alloc" : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@ce13777cb731e0a60c606d1741091fd11a0574d7", +- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394", + "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", +- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@0ce9bc68d3fc995f76dcab4771c26471100ce759", + "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191", +- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories. +- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well. + "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@31127c60fb320a7eedf48289aa5c435bbb020659", +- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3", + "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@2a611a970fdbc41ac2e3e328802aed9985352dca", +- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@108b19e5c6979f496deffad4acbe354237afa7d3", +- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@3ee3bea02164c5a816fe6c16ef4e3a810edb7620", +- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@10739e8e00a7b6f74d22dd0a547f1406ff1f5eb9", +- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@e3fc64396755191b3c51e5c57d0454872e7fa487", +- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@72665ee1e50db3d949080df8d727dffa8067f5f8", +- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095", +- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4", + "third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8", + "third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596", + +diff --git a/bin/activate-emsdk b/bin/activate-emsdk +index 687ca9f..7167d8d 100755 +--- a/bin/activate-emsdk ++++ b/bin/activate-emsdk +@@ -17,6 +17,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py') + EMSDK_VERSION = '3.1.44' + + def main(): ++ return + if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']: + # This platform cannot install emsdk at the provided version. See + # https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5 diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index 461724a0..488aa66f 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -19,7 +19,7 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m138-minimize-download.patch && \ + patch -p1 < ../patch/skia-m139-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 < ../patch/skia-m132-egl-runtime.diff && \ python3 tools/git-sync-deps && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 85df523e..f6795c38 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -12,7 +12,7 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m138-minimize-download.patch && \ + patch -p1 < ../patch/skia-m139-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ patch -p1 < ../patch/0001-gn-Remove-msvc-env-setting.patch && \ diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 25869913..568a4662 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -22,7 +22,7 @@ function apply_patch { } cd skia && \ - patch -p1 < ../patch/skia-m138-minimize-download.patch && \ + patch -p1 < ../patch/skia-m139-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From d9b3d4fa42c73cc5b21cb43f667996c06a57ffbb Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 25 Jun 2025 22:18:41 +0100 Subject: [PATCH 05/43] m139 changes --- setup.py | 9 ++++++--- src/skia/Canvas.cpp | 8 ++++---- src/skia/Font.cpp | 32 ++++++++++++++++---------------- src/skia/Matrix.cpp | 12 +++++++----- src/skia/Path.cpp | 18 +++++++++--------- src/skia/PathEffect.cpp | 2 +- src/skia/Rect.cpp | 6 +++--- src/skia/SkTextOnPath.cpp | 7 +++---- src/skia/TextBlob.cpp | 10 +++++----- 9 files changed, 54 insertions(+), 50 deletions(-) diff --git a/setup.py b/setup.py index bbaf710a..ef51dfeb 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,8 @@ EXTRA_OBJECTS = list( ) + [os.path.join(SKIA_OUT_PATH, 'svg.lib'), os.path.join(SKIA_OUT_PATH, 'skresources.lib'), os.path.join(SKIA_OUT_PATH, 'skia.lib'), os.path.join(SKIA_OUT_PATH, 'skparagraph.lib'), os.path.join(SKIA_OUT_PATH, 'skshaper.lib'), - os.path.join(SKIA_OUT_PATH, 'skunicode_icu.lib'), os.path.join(SKIA_OUT_PATH, 'skunicode_core.lib')] + os.path.join(SKIA_OUT_PATH, 'skunicode_icu.lib'), os.path.join(SKIA_OUT_PATH, 'skunicode_core.lib'), + os.path.join(SKIA_OUT_PATH, 'pathops.lib')] EXTRA_COMPILE_ARGS = [ '/std:c++17', # c++20 fails. '/DVERSION_INFO=%s' % __version__, @@ -69,7 +70,8 @@ EXTRA_OBJECTS = list( ) + [os.path.join(SKIA_OUT_PATH, 'libsvg.a'), os.path.join(SKIA_OUT_PATH, 'libskia.a'), os.path.join(SKIA_OUT_PATH, 'libskparagraph.a'), os.path.join(SKIA_OUT_PATH, 'libskshaper.a'), - os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a')] + os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a'), + os.path.join(SKIA_OUT_PATH, 'libpathops.a')] EXTRA_COMPILE_ARGS = [ '-std=c++17', '-stdlib=libc++', @@ -104,7 +106,8 @@ EXTRA_OBJECTS = list( ) + [os.path.join(SKIA_OUT_PATH, 'libsvg.a'), os.path.join(SKIA_OUT_PATH, 'libskresources.a'), os.path.join(SKIA_OUT_PATH, 'libskia.a'), os.path.join(SKIA_OUT_PATH, 'libskparagraph.a'), os.path.join(SKIA_OUT_PATH, 'libskshaper.a'), - os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a')] + os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a'), + os.path.join(SKIA_OUT_PATH, 'libpathops.a')] EXTRA_COMPILE_ARGS = [ '-std=c++17', '-fvisibility=hidden', diff --git a/src/skia/Canvas.cpp b/src/skia/Canvas.cpp index a87b4663..8957374d 100644 --- a/src/skia/Canvas.cpp +++ b/src/skia/Canvas.cpp @@ -1346,7 +1346,7 @@ canvas // &SkCanvas::drawPoints, [] (SkCanvas& canvas, SkCanvas::PointMode mode, const std::vector& points, const SkPaint &paint) { - canvas.drawPoints(mode, points.size(), &points[0], paint); + canvas.drawPoints(mode, {&points[0], points.size()}, paint); }, R"docstring( Draws pts using clip, :py:class:`Matrix` and :py:class:`Paint` @@ -2318,9 +2318,9 @@ canvas if (!colors.empty() && colors.size() != xform.size()) throw std::runtime_error( "colors must have the same length with xform."); - canvas.drawAtlas(atlas, &xform[0], &tex[0], - (colors.empty()) ? nullptr : &colors[0], - xform.size(), mode, options, cullRect, paint); + canvas.drawAtlas(atlas, {&xform[0], xform.size()}, {&tex[0], tex.size()}, + {(colors.empty()) ? nullptr : &colors[0], + colors.size()}, mode, options, cullRect, paint); }, R"docstring( Draws a set of sprites from atlas, using clip, :py:class:`Matrix`, and diff --git a/src/skia/Font.cpp b/src/skia/Font.cpp index ea31a519..9dd4e4b4 100644 --- a/src/skia/Font.cpp +++ b/src/skia/Font.cpp @@ -454,14 +454,14 @@ typeface )docstring") .def("getVariationDesignParameters", [] (const SkTypeface& typeface) { - auto count = typeface.getVariationDesignParameters(nullptr, 0); + auto count = typeface.getVariationDesignParameters({nullptr, 0}); if (count == -1) throw std::runtime_error("Failed to get; Likely no parameter"); std::vector params(count); if (count == 0) return params; auto actualCount = typeface.getVariationDesignParameters( - params.data(), params.size()); + {params.data(), params.size()}); if (actualCount == -1) throw std::runtime_error("Failed to get"); return params; @@ -474,12 +474,12 @@ typeface )docstring") .def("getVariationDesignPosition", [] (const SkTypeface& typeface) { - auto count = typeface.getVariationDesignPosition(nullptr, 0); + auto count = typeface.getVariationDesignPosition({nullptr, 0}); if (count == -1) throw std::runtime_error("Failed to get; Likely no position"); std::vector coords(count); auto actualCount = typeface.getVariationDesignPosition( - coords.data(), coords.size()); + {coords.data(), coords.size()}); if (actualCount == -1) throw std::runtime_error("Failed to get"); return coords; @@ -523,7 +523,7 @@ typeface .def("unicharsToGlyphs", [] (const SkTypeface& typeface, const std::vector& chars) { std::vector glyphs(chars.size()); - typeface.unicharsToGlyphs(&chars[0], chars.size(), &glyphs[0]); + typeface.unicharsToGlyphs({&chars[0], chars.size()}, {&glyphs[0], glyphs.size()}); return glyphs; }, R"docstring( @@ -555,7 +555,7 @@ typeface .def("getTableTags", [] (const SkTypeface& typeface) { std::vector tags(typeface.countTables()); - size_t size = typeface.getTableTags(&tags[0]); + size_t size = typeface.readTableTags({&tags[0], tags.size()}); if (size < tags.size()) throw std::runtime_error("Failed to get table tags."); return tags; @@ -612,7 +612,7 @@ typeface const std::vector& glyphs) -> py::object { std::vector adjustments(glyphs.size() - 1); auto result = typeface.getKerningPairAdjustments( - &glyphs[0], glyphs.size(), (glyphs.size() > 1) ? &adjustments[0] : nullptr); + {&glyphs[0], glyphs.size()}, {(glyphs.size() > 1) ? &adjustments[0] : nullptr, adjustments.size()}); if (!result) { // Kerning is not supported for this typeface. return py::none(); @@ -1314,7 +1314,7 @@ font int count = font.countText(&text[0], text.size(), encoding); std::vector glyphs(count); font.textToGlyphs( - &text[0], text.size(), encoding, &glyphs[0], glyphs.size()); + &text[0], text.size(), encoding, {&glyphs[0], glyphs.size()}); return glyphs; }, R"docstring( @@ -1354,7 +1354,7 @@ font .def("unicharsToGlyphs", [] (const SkFont& font, const std::vector& uni) { std::vector glyphs(uni.size()); - font.unicharsToGlyphs(&uni[0], uni.size(), &glyphs[0]); + font.unicharsToGlyphs({&uni[0], uni.size()}, {&glyphs[0], glyphs.size()}); return glyphs; }, py::arg("uni")) @@ -1401,7 +1401,7 @@ font .def("getWidths", [] (const SkFont& font, const std::vector& glyphs) { std::vector width(glyphs.size()); - font.getWidths(&glyphs[0], glyphs.size(), &width[0]); + font.getWidths({&glyphs[0], glyphs.size()}, {&width[0], width.size()}); return width; }, R"docstring( @@ -1417,7 +1417,7 @@ font std::vector width(glyphs.size()); std::vector bounds(glyphs.size()); font.getWidthsBounds( - &glyphs[0], glyphs.size(), &width[0], &bounds[0], paint); + {&glyphs[0], glyphs.size()}, {&width[0], width.size()}, {&bounds[0], bounds.size()}, paint); return py::make_tuple(width, bounds); }, R"docstring( @@ -1434,7 +1434,7 @@ font [] (const SkFont& font, const std::vector& glyphs, const SkPaint* paint) { std::vector bounds(glyphs.size()); - font.getBounds(&glyphs[0], glyphs.size(), &bounds[0], paint); + font.getBounds({&glyphs[0], glyphs.size()}, {&bounds[0], bounds.size()}, paint); return bounds; }, R"docstring( @@ -1454,7 +1454,7 @@ font [] (const SkFont& font, const std::vector& glyphs, const SkPoint& origin) { std::vector pos(glyphs.size()); - font.getPos(&glyphs[0], glyphs.size(), &pos[0], origin); + font.getPos({&glyphs[0], glyphs.size()}, {&pos[0], pos.size()}, origin); return pos; }, R"docstring( @@ -1472,7 +1472,7 @@ font [] (const SkFont& font, const std::vector& glyphs, const SkScalar& origin) { std::vector xpos(glyphs.size()); - font.getXPos(&glyphs[0], glyphs.size(), &xpos[0], origin); + font.getXPos({&glyphs[0], glyphs.size()}, {&xpos[0], xpos.size()}, origin); return xpos; }, R"docstring( @@ -1509,8 +1509,8 @@ font std::vector paths; paths.reserve(glyphIDs.size()); font.getPaths( - glyphIDs.data(), - glyphIDs.size(), + {glyphIDs.data(), + glyphIDs.size()}, [] (const SkPath* pathOrNull, const SkMatrix& mx, void* ctx) { auto paths_ = static_cast*>(ctx); if (pathOrNull) { diff --git a/src/skia/Matrix.cpp b/src/skia/Matrix.cpp index a0eb9128..62991092 100644 --- a/src/skia/Matrix.cpp +++ b/src/skia/Matrix.cpp @@ -1291,7 +1291,7 @@ matrix [] (const SkMatrix& matrix, std::vector& pts) { if (pts.empty()) return pts; - matrix.mapPoints(&pts[0], &pts[0], pts.size()); + matrix.mapPoints({&pts[0], pts.size()}, {&pts[0], pts.size()}); return pts; }, R"docstring( @@ -1325,7 +1325,7 @@ matrix [] (const SkMatrix& matrix, std::vector& pts) -> py::object { if (pts.empty()) return py::cast(pts); - matrix.mapHomogeneousPoints(&pts[0], &pts[0], pts.size()); + matrix.mapHomogeneousPoints({&pts[0], pts.size()}, {&pts[0], pts.size()}); return py::cast(pts); }, R"docstring( @@ -1354,7 +1354,7 @@ matrix if (pts.empty()) return py::cast(pts); std::vector dst(pts.size()); - matrix.mapHomogeneousPoints(&dst[0], &pts[0], pts.size()); + matrix.mapPointsToHomogeneous({&dst[0], dst.size()}, {&pts[0], pts.size()}); return py::cast(dst); }, R"docstring( @@ -1365,7 +1365,9 @@ matrix )docstring", py::arg("pts")) .def("mapXY", - py::overload_cast(&SkMatrix::mapXY, py::const_), + [] (const SkMatrix& matrix, SkScalar x, SkScalar y) { + return matrix.mapPoint({x, y}); + }, R"docstring( Returns :py:class:`Point` (x, y) multiplied by :py:class:`Matrix`. @@ -1390,7 +1392,7 @@ matrix [] (const SkMatrix& matrix, std::vector& src) { if (src.empty()) return src; - matrix.mapVectors(&src[0], &src[0], src.size()); + matrix.mapVectors({&src[0], src.size()}, {&src[0], src.size()}); return src; }, R"docstring( diff --git a/src/skia/Path.cpp b/src/skia/Path.cpp index 0190f680..8234ffc1 100644 --- a/src/skia/Path.cpp +++ b/src/skia/Path.cpp @@ -380,8 +380,8 @@ path SkPathFillType fillType, bool isVolatile) { return SkPath::Make( - points.data(), points.size(), verbs.data(), verbs.size(), - conicWeights.data(), conicWeights.size(), fillType, isVolatile); + {points.data(), points.size()}, {verbs.data(), verbs.size()}, + {conicWeights.data(), conicWeights.size()}, fillType, isVolatile); }, R"docstring( Create a new path with the specified segments. @@ -434,7 +434,7 @@ path [] (const std::vector& points, bool isClosed, SkPathFillType fillType, bool isVolatile) { return SkPath::Polygon( - points.data(), points.size(), isClosed, fillType, isVolatile); + {points.data(), points.size()}, isClosed, fillType, isVolatile); }, py::arg("points"), py::arg("isClosed"), py::arg_v("fillType", SkPathFillType::kWinding, "skia.PathFillType.kWinding"), @@ -710,7 +710,7 @@ path if (max == 0) max = path.countVerbs(); std::vector points(max); - auto length = path.getPoints(&points[0], max); + auto length = path.getPoints({&points[0], max}); if (length < max) points.erase(points.begin() + length, points.end()); return points; @@ -741,7 +741,7 @@ path if (max == 0) max = path.countVerbs(); std::vector verbs(max); - auto length = path.getVerbs(&verbs[0], max); + auto length = path.getVerbs({&verbs[0], max}); if (length < max) verbs.erase(verbs.begin() + length, verbs.end()); std::vector verbs_(verbs.size()); @@ -1604,7 +1604,7 @@ path << " elements)."; throw py::value_error(stream.str()); } - return path.addRoundRect(rect, &radii_[0], dir); + return path.addRoundRect(rect, {&radii_[0], radii_.size()}, dir); }, R"docstring( Appends :py:class:`RRect` to :py:class:`Path`, creating a new closed @@ -1658,7 +1658,7 @@ path py::arg("rrect"), py::arg("dir"), py::arg("start")) .def("addPoly", [] (SkPath& path, const std::vector& pts, bool close) { - return path.addPoly(&pts[0], pts.size(), close); + return path.addPoly({&pts[0], pts.size()}, close); }, R"docstring( Adds contour created from pts. @@ -2291,7 +2291,7 @@ PathBuilder .def("close", &SkPathBuilder::close) .def("polylineTo", [] (SkPathBuilder& self, const std::vector& points) { - return self.polylineTo(points.data(), points.size()); + return self.polylineTo({points.data(), points.size()}); }, R"docstring( Append a series of lineTo(...) @@ -2457,7 +2457,7 @@ PathBuilder .def("addPolygon", [] (SkPathBuilder& self, const std::vector& points, bool isClosed) { - return self.addPolygon(points.data(), points.size(), isClosed); + return self.addPolygon({points.data(), points.size()}, isClosed); }, py::arg("points"), py::arg("isClosed")) .def("incReserve", diff --git a/src/skia/PathEffect.cpp b/src/skia/PathEffect.cpp index a01f2e7d..376e1259 100644 --- a/src/skia/PathEffect.cpp +++ b/src/skia/PathEffect.cpp @@ -330,7 +330,7 @@ py::class_(m, "DashPathEffect") .def_static("Make", [] (const std::vector& intervals, SkScalar phase) { return SkDashPathEffect::Make( - &intervals[0], intervals.size(), phase); + {&intervals[0], intervals.size()}, phase); }, R"docstring( For example: if intervals[] = {10, 20}, count = 2, and phase = 25, this diff --git a/src/skia/Rect.cpp b/src/skia/Rect.cpp index 4585eaf5..11b3973f 100644 --- a/src/skia/Rect.cpp +++ b/src/skia/Rect.cpp @@ -868,7 +868,7 @@ py::class_(m, "Rect", R"docstring( py::arg("left"), py::arg("top"), py::arg("right"), py::arg("bottom")) .def("setBounds", [] (SkRect& rect, const std::vector& points) { - rect.setBounds(&points[0], points.size()); + rect.setBounds({&points[0], points.size()}); }, R"docstring( Sets to bounds of :py:class:`Point` array with count entries. @@ -884,7 +884,7 @@ py::class_(m, "Rect", R"docstring( py::arg("points")) .def("setBoundsCheck", [] (SkRect& rect, const std::vector& points) { - return rect.setBoundsCheck(&points[0], points.size()); + return rect.setBoundsCheck({&points[0], points.size()}); }, R"docstring( Sets to bounds of :py:class:`Point` array with count entries. @@ -902,7 +902,7 @@ py::class_(m, "Rect", R"docstring( py::arg("points")) .def("setBoundsNoCheck", [] (SkRect& rect, const std::vector& points) { - rect.setBoundsNoCheck(&points[0], points.size()); + rect.setBoundsNoCheck({&points[0], points.size()}); }, R"docstring( Sets to bounds of :py:class:`Point` pts array with count entries. diff --git a/src/skia/SkTextOnPath.cpp b/src/skia/SkTextOnPath.cpp index fd3cc884..06c15e09 100644 --- a/src/skia/SkTextOnPath.cpp +++ b/src/skia/SkTextOnPath.cpp @@ -17,10 +17,9 @@ static void morphpoints(SkPoint dst[], const SkPoint src[], int count, SkPathMeasure& meas, const SkMatrix& matrix) { for (int i = 0; i < count; i++) { - SkPoint pos; SkVector tangent; - matrix.mapXY(src[i].fX, src[i].fY, &pos); + SkPoint pos = matrix.mapPoint({src[i].fX, src[i].fY}); SkScalar sx = pos.fX; SkScalar sy = pos.fY; @@ -101,9 +100,9 @@ void SkVisitTextOnPath(const void* text, size_t byteLength, const SkPaint& paint int glyphCount = font.countText(text, byteLength, SkTextEncoding::kUTF8); if (glyphCount <= 0) return; std::vector glyphs(glyphCount); - font.textToGlyphs(text, byteLength, SkTextEncoding::kUTF8, glyphs.data(), glyphCount); + font.textToGlyphs(text, byteLength, SkTextEncoding::kUTF8, {glyphs.data(), glyphCount}); std::vector advances(glyphCount); - font.getWidths(glyphs.data(), glyphCount, advances.data()); + font.getWidths({glyphs.data(), glyphCount}, {advances.data(), advances.size()}); // Prepare path measuring SkPathMeasure meas(follow, false); diff --git a/src/skia/TextBlob.cpp b/src/skia/TextBlob.cpp index 8994b642..558b3c6d 100644 --- a/src/skia/TextBlob.cpp +++ b/src/skia/TextBlob.cpp @@ -94,7 +94,7 @@ textblob "len(text) = {} does not match len(pos) = {}").format( count, pos_.size())); return SkTextBlob::MakeFromPosText( - text.c_str(), text.size(), &pos_[0], font, encoding); + text.c_str(), text.size(), {&pos_[0], pos_.size()}, font, encoding); }), R"docstring( Creates :py:class:`TextBlob` with a single run. @@ -286,7 +286,7 @@ textblob throw py::value_error(stream.str()); } return SkTextBlob::MakeFromPosTextH( - text.c_str(), text.size(), &xpos_[0], constY, font, encoding); + text.c_str(), text.size(), {&xpos_[0], xpos_.size()}, constY, font, encoding); }, R"docstring( Returns a textblob built from a single run of text with x-positions and @@ -316,7 +316,7 @@ textblob throw std::runtime_error( "text and pos must have the same number of elements."); return SkTextBlob::MakeFromPosText( - text.c_str(), text.size(), &pos[0], font, encoding); + text.c_str(), text.size(), {&pos[0], pos.size()}, font, encoding); }, R"docstring( Returns a textblob built from a single run of text with x-positions and @@ -344,7 +344,7 @@ textblob throw std::runtime_error( "text and xform must have the same number of elements."); return SkTextBlob::MakeFromRSXform( - text.c_str(), text.size(), &xform[0], font, encoding); + text.c_str(), text.size(), {&xform[0], xform.size()}, font, encoding); }, py::arg("text"), py::arg("xform"), py::arg("font"), py::arg_v("encoding", SkTextEncoding::kUTF8, "skia.TextEncoding.kUTF8")) @@ -399,7 +399,7 @@ textblobbuilder int glyphCount = font.countText(&text[0], text.size(), encoding); auto run = builder.allocRun(font, glyphCount, x, y, bounds); font.textToGlyphs( - &text[0], text.size(), encoding, run.glyphs, glyphCount); + &text[0], text.size(), encoding, {run.glyphs, glyphCount}); }, R"docstring( Sets a new run with glyphs. From cd8af0cd352f6653a7eb2951813d7f8bbe6ee3b8 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 26 Jun 2025 00:38:18 +0100 Subject: [PATCH 06/43] Upstream main (post m139) fix for pdf breakage --- ...evert-gn-Split-pdf-and-xps-from-skia.patch | 210 ++++++++++++++++++ scripts/build_Linux.sh | 1 + scripts/build_Windows.sh | 1 + scripts/build_macOS.sh | 1 + 4 files changed, 213 insertions(+) create mode 100644 patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch diff --git a/patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch b/patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch new file mode 100644 index 00000000..5ffce7c1 --- /dev/null +++ b/patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch @@ -0,0 +1,210 @@ +From e5b9496b71237d3e63289c6fd8a7466d8db80a29 Mon Sep 17 00:00:00 2001 +From: Florin Malita +Date: Mon, 23 Jun 2025 19:07:15 -0700 +Subject: [PATCH] Revert "[gn] Split :pdf and :xps from :skia" + +This reverts commit 3f34cf7c2d940a9ed84bf131d6c33b7380e180a0. + +Reason for revert: breaking Android + +Original change's description: +> [gn] Split :pdf and :xps from :skia +> +> After https://skia-review.googlesource.com/c/skia/+/1008277/2, we end up +> with an implicit dependency cycle: +> +> :skia -> :pdf/:xps (SkClipStack_AsPath) -> //modules/pathops -> :skia +> +> To fix, remove pdf and xps deps from "core" :skia and add to leaf apps +> instead. +> +> Change-Id: Ibdd58a97672ab5f9566c71907ce9e664eb809d4a +> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1009616 +> Reviewed-by: Ben Wagner +> Commit-Queue: Florin Malita + +No-Presubmit: true +No-Tree-Checks: true +No-Try: true +Change-Id: I259449122b1b77894e841d3146487f5be8bebfba +Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1011517 +Auto-Submit: Florin Malita +Commit-Queue: Rubber Stamper +Bot-Commit: Rubber Stamper +Signed-off-by: Hin-Tak Leung +--- + BUILD.gn | 41 ++++++------------------------------- + bazel/exporter_tool/main.go | 4 ---- + gn/utils.gni | 6 ------ + 3 files changed, 6 insertions(+), 45 deletions(-) + +diff --git a/BUILD.gn b/BUILD.gn +index 0cdde0edfa..acdfb6d793 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -1257,22 +1257,12 @@ optional("graphite") { + } + } + +-skia_component("clipstack_utils") { +- deps = [ +- ":skia", +- "//modules/pathops", +- ] +- sources = skia_clipstack_utils_sources +-} +- + optional("pdf") { +- enabled = skia_use_zlib && skia_enable_pdf ++ enabled = skia_use_zlib && skia_enable_pdf && skia_use_libjpeg_turbo_decode && ++ skia_use_libjpeg_turbo_encode + public_defines = [ "SK_SUPPORT_PDF" ] + +- deps = [ +- ":clipstack_utils", +- "//third_party/zlib", +- ] ++ deps = [ "//third_party/zlib" ] + public = skia_pdf_public + sources = skia_pdf_sources + sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] +@@ -1296,7 +1286,6 @@ optional("pdf_jpeg_helpers") { + optional("xps") { + enabled = skia_use_xps && is_win + public_defines = [ "SK_SUPPORT_XPS" ] +- deps = [ ":clipstack_utils" ] + public = skia_xps_public + sources = skia_xps_sources + } +@@ -1672,8 +1661,11 @@ skia_component("skia") { + ":gpu", + ":graphite", + ":jpeg_encode", ++ ":pdf", ++ ":pdf_jpeg_helpers", + ":png_encode_libpng", + ":webp_encode", ++ ":xps", + ] + + deps = [ +@@ -1731,10 +1723,6 @@ skia_component("skia") { + "src/sfnt/SkOTUtils.cpp", + ] + +- # TODO(fmalita): remove from skia_utils_private after clients are migrated to +- # skia_clipstack_utils_sources +- sources -= skia_clipstack_utils_sources +- + defines = [] + libs = [] + +@@ -1950,8 +1938,6 @@ if (skia_enable_tools) { + deps = [ + ":flags", + ":gpu_tool_utils", +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + ":skia.h", + "modules/pathops", +@@ -2558,8 +2544,6 @@ if (skia_enable_tools) { + ":flags", + ":gm", + ":gpu_tool_utils", +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + ":tool_utils", + "modules/skparagraph:bench", +@@ -2632,13 +2616,10 @@ if (skia_enable_tools) { + ":gm", + ":gpu_tool_utils", + ":hash_and_encode", +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + ":tests", + ":tool_utils", + ":trace", +- ":xps", + "modules/pathops", + "modules/skottie", + "modules/skottie:utils", +@@ -2751,8 +2732,6 @@ if (skia_enable_tools) { + test_app("sktexttopdf") { + sources = [ "tools/using_skia_and_harfbuzz.cpp" ] + deps = [ +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + "modules/pathops", + "modules/skshaper", +@@ -2853,8 +2832,6 @@ if (skia_enable_tools) { + deps = [ + ":flags", + ":gpu_tool_utils", +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + "modules/jsonreader", + "modules/skottie:fuzz", +@@ -2903,8 +2880,6 @@ if (skia_enable_tools) { + ] + deps = [ + ":gm", +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + ":tests", + ":tool_utils", +@@ -3084,8 +3059,6 @@ if (skia_enable_tools) { + ] + } + deps = [ +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + ":skia.h", + "modules/skottie", +@@ -3306,8 +3279,6 @@ if (skia_enable_tools) { + deps += [ + ":flags", + ":gpu_tool_utils", +- ":pdf", +- ":pdf_jpeg_helpers", + ":skia", + ":tool_utils", + ] +diff --git a/bazel/exporter_tool/main.go b/bazel/exporter_tool/main.go +index 77bc549ece..5201da4220 100644 +--- a/bazel/exporter_tool/main.go ++++ b/bazel/exporter_tool/main.go +@@ -449,10 +449,6 @@ var gniExportDescs = []exporter.GNIExportDesc{ + "//src/utils:utils_skslc_hdrs", + "//src/utils:utils_skslc_srcs", + }}, +- {Var: "skia_clipstack_utils_sources", +- Rules: []string{ +- "//src/utils:clip_stack_utils", +- }}, + }, + }, + {GNI: "gn/xps.gni", Vars: []exporter.GNIFileListExportDesc{ +diff --git a/gn/utils.gni b/gn/utils.gni +index 42255ce6a3..080f89c98e 100644 +--- a/gn/utils.gni ++++ b/gn/utils.gni +@@ -120,9 +120,3 @@ skia_utils_private = [ + "$_src/utils/win/SkTScopedComPtr.h", + "$_src/utils/win/SkWGL_win.cpp", + ] +- +-# Generated by Bazel rule //src/utils:clip_stack_utils +-skia_clipstack_utils_sources = [ +- "$_src/utils/SkClipStackUtils.cpp", +- "$_src/utils/SkClipStackUtils.h", +-] +-- +2.49.0 + diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index 488aa66f..d39e104e 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -20,6 +20,7 @@ fi # Build skia cd skia && \ patch -p1 < ../patch/skia-m139-minimize-download.patch && \ + patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 < ../patch/skia-m132-egl-runtime.diff && \ python3 tools/git-sync-deps && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index f6795c38..9b17d1ed 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -13,6 +13,7 @@ fi # Build skia cd skia && \ patch -p1 < ../patch/skia-m139-minimize-download.patch && \ + patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ patch -p1 < ../patch/0001-gn-Remove-msvc-env-setting.patch && \ diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 568a4662..ecc331b6 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -23,6 +23,7 @@ function apply_patch { cd skia && \ patch -p1 < ../patch/skia-m139-minimize-download.patch && \ + patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From e1b58ee08243c6f933d03cd15f4da5a8806a919c Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 26 Jun 2025 01:40:22 +0100 Subject: [PATCH 07/43] Revert "Backporting skia m139 fix to earlier skia for arm64 windows + freetype compatibility." This reverts commit bfccc584dce06cca033452f3b145aaa9f6a56ce1. --- patch/0001-gn-Remove-msvc-env-setting.patch | 146 -------------------- scripts/build_Windows.sh | 1 - 2 files changed, 147 deletions(-) delete mode 100644 patch/0001-gn-Remove-msvc-env-setting.patch diff --git a/patch/0001-gn-Remove-msvc-env-setting.patch b/patch/0001-gn-Remove-msvc-env-setting.patch deleted file mode 100644 index fc47345d..00000000 --- a/patch/0001-gn-Remove-msvc-env-setting.patch +++ /dev/null @@ -1,146 +0,0 @@ -From c6f2286a2795e36ff7b22b2c1030b2196d76e70e Mon Sep 17 00:00:00 2001 -From: Ben Wagner -Date: Tue, 27 May 2025 16:32:19 -0400 -Subject: [PATCH] [gn] Remove msvc env setting - -SetEnv.cmd has long been removed but kept alive by Skia packaging of -MSVC. Older MSVC compilers and Windows SDKs relied on a large number of -environment variables to be set when cross compiling, but this should no -longer be necessary. - -In addition, the MSVC ARM toolchains are now complete and no longer -require the host toolchain to be on the path. - -These improvements mean that it is no longer necessary to use `cmd.exe -/c` as a "compiler wrapper" to set up the environment. Because it is not -generally possible to properly escape such command lines this has caused -issues with any arguments which would require proper escaping such as -paths with spaces and special characters. - -This change drops support for building Skia for x86 or ARM64 with MSVC -from before VS2022, with the benefit of building for x86 or ARM64 -without extemely odd, undocumented, and limiting restrictions. - -Also add support for detecting MSVC 2022 before looking for 2019 or -2017. - -Bug: 420271794, 376381591 -Change-Id: I8591636aec31095b13db6dc1a376abfa23199ebd -Reviewed-on: https://skia-review.googlesource.com/c/skia/+/999356 -Reviewed-by: Kaylee Lubick ---- - gn/find_msvc.py | 17 ++++++++++------- - gn/toolchain/BUILD.gn | 24 ++++++++---------------- - 2 files changed, 18 insertions(+), 23 deletions(-) - -diff --git a/gn/find_msvc.py b/gn/find_msvc.py -index 108d576139..281a738900 100755 ---- a/gn/find_msvc.py -+++ b/gn/find_msvc.py -@@ -10,16 +10,19 @@ import subprocess - ''' - Look for the first match in the format - C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC -+ C:\\Program Files\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC -+If not found, use vswhere.exe. - ''' - def find_msvc(): - if sys.platform.startswith('win'): -- default_dir = r'C:\Program Files (x86)\Microsoft Visual Studio' -- for release in ['2019', '2017']: -- for version in ['Enterprise', 'Professional', 'Community', 'BuildTools', 'Preview']: -- path = os.path.join(default_dir, release, version, 'VC') -- if os.path.isdir(path): -- return path -- -+ default_dirs = [r'C:\Program Files\Microsoft Visual Studio', -+ r'C:\Program Files (x86)\Microsoft Visual Studio'] -+ for default_dir in default_dirs: -+ for release in ['2022', '2019', '2017']: -+ for version in ['Enterprise', 'Professional', 'Community', 'BuildTools', 'Preview']: -+ path = os.path.join(default_dir, release, version, 'VC') -+ if os.path.isdir(path): -+ return path - # Fall back to vswhere.exe to determine non-standard installation paths - # Fixed location, https://github.com/Microsoft/vswhere/wiki/Installing - vswhere = os.path.join(os.getenv('ProgramFiles(x86)'), -diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn -index 4d4abc952f..85858b5a01 100644 ---- a/gn/toolchain/BUILD.gn -+++ b/gn/toolchain/BUILD.gn -@@ -87,16 +87,6 @@ template("msvc_toolchain") { - - bin = "$win_vc/Tools/MSVC/$win_toolchain_version/bin/HostX64/$toolchain_target_cpu" - -- env_setup = "" -- if (toolchain_target_cpu == "x86") { -- # Toolchain asset includes a script that configures for x86 building. -- # We don't support x86 builds with local MSVC installations. -- env_setup = "$shell $win_sdk/bin/SetEnv.cmd /x86 && " -- } else if (toolchain_target_cpu == "arm64") { -- # ARM64 compiler is incomplete - it relies on DLLs located in the host toolchain directory. -- env_setup = "$shell set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x64\" && " -- } -- - cl_m32_flag = "" - - if (clang_win != "") { -@@ -126,7 +116,8 @@ template("msvc_toolchain") { - if (toolchain_target_cpu == "x64") { - _ml += "64" - } -- command = "$env_setup \"$bin/$_ml.exe\" {{asmflags}} /nologo /c /Fo {{output}} {{source}}" -+ command = -+ "\"$bin/$_ml.exe\" {{asmflags}} /nologo /c /Fo {{output}} {{source}}" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", - ] -@@ -138,7 +129,7 @@ template("msvc_toolchain") { - pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" - - # Label names may have spaces so pdbname must be quoted. -- command = "$env_setup $cc_wrapper $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} $cl_m32_flag {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" -+ command = "$cc_wrapper $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} $cl_m32_flag {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" - depsformat = "msvc" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", -@@ -151,7 +142,7 @@ template("msvc_toolchain") { - pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb" - - # Label names may have spaces so pdbname must be quoted. -- command = "$env_setup $cc_wrapper $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} $cl_m32_flag {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" -+ command = "$cc_wrapper $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} $cl_m32_flag {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\"" - depsformat = "msvc" - outputs = [ - "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj", -@@ -162,7 +153,8 @@ template("msvc_toolchain") { - tool("alink") { - rspfile = "{{output}}.rsp" - -- command = "$env_setup $lib /nologo /ignore:4221 {{arflags}} /OUT:{{output}} @$rspfile" -+ command = -+ "$lib /nologo /ignore:4221 {{arflags}} /OUT:{{output}} @$rspfile" - outputs = [ - # Ignore {{output_extension}} and always use .lib, there's no reason to - # allow targets to override this extension on Windows. -@@ -185,7 +177,7 @@ template("msvc_toolchain") { - pdbname = "${dllname}.pdb" - rspfile = "${dllname}.rsp" - -- command = "$env_setup $link /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" -+ command = "$link /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile" - outputs = [ - dllname, - libname, -@@ -217,7 +209,7 @@ template("msvc_toolchain") { - pdbname = "$exename.pdb" - rspfile = "$exename.rsp" - -- command = "$env_setup $link /nologo /OUT:$exename /PDB:$pdbname @$rspfile" -+ command = "$link /nologo /OUT:$exename /PDB:$pdbname @$rspfile" - default_output_extension = ".exe" - default_output_dir = "{{root_out_dir}}" - outputs = [ exename ] --- -2.49.0 - diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 9b17d1ed..48064830 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -16,7 +16,6 @@ cd skia && \ patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ - patch -p1 < ../patch/0001-gn-Remove-msvc-env-setting.patch && \ python tools/git-sync-deps && \ bin/gn gen out/Release --args=" is_official_build=true From 6c911d9f3e1ca9837f20217527e877414ea4b1f8 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 6 Aug 2025 21:20:38 +0100 Subject: [PATCH 08/43] Roll skia along m139 (canvaskit/0.40.0-787-g0f94c19331 to canvaskit/0.40.0-795-gcbc694239b) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index 0f94c193..cbc69423 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 0f94c19331c51259e23bee547b2657b5ad7dff26 +Subproject commit cbc694239b06ecf694676aba22d5263dbc23ee5e From d16029049194e7d2c08ec543861b90321eec53e3 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 6 Aug 2025 21:22:03 +0100 Subject: [PATCH 09/43] upgrade skia to m140 (canvaskit/0.40.0-795-gcbc694239b to canvaskit/0.40.0-1240-gb57e04d1c7) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index cbc69423..b57e04d1 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit cbc694239b06ecf694676aba22d5263dbc23ee5e +Subproject commit b57e04d1c7344e71688dc37cb3c118cef0255065 From c9cc4d7c9d5da084bd10c729d523f90483ce3f70 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 22:05:18 +0100 Subject: [PATCH 10/43] Bump to 140.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ef51dfeb..ea70a5bb 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ pass NAME = 'skia-python' -__version__ = '139.0' +__version__ = '140.0' SKIA_PATH = os.getenv('SKIA_PATH', 'skia') SKIA_OUT_PATH = os.getenv( From b4e4f18c1350640c00cd351f05362d226230f8b5 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 22:22:30 +0100 Subject: [PATCH 11/43] m140: `SkFontMgr_New_FontConfig` with 1 parameter has been deprecated, and removed. It was deprecated in m139, and gone in m140. Milestone 139 ------------- * `SkFontMgr_New_FontConfig` with 1 parameter has been deprecated and will be removed in a future release. Clients will need to call the other version providing an SkFontScanner (e.g. `SkFontScanner_Make_FreeType()`) Conflicts: src/skia/Font.cpp --- src/skia/Font.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/skia/Font.cpp b/src/skia/Font.cpp index 9dd4e4b4..4c7e5b1f 100644 --- a/src/skia/Font.cpp +++ b/src/skia/Font.cpp @@ -17,6 +17,7 @@ #ifdef __linux__ #include "include/ports/SkFontMgr_fontconfig.h" +#include "include/ports/SkFontScanner_FreeType.h" #endif #ifdef _WIN32 @@ -35,7 +36,7 @@ static sk_sp fontmgr_factory() { #if defined(__APPLE__) return SkFontMgr_New_CoreText(nullptr); #elif defined(__linux__) - return SkFontMgr_New_FontConfig(nullptr); + return SkFontMgr_New_FontConfig(nullptr, SkFontScanner_Make_FreeType()); #elif defined(_WIN32) return SkFontMgr_New_DirectWrite(); #else From 4e824a4abb794ed00b333a9ededa8a911d31e063 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 22:42:38 +0100 Subject: [PATCH 12/43] m140: `SkImage::isValid(GrRecordingContext*)` has been deprecated in favor of the `SkRecorder*` version. Milestone 140 ------------- * `SkImage::isValid(GrRecordingContext*)` has been deprecated in favor of the `SkRecorder*` version. To migrate do something like `image->isValid(ctx->asRecorder())`. `SkImage::makeSubset(GrDirectContext*, ...)` has been deprecated in favor of the `SkRecorder*` version. To migrate, do something like `image->makeSubset(ctx->asRecorder, ..., {})` `SkImage::makeColorSpace(GrDirectContext*, ...)` has been deprecated in favor of the `SkRecorder*` version. To migrate, do something like `image->makeColorSpace(ctx->asRecorder, ..., {})` `SkImage::makeColorTypeAndColorSpace(GrDirectContext*, ...)` has been deprecated in favor of the `SkRecorder*` version. To migrate, do something like `image->makeColorTypeAndColorSpace(ctx->asRecorder, ..., {})` In the case you are working with CPU-backed images, `skcpu::Recorder::TODO()` should work until a `skcpu::Context` and `skcpu::Recorder` can be used properly. --- src/skia/Image.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/skia/Image.cpp b/src/skia/Image.cpp index 59b76f21..07026441 100644 --- a/src/skia/Image.cpp +++ b/src/skia/Image.cpp @@ -150,8 +150,8 @@ sk_sp ImageConvert( at = image.alphaType(); if (at == image.alphaType()) { if (ct == image.colorType()) - return image.makeColorSpace(nullptr, CloneColorSpace(cs)); - return image.makeColorTypeAndColorSpace(nullptr, ct, CloneColorSpace(cs)); + return image.makeColorSpace(nullptr, CloneColorSpace(cs), {}); + return image.makeColorTypeAndColorSpace(nullptr, ct, CloneColorSpace(cs), {}); } auto imageInfo = SkImageInfo::Make( @@ -1398,7 +1398,10 @@ image :return: true if :py:class:`Image` is a GPU texture )docstring") - .def("isValid", py::overload_cast(&SkImage::isValid, py::const_), + .def("isValid", + [] (const SkImage& image, GrRecordingContext* ctx) { + return image.isValid(ctx->asRecorder()); + }, R"docstring( Returns true if :py:class:`Image` can be drawn on either raster surface or GPU surface. @@ -1744,7 +1747,7 @@ image )docstring") .def("makeSubset", [] (SkImage& image, const SkIRect& subset, GrDirectContext* direct) { - return image.makeSubset(direct, subset); + return image.makeSubset(direct->asRecorder(), subset, {}); }, R"docstring( Returns subset of :py:class:`Image`. @@ -1943,7 +1946,7 @@ image .def("makeColorSpace", [] (const SkImage& image, const SkColorSpace* target, GrDirectContext* direct) { - return image.makeColorSpace(direct, CloneColorSpace(target)); + return image.makeColorSpace(direct->asRecorder(), CloneColorSpace(target), {}); }, R"docstring( Creates :py:class:`Image` in target :py:class:`ColorSpace`. @@ -1965,7 +1968,7 @@ image [] (const SkImage& image, SkColorType ct, const SkColorSpace* cs, GrDirectContext* direct) { return image.makeColorTypeAndColorSpace( - direct, ct, CloneColorSpace(cs)); + direct->asRecorder(), ct, CloneColorSpace(cs), {}); }, R"docstring( Experimental. From d85f85aeca588d13822e5893c693226c4369686d Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 23:25:31 +0100 Subject: [PATCH 13/43] m140: Prototype change for SkMatrix.setPolyToPoly(), and overload SkMatrix.inverse() m139: bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count); m140: bool setPolyToPoly(SkSpan src, SkSpan dst); Before m140, only (deprecated): [[nodiscard]] bool invert(SkMatrix* inverse) const; Added in m140: std::optional invert() const; --- src/skia/Matrix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/skia/Matrix.cpp b/src/skia/Matrix.cpp index 62991092..ecf4f1ae 100644 --- a/src/skia/Matrix.cpp +++ b/src/skia/Matrix.cpp @@ -1197,8 +1197,8 @@ matrix if (src.size() != dst.size()) throw std::runtime_error("src and dst must have the same size"); if (src.empty()) - return matrix.setPolyToPoly(nullptr, nullptr, 0); - return matrix.setPolyToPoly(&src[0], &dst[0], src.size()); + return matrix.setPolyToPoly({nullptr, 0}, {nullptr, 0}); + return matrix.setPolyToPoly({&src[0], src.size()}, {&dst[0], dst.size()}); }, R"docstring( Sets :py:class:`Matrix` to map src to dst. @@ -1217,7 +1217,7 @@ matrix :return: true if :py:class:`Matrix` was constructed successfully )docstring", py::arg("src"), py::arg("dst")) - .def("invert", &SkMatrix::invert, + .def("invert", py::overload_cast(&SkMatrix::invert, py::const_), R"docstring( Sets inverse to reciprocal matrix, returning true if :py:class:`Matrix` can be inverted. From ddd268f2cbb56a77be49abccc926708224d7d61c Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 23:35:05 +0100 Subject: [PATCH 14/43] m140: incomplete type 'SkPathBuilder' error; need new header. --- src/skia/PathEffect.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/skia/PathEffect.cpp b/src/skia/PathEffect.cpp index 376e1259..99c337d8 100644 --- a/src/skia/PathEffect.cpp +++ b/src/skia/PathEffect.cpp @@ -1,4 +1,5 @@ #include "common.h" +#include #include #include #include From 4835fd0fe71f08f3b6b6e2a6563adfcb19befd08 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 23:43:01 +0100 Subject: [PATCH 15/43] m140: need overload for SkPathMeasure::getSegment Old: bool getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo); Newly added: bool getSegment(SkScalar startD, SkScalar stopD, SkPathBuilder* dst, bool startWithMoveTo); --- src/skia/PathMeasure.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skia/PathMeasure.cpp b/src/skia/PathMeasure.cpp index ec4820a8..f0ed7a4e 100644 --- a/src/skia/PathMeasure.cpp +++ b/src/skia/PathMeasure.cpp @@ -83,7 +83,7 @@ path_measure :py:class:`Point` and tangent :py:class:`Vector`. )docstring", py::arg("distance")) - .def("getSegment", &SkPathMeasure::getSegment, + .def("getSegment", py::overload_cast(&SkPathMeasure::getSegment), R"docstring( Given a start and stop distance, return in dst the intervening segment(s). From 12f94bbda6b0ed9c0103ec907ba65cba95e32025 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Thu, 7 Aug 2025 23:51:48 +0100 Subject: [PATCH 16/43] m140: need overload for SkRRect::transform Old: bool transform(const SkMatrix& matrix, SkRRect* dst) const; Newly added: std::optional transform(const SkMatrix& matrix) const; --- src/skia/Rect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skia/Rect.cpp b/src/skia/Rect.cpp index 11b3973f..39f74402 100644 --- a/src/skia/Rect.cpp +++ b/src/skia/Rect.cpp @@ -1833,7 +1833,7 @@ rrect :return: bytes read, or 0 if length is less than kSizeInMemory )docstring", py::arg("buffer")) - .def("transform", &SkRRect::transform, + .def("transform", py::overload_cast(&SkRRect::transform, py::const_), R"docstring( Transforms by :py:class:`RRect` by matrix, storing result in dst. From fb7e64d86e74b178cde9a27e86b21fa7d9f014e9 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 8 Aug 2025 00:03:59 +0100 Subject: [PATCH 17/43] m140: Need overload for &SkRegion::getBoundaryPath Old: bool getBoundaryPath(SkPath* path) const; Newly added: SkPath getBoundaryPath() const; --- src/skia/Region.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skia/Region.cpp b/src/skia/Region.cpp index 8c75f1f1..d76a4ac8 100644 --- a/src/skia/Region.cpp +++ b/src/skia/Region.cpp @@ -347,7 +347,7 @@ region :return: relative complexity )docstring") - .def("getBoundaryPath", &SkRegion::getBoundaryPath, + .def("getBoundaryPath", py::overload_cast(&SkRegion::getBoundaryPath, py::const_), R"docstring( Appends outline of :py:class:`Region` to path. From f7187cec95d164e3415516a1d6c305199bdbfd3f Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 8 Aug 2025 00:09:19 +0100 Subject: [PATCH 18/43] m140: libpathops no longer exists. --- setup.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index ea70a5bb..287e277d 100644 --- a/setup.py +++ b/setup.py @@ -35,8 +35,7 @@ EXTRA_OBJECTS = list( ) + [os.path.join(SKIA_OUT_PATH, 'svg.lib'), os.path.join(SKIA_OUT_PATH, 'skresources.lib'), os.path.join(SKIA_OUT_PATH, 'skia.lib'), os.path.join(SKIA_OUT_PATH, 'skparagraph.lib'), os.path.join(SKIA_OUT_PATH, 'skshaper.lib'), - os.path.join(SKIA_OUT_PATH, 'skunicode_icu.lib'), os.path.join(SKIA_OUT_PATH, 'skunicode_core.lib'), - os.path.join(SKIA_OUT_PATH, 'pathops.lib')] + os.path.join(SKIA_OUT_PATH, 'skunicode_icu.lib'), os.path.join(SKIA_OUT_PATH, 'skunicode_core.lib')] EXTRA_COMPILE_ARGS = [ '/std:c++17', # c++20 fails. '/DVERSION_INFO=%s' % __version__, @@ -70,8 +69,7 @@ EXTRA_OBJECTS = list( ) + [os.path.join(SKIA_OUT_PATH, 'libsvg.a'), os.path.join(SKIA_OUT_PATH, 'libskia.a'), os.path.join(SKIA_OUT_PATH, 'libskparagraph.a'), os.path.join(SKIA_OUT_PATH, 'libskshaper.a'), - os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a'), - os.path.join(SKIA_OUT_PATH, 'libpathops.a')] + os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a')] EXTRA_COMPILE_ARGS = [ '-std=c++17', '-stdlib=libc++', @@ -106,8 +104,7 @@ EXTRA_OBJECTS = list( ) + [os.path.join(SKIA_OUT_PATH, 'libsvg.a'), os.path.join(SKIA_OUT_PATH, 'libskresources.a'), os.path.join(SKIA_OUT_PATH, 'libskia.a'), os.path.join(SKIA_OUT_PATH, 'libskparagraph.a'), os.path.join(SKIA_OUT_PATH, 'libskshaper.a'), - os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a'), - os.path.join(SKIA_OUT_PATH, 'libpathops.a')] + os.path.join(SKIA_OUT_PATH, 'libskunicode_icu.a'), os.path.join(SKIA_OUT_PATH, 'libskunicode_core.a')] EXTRA_COMPILE_ARGS = [ '-std=c++17', '-fvisibility=hidden', From 3444eccae822f46b668a3d8d7e1b6d2729033e5f Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 8 Aug 2025 00:25:07 +0100 Subject: [PATCH 19/43] Fixes seg-fault from dereferencing null->asRecorder() --- src/skia/Image.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/skia/Image.cpp b/src/skia/Image.cpp index 07026441..a41d6704 100644 --- a/src/skia/Image.cpp +++ b/src/skia/Image.cpp @@ -1400,7 +1400,7 @@ image )docstring") .def("isValid", [] (const SkImage& image, GrRecordingContext* ctx) { - return image.isValid(ctx->asRecorder()); + return image.isValid(((ctx) ? ctx->asRecorder() : nullptr)); }, R"docstring( Returns true if :py:class:`Image` can be drawn on either raster surface @@ -1747,7 +1747,7 @@ image )docstring") .def("makeSubset", [] (SkImage& image, const SkIRect& subset, GrDirectContext* direct) { - return image.makeSubset(direct->asRecorder(), subset, {}); + return image.makeSubset(((direct) ? direct->asRecorder() : nullptr), subset, {}); }, R"docstring( Returns subset of :py:class:`Image`. @@ -1946,7 +1946,7 @@ image .def("makeColorSpace", [] (const SkImage& image, const SkColorSpace* target, GrDirectContext* direct) { - return image.makeColorSpace(direct->asRecorder(), CloneColorSpace(target), {}); + return image.makeColorSpace(((direct) ? direct->asRecorder() : nullptr), CloneColorSpace(target), {}); }, R"docstring( Creates :py:class:`Image` in target :py:class:`ColorSpace`. @@ -1968,7 +1968,7 @@ image [] (const SkImage& image, SkColorType ct, const SkColorSpace* cs, GrDirectContext* direct) { return image.makeColorTypeAndColorSpace( - direct->asRecorder(), ct, CloneColorSpace(cs), {}); + ((direct) ? direct->asRecorder() : nullptr), ct, CloneColorSpace(cs), {}); }, R"docstring( Experimental. From bcaa3aa118a02498efc1fa1e473c8bba2ea3aff5 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 8 Aug 2025 00:47:36 +0100 Subject: [PATCH 20/43] m140: SkStrokeRec::applyToPath prototype change was: bool applyToPath(SkPath* dst, const SkPath& src) const; m140: bool applyToPath(SkPathBuilder* dst, const SkPath& src) const; --- src/skia/PathEffect.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/skia/PathEffect.cpp b/src/skia/PathEffect.cpp index 99c337d8..affc3ef1 100644 --- a/src/skia/PathEffect.cpp +++ b/src/skia/PathEffect.cpp @@ -63,7 +63,11 @@ strokerec :py:meth:`applyToPath` will return true. )docstring") - .def("applyToPath", &SkStrokeRec::applyToPath, + .def("applyToPath", + [] (const SkStrokeRec& strokerec, SkPath* dst, const SkPath& src) { + auto dst2 = SkPathBuilder(*dst); + return strokerec.applyToPath(&dst2, src); + }, R"docstring( Apply these stroke parameters to the src path, returning the result in dst. From 2bf816e535b402002ccfb4385a86b47e821a87c7 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 10 Aug 2025 00:45:26 +0100 Subject: [PATCH 21/43] Revert "Upstream main (post m139) fix for pdf breakage" This reverts commit cd8af0cd352f6653a7eb2951813d7f8bbe6ee3b8. Should not be needed in m140. --- ...evert-gn-Split-pdf-and-xps-from-skia.patch | 210 ------------------ scripts/build_Linux.sh | 1 - scripts/build_Windows.sh | 1 - scripts/build_macOS.sh | 1 - 4 files changed, 213 deletions(-) delete mode 100644 patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch diff --git a/patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch b/patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch deleted file mode 100644 index 5ffce7c1..00000000 --- a/patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch +++ /dev/null @@ -1,210 +0,0 @@ -From e5b9496b71237d3e63289c6fd8a7466d8db80a29 Mon Sep 17 00:00:00 2001 -From: Florin Malita -Date: Mon, 23 Jun 2025 19:07:15 -0700 -Subject: [PATCH] Revert "[gn] Split :pdf and :xps from :skia" - -This reverts commit 3f34cf7c2d940a9ed84bf131d6c33b7380e180a0. - -Reason for revert: breaking Android - -Original change's description: -> [gn] Split :pdf and :xps from :skia -> -> After https://skia-review.googlesource.com/c/skia/+/1008277/2, we end up -> with an implicit dependency cycle: -> -> :skia -> :pdf/:xps (SkClipStack_AsPath) -> //modules/pathops -> :skia -> -> To fix, remove pdf and xps deps from "core" :skia and add to leaf apps -> instead. -> -> Change-Id: Ibdd58a97672ab5f9566c71907ce9e664eb809d4a -> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1009616 -> Reviewed-by: Ben Wagner -> Commit-Queue: Florin Malita - -No-Presubmit: true -No-Tree-Checks: true -No-Try: true -Change-Id: I259449122b1b77894e841d3146487f5be8bebfba -Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1011517 -Auto-Submit: Florin Malita -Commit-Queue: Rubber Stamper -Bot-Commit: Rubber Stamper -Signed-off-by: Hin-Tak Leung ---- - BUILD.gn | 41 ++++++------------------------------- - bazel/exporter_tool/main.go | 4 ---- - gn/utils.gni | 6 ------ - 3 files changed, 6 insertions(+), 45 deletions(-) - -diff --git a/BUILD.gn b/BUILD.gn -index 0cdde0edfa..acdfb6d793 100644 ---- a/BUILD.gn -+++ b/BUILD.gn -@@ -1257,22 +1257,12 @@ optional("graphite") { - } - } - --skia_component("clipstack_utils") { -- deps = [ -- ":skia", -- "//modules/pathops", -- ] -- sources = skia_clipstack_utils_sources --} -- - optional("pdf") { -- enabled = skia_use_zlib && skia_enable_pdf -+ enabled = skia_use_zlib && skia_enable_pdf && skia_use_libjpeg_turbo_decode && -+ skia_use_libjpeg_turbo_encode - public_defines = [ "SK_SUPPORT_PDF" ] - -- deps = [ -- ":clipstack_utils", -- "//third_party/zlib", -- ] -+ deps = [ "//third_party/zlib" ] - public = skia_pdf_public - sources = skia_pdf_sources - sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] -@@ -1296,7 +1286,6 @@ optional("pdf_jpeg_helpers") { - optional("xps") { - enabled = skia_use_xps && is_win - public_defines = [ "SK_SUPPORT_XPS" ] -- deps = [ ":clipstack_utils" ] - public = skia_xps_public - sources = skia_xps_sources - } -@@ -1672,8 +1661,11 @@ skia_component("skia") { - ":gpu", - ":graphite", - ":jpeg_encode", -+ ":pdf", -+ ":pdf_jpeg_helpers", - ":png_encode_libpng", - ":webp_encode", -+ ":xps", - ] - - deps = [ -@@ -1731,10 +1723,6 @@ skia_component("skia") { - "src/sfnt/SkOTUtils.cpp", - ] - -- # TODO(fmalita): remove from skia_utils_private after clients are migrated to -- # skia_clipstack_utils_sources -- sources -= skia_clipstack_utils_sources -- - defines = [] - libs = [] - -@@ -1950,8 +1938,6 @@ if (skia_enable_tools) { - deps = [ - ":flags", - ":gpu_tool_utils", -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - ":skia.h", - "modules/pathops", -@@ -2558,8 +2544,6 @@ if (skia_enable_tools) { - ":flags", - ":gm", - ":gpu_tool_utils", -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - ":tool_utils", - "modules/skparagraph:bench", -@@ -2632,13 +2616,10 @@ if (skia_enable_tools) { - ":gm", - ":gpu_tool_utils", - ":hash_and_encode", -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - ":tests", - ":tool_utils", - ":trace", -- ":xps", - "modules/pathops", - "modules/skottie", - "modules/skottie:utils", -@@ -2751,8 +2732,6 @@ if (skia_enable_tools) { - test_app("sktexttopdf") { - sources = [ "tools/using_skia_and_harfbuzz.cpp" ] - deps = [ -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - "modules/pathops", - "modules/skshaper", -@@ -2853,8 +2832,6 @@ if (skia_enable_tools) { - deps = [ - ":flags", - ":gpu_tool_utils", -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - "modules/jsonreader", - "modules/skottie:fuzz", -@@ -2903,8 +2880,6 @@ if (skia_enable_tools) { - ] - deps = [ - ":gm", -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - ":tests", - ":tool_utils", -@@ -3084,8 +3059,6 @@ if (skia_enable_tools) { - ] - } - deps = [ -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - ":skia.h", - "modules/skottie", -@@ -3306,8 +3279,6 @@ if (skia_enable_tools) { - deps += [ - ":flags", - ":gpu_tool_utils", -- ":pdf", -- ":pdf_jpeg_helpers", - ":skia", - ":tool_utils", - ] -diff --git a/bazel/exporter_tool/main.go b/bazel/exporter_tool/main.go -index 77bc549ece..5201da4220 100644 ---- a/bazel/exporter_tool/main.go -+++ b/bazel/exporter_tool/main.go -@@ -449,10 +449,6 @@ var gniExportDescs = []exporter.GNIExportDesc{ - "//src/utils:utils_skslc_hdrs", - "//src/utils:utils_skslc_srcs", - }}, -- {Var: "skia_clipstack_utils_sources", -- Rules: []string{ -- "//src/utils:clip_stack_utils", -- }}, - }, - }, - {GNI: "gn/xps.gni", Vars: []exporter.GNIFileListExportDesc{ -diff --git a/gn/utils.gni b/gn/utils.gni -index 42255ce6a3..080f89c98e 100644 ---- a/gn/utils.gni -+++ b/gn/utils.gni -@@ -120,9 +120,3 @@ skia_utils_private = [ - "$_src/utils/win/SkTScopedComPtr.h", - "$_src/utils/win/SkWGL_win.cpp", - ] -- --# Generated by Bazel rule //src/utils:clip_stack_utils --skia_clipstack_utils_sources = [ -- "$_src/utils/SkClipStackUtils.cpp", -- "$_src/utils/SkClipStackUtils.h", --] --- -2.49.0 - diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index d39e104e..488aa66f 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -20,7 +20,6 @@ fi # Build skia cd skia && \ patch -p1 < ../patch/skia-m139-minimize-download.patch && \ - patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 < ../patch/skia-m132-egl-runtime.diff && \ python3 tools/git-sync-deps && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 48064830..291bb10c 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -13,7 +13,6 @@ fi # Build skia cd skia && \ patch -p1 < ../patch/skia-m139-minimize-download.patch && \ - patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ python tools/git-sync-deps && \ diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index ecc331b6..568a4662 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -23,7 +23,6 @@ function apply_patch { cd skia && \ patch -p1 < ../patch/skia-m139-minimize-download.patch && \ - patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From ee511506c07c31aff1cfec5e37001c3c04f15371 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 10 Aug 2025 00:50:57 +0100 Subject: [PATCH 22/43] m140 patch plus adjustments --- patch/skia-m140-minimize-download.patch | 70 +++++++++++++++++++++++++ scripts/build_Linux.sh | 2 +- scripts/build_Windows.sh | 2 +- scripts/build_macOS.sh | 2 +- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 patch/skia-m140-minimize-download.patch diff --git a/patch/skia-m140-minimize-download.patch b/patch/skia-m140-minimize-download.patch new file mode 100644 index 00000000..c691a84f --- /dev/null +++ b/patch/skia-m140-minimize-download.patch @@ -0,0 +1,70 @@ +diff --git a/DEPS b/DEPS +index 93fc170..5bd8752 100644 +--- a/DEPS ++++ b/DEPS +@@ -31,53 +31,18 @@ vars = { + # ./tools/git-sync-deps + deps = { + "buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@729495f2ffa69080907780591fa2a630b2556e98", +- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@b6b2f380814eadf33f215adc2e99f208c800ae47", +- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8", +- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", +- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting. +- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well. +- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@0b095928b31253ffc9684e460e08cc5710c2c21c", +- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07", +- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794", +- "third_party/externals/abseil-cpp" : "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp@cae4b6a3990e1431caa09c7b2ed1c76d0dfeab17", +- "third_party/externals/delaunator-cpp" : "https://skia.googlesource.com/external/github.com/skia-dev/delaunator-cpp.git@98305ef6c4e862f7d48df9cc647b690d796fec68", + "third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@dbe0a676450d9b8c71bf00688bb306409b779e90", +- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe", +- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@c69d433d8509c5c64564c2f0d054bf102a5cf67e", + "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@8e49998f003d693213b538ef765814c7d21abada", + "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@1518bc83d26b434031bd12c706ac3c7dab3902fd", + "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@08b52ae2e44931eef163dbad71697f911fadc323", +- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0", + "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4", +- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13", +- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456", +- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000", +- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1", +- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0", + "third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@e14cbfaa85529d47f9f55b0f104a579c1061f9ad", +- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", + "third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429", + "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f", +- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96", +- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419", +- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", +- "third_party/externals/partition_alloc" : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@ce13777cb731e0a60c606d1741091fd11a0574d7", +- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394", + "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", +- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@681d07e76d8e03286b231766447800aab543bd27", + "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191", +- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories. +- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well. + "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@0a496a889c4c1f56d0637afd2bddf4d89d94ebc9", +- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3", + "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@97e96f9e9defeb4bba3cfbd034dec516671dd7a3", +- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@3aeaaa088d37b86cff036eee1a9bf452abad7d9d", +- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@3ee3bea02164c5a816fe6c16ef4e3a810edb7620", +- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@37057b4756df4009ad85803bd2e06ec8a3bb1bca", +- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@f766b30b2de3ffe2cf6b656d943720882617ec58", +- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@b0a40d2e50310e9f84327061290a390a061125a3", +- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095", +- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4", + "third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8", + "third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596", + +diff --git a/bin/activate-emsdk b/bin/activate-emsdk +index b3c529f..81a1c60 100755 +--- a/bin/activate-emsdk ++++ b/bin/activate-emsdk +@@ -18,6 +18,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py') + EMSDK_VERSION = '4.0.7' + + def main(): ++ return + if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']: + # This platform cannot install emsdk at the provided version. See + # https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5 diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index 488aa66f..06c37cd3 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -19,7 +19,7 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m139-minimize-download.patch && \ + patch -p1 < ../patch/skia-m140-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 < ../patch/skia-m132-egl-runtime.diff && \ python3 tools/git-sync-deps && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 291bb10c..97c84110 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -12,7 +12,7 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m139-minimize-download.patch && \ + patch -p1 < ../patch/skia-m140-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ python tools/git-sync-deps && \ diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 568a4662..407204a2 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -22,7 +22,7 @@ function apply_patch { } cd skia && \ - patch -p1 < ../patch/skia-m139-minimize-download.patch && \ + patch -p1 < ../patch/skia-m140-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From 443a499bf9bb46cda5f275c1bc2e20095b6ea81c Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 10 Aug 2025 01:17:30 +0100 Subject: [PATCH 23/43] Skip pybind11 3.0.0 until it get fixed (waiting for 3.0.1) See https://github.com/pybind/pybind11/issues/5694 --- .github/workflows/ci.yml | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89c2e7e4..09e1ecb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install pybind11 numpy + CIBW_BEFORE_BUILD: pip install 'pybind11<3.0.0' numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install pybind11 numpy + CIBW_BEFORE_BUILD: pip install 'pybind11<3.0.0' numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl diff --git a/setup.py b/setup.py index ef51dfeb..88b4542f 100644 --- a/setup.py +++ b/setup.py @@ -182,9 +182,9 @@ def build_extensions(self): data_files=data_files, install_requires=[ 'numpy', - 'pybind11>=2.6' + 'pybind11>=2.6,<3.0.0' ], - setup_requires=['pybind11>=2.6'], + setup_requires=['pybind11>=2.6,<3.0.0'], cmdclass={'build_ext': BuildExt}, classifiers=[ 'Development Status :: 4 - Beta', From f0e1a8b4a6019da0c0b6e263a3a16f640758c52e Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 11 Aug 2025 19:18:13 +0100 Subject: [PATCH 24/43] Windows pip does not like single quotes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09e1ecb9..ecd9a5a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install 'pybind11<3.0.0' numpy + CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl From 8e5734355502b3bcb800eee43cf4acf29fa19d11 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 11 Aug 2025 19:26:57 +0100 Subject: [PATCH 25/43] Use x64_64 gn binary for arm64 windows --- patch/fetch-gn-windows-arm64.diff | 11 +++++++++++ scripts/build_Windows.sh | 1 + 2 files changed, 12 insertions(+) create mode 100644 patch/fetch-gn-windows-arm64.diff diff --git a/patch/fetch-gn-windows-arm64.diff b/patch/fetch-gn-windows-arm64.diff new file mode 100644 index 00000000..bee01d3c --- /dev/null +++ b/patch/fetch-gn-windows-arm64.diff @@ -0,0 +1,11 @@ +--- a/bin/fetch-gn.orig 2025-08-11 19:21:42.666070053 +0100 ++++ b/bin/fetch-gn 2025-08-11 19:23:01.381159842 +0100 +@@ -20,7 +20,7 @@ + gnzip = os.path.join(tempfile.mkdtemp(), 'gn.zip') + with open(gnzip, 'wb') as f: + OS = {'darwin': 'mac', 'linux': 'linux', 'linux2': 'linux', 'win32': 'windows'}[sys.platform] +- cpu = {'aarch64': 'arm64', 'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()] ++ cpu = {'aarch64': 'arm64', 'amd64': 'amd64', 'arm64': 'amd64', 'x86_64': 'amd64'}[platform.machine().lower()] + + rev = 'b2afae122eeb6ce09c52d63f67dc53fc517dbdc8' + url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/{}-{}/+/git_revision:{}'.format( diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 97c84110..a3442c0c 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -15,6 +15,7 @@ cd skia && \ patch -p1 < ../patch/skia-m140-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ + patch -p1 < ../patch/fetch-gn-windows-arm64.diff && \ python tools/git-sync-deps && \ bin/gn gen out/Release --args=" is_official_build=true From b1355da018f1ad3cd1c5b812fbbd7eb9d93f952c Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 11 Aug 2025 21:11:28 +0100 Subject: [PATCH 26/43] Windows pip does not like single quotes - 2nd change --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecd9a5a5..7f9d46b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install 'pybind11<3.0.0' numpy + CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl From ce1ba8529982219b18b2f5c5cb79322dec336c4a Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 11 Aug 2025 19:18:13 +0100 Subject: [PATCH 27/43] Windows pip does not like single quotes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09e1ecb9..ecd9a5a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install 'pybind11<3.0.0' numpy + CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl From 9a5766671c38284bb5ff852c227425d6b0ab068a Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 11 Aug 2025 21:11:28 +0100 Subject: [PATCH 28/43] Windows pip does not like single quotes - 2nd change --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecd9a5a5..7f9d46b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install 'pybind11<3.0.0' numpy + CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl From f160ab1d2dbe3481daadc706018be809bec546cf Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Mon, 11 Aug 2025 19:26:57 +0100 Subject: [PATCH 29/43] Use x64_64 gn binary for arm64 windows --- patch/fetch-gn-windows-arm64.diff | 11 +++++++++++ scripts/build_Windows.sh | 1 + 2 files changed, 12 insertions(+) create mode 100644 patch/fetch-gn-windows-arm64.diff diff --git a/patch/fetch-gn-windows-arm64.diff b/patch/fetch-gn-windows-arm64.diff new file mode 100644 index 00000000..bee01d3c --- /dev/null +++ b/patch/fetch-gn-windows-arm64.diff @@ -0,0 +1,11 @@ +--- a/bin/fetch-gn.orig 2025-08-11 19:21:42.666070053 +0100 ++++ b/bin/fetch-gn 2025-08-11 19:23:01.381159842 +0100 +@@ -20,7 +20,7 @@ + gnzip = os.path.join(tempfile.mkdtemp(), 'gn.zip') + with open(gnzip, 'wb') as f: + OS = {'darwin': 'mac', 'linux': 'linux', 'linux2': 'linux', 'win32': 'windows'}[sys.platform] +- cpu = {'aarch64': 'arm64', 'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()] ++ cpu = {'aarch64': 'arm64', 'amd64': 'amd64', 'arm64': 'amd64', 'x86_64': 'amd64'}[platform.machine().lower()] + + rev = 'b2afae122eeb6ce09c52d63f67dc53fc517dbdc8' + url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/{}-{}/+/git_revision:{}'.format( diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index 48064830..0ad47504 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -16,6 +16,7 @@ cd skia && \ patch -p1 < ../patch/0001-Revert-gn-Split-pdf-and-xps-from-skia.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ + patch -p1 < ../patch/fetch-gn-windows-arm64.diff && \ python tools/git-sync-deps && \ bin/gn gen out/Release --args=" is_official_build=true From 795197ab3acab0b3cf5e16c568d6ee869564ae81 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Tue, 12 Aug 2025 11:14:02 +0100 Subject: [PATCH 30/43] Can need apt-get update first before finding the correct packages --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f9d46b4..c581a710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,7 @@ jobs: - name: Build docs run: | # installing libegl1 will also install libegl-mesa0 + sudo apt-get -y update sudo apt-get -y install libegl1 python -m pip install --pre -f dist skia-python python -m pip install sphinx sphinx-rtd-theme From 3b18469a9058d3c0064beb16906e58dd07f8c4a2 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Tue, 12 Aug 2025 11:14:02 +0100 Subject: [PATCH 31/43] Can need apt-get update first before finding the correct packages --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f9d46b4..c581a710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,7 @@ jobs: - name: Build docs run: | # installing libegl1 will also install libegl-mesa0 + sudo apt-get -y update sudo apt-get -y install libegl1 python -m pip install --pre -f dist skia-python python -m pip install sphinx sphinx-rtd-theme From ac7b85a8a8fcf509f88f36dac4219412f877e9cf Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Fri, 22 Aug 2025 22:29:39 +0100 Subject: [PATCH 32/43] pybind11 3.0.1 is out; remove limitation not to use 3.0.0 --- .github/workflows/ci.yml | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c581a710..18bf2f07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy + CIBW_BEFORE_BUILD: pip install pybind11 numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy + CIBW_BEFORE_BUILD: pip install pybind11 numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl diff --git a/setup.py b/setup.py index 2f53bb30..287e277d 100644 --- a/setup.py +++ b/setup.py @@ -179,9 +179,9 @@ def build_extensions(self): data_files=data_files, install_requires=[ 'numpy', - 'pybind11>=2.6,<3.0.0' + 'pybind11>=2.6' ], - setup_requires=['pybind11>=2.6,<3.0.0'], + setup_requires=['pybind11>=2.6'], cmdclass={'build_ext': BuildExt}, classifiers=[ 'Development Status :: 4 - Beta', From c4de1dffd1b1544ae4ec7f961c2e3ed9a7906da9 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 6 Sep 2025 22:57:29 +0100 Subject: [PATCH 33/43] Roll skia on m140 (canvaskit/0.40.0-1240-gb57e04d1c7 to canvaskit/0.40.0-1244-g1fdbea293a) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index b57e04d1..1fdbea29 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit b57e04d1c7344e71688dc37cb3c118cef0255065 +Subproject commit 1fdbea293a53b270e3f5e74c92cc6670d68412ff From 329b85bd32f838c764793597e74055cd82406970 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 6 Sep 2025 23:01:32 +0100 Subject: [PATCH 34/43] Update skia to m141 (canvaskit/0.40.0-1244-g1fdbea293a to canvaskit/0.40.0-1579-g8843f919a1) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index 1fdbea29..8843f919 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 1fdbea293a53b270e3f5e74c92cc6670d68412ff +Subproject commit 8843f919a1f50ea6c11fc2e35fe9c5bc099cb09e From a4c4147d8eb203d647d3a9bf1386860805ca8c81 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 6 Sep 2025 23:02:18 +0100 Subject: [PATCH 35/43] Bump version up to 141 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 287e277d..5d81c7f0 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ pass NAME = 'skia-python' -__version__ = '140.0' +__version__ = '141.0' SKIA_PATH = os.getenv('SKIA_PATH', 'skia') SKIA_OUT_PATH = os.getenv( From 5268607c9f9ba7eb749573109783b3bbab109241 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 6 Sep 2025 23:10:20 +0100 Subject: [PATCH 36/43] m141 patch plus adjustments --- patch/skia-m141-minimize-download.patch | 70 +++++++++++++++++++++++++ scripts/build_Linux.sh | 2 +- scripts/build_Windows.sh | 2 +- scripts/build_macOS.sh | 2 +- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 patch/skia-m141-minimize-download.patch diff --git a/patch/skia-m141-minimize-download.patch b/patch/skia-m141-minimize-download.patch new file mode 100644 index 00000000..1fcf7e68 --- /dev/null +++ b/patch/skia-m141-minimize-download.patch @@ -0,0 +1,70 @@ +diff --git a/DEPS b/DEPS +index 01f37c2..4bb88bc 100644 +--- a/DEPS ++++ b/DEPS +@@ -31,53 +31,18 @@ vars = { + # ./tools/git-sync-deps + deps = { + "buildtools" : "https://chromium.googlesource.com/chromium/src/buildtools.git@729495f2ffa69080907780591fa2a630b2556e98", +- "third_party/externals/angle2" : "https://chromium.googlesource.com/angle/angle.git@1e3e4eb7f98c05e92a113524eeffb5357f68f506", +- "third_party/externals/brotli" : "https://skia.googlesource.com/external/github.com/google/brotli.git@6d03dfbedda1615c4cba1211f8d81735575209c8", +- "third_party/externals/d3d12allocator" : "https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git@169895d529dfce00390a20e69c2f516066fe7a3b", +- # Dawn requires jinja2 and markupsafe for the code generator, tint for SPIRV compilation, and abseil for string formatting. +- # When the Dawn revision is updated these should be updated from the Dawn DEPS as well. +- "third_party/externals/dawn" : "https://dawn.googlesource.com/dawn.git@b03da099c360d8f021e4de2a3dd0cfb63cbc74d9", +- "third_party/externals/jinja2" : "https://chromium.googlesource.com/chromium/src/third_party/jinja2@e2d024354e11cc6b041b0cff032d73f0c7e43a07", +- "third_party/externals/markupsafe" : "https://chromium.googlesource.com/chromium/src/third_party/markupsafe@0bad08bb207bbfc1d6f3bbc82b9242b0c50e5794", +- "third_party/externals/abseil-cpp" : "https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp@cae4b6a3990e1431caa09c7b2ed1c76d0dfeab17", +- "third_party/externals/delaunator-cpp" : "https://skia.googlesource.com/external/github.com/skia-dev/delaunator-cpp.git@98305ef6c4e862f7d48df9cc647b690d796fec68", + "third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@dbe0a676450d9b8c71bf00688bb306409b779e90", +- "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@b055c9b483e70ecd57b3cf7204db21f5a06f9ffe", +- "third_party/externals/emsdk" : "https://skia.googlesource.com/external/github.com/emscripten-core/emsdk.git@c69d433d8509c5c64564c2f0d054bf102a5cf67e", + "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@8e49998f003d693213b538ef765814c7d21abada", + "third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@1518bc83d26b434031bd12c706ac3c7dab3902fd", + "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@08b52ae2e44931eef163dbad71697f911fadc323", +- "third_party/externals/highway" : "https://chromium.googlesource.com/external/github.com/google/highway.git@424360251cdcfc314cfc528f53c872ecd63af0f0", + "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@364118a1d9da24bb5b770ac3d762ac144d6da5a4", +- "third_party/externals/icu4x" : "https://chromium.googlesource.com/external/github.com/unicode-org/icu4x.git@bcf4f7198d4dc5f3127e84a6ca657c88e7d07a13", +- "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@55d35d8387c15bf0cfd71861df67af8cfbda7456", +- "third_party/externals/libavif" : "https://skia.googlesource.com/external/github.com/AOMediaCodec/libavif.git@55aab4ac0607ab651055d354d64c4615cf3d8000", +- "third_party/externals/libgav1" : "https://chromium.googlesource.com/codecs/libgav1.git@5cf722e659014ebaf2f573a6dd935116d36eadf1", +- "third_party/externals/libgrapheme" : "https://skia.googlesource.com/external/github.com/FRIGN/libgrapheme/@c0cab63c5300fa12284194fbef57aa2ed62a94c0", + "third_party/externals/libjpeg-turbo" : "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git@e14cbfaa85529d47f9f55b0f104a579c1061f9ad", +- "third_party/externals/libjxl" : "https://chromium.googlesource.com/external/gitlab.com/wg1/jpeg-xl.git@a205468bc5d3a353fb15dae2398a101dff52f2d3", + "third_party/externals/libpng" : "https://skia.googlesource.com/third_party/libpng.git@ed217e3e601d8e462f7fd1e04bed43ac42212429", + "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@845d5476a866141ba35ac133f856fa62f0b7445f", +- "third_party/externals/libyuv" : "https://chromium.googlesource.com/libyuv/libyuv.git@d248929c059ff7629a85333699717d7a677d8d96", +- "third_party/externals/oboe" : "https://chromium.googlesource.com/external/github.com/google/oboe.git@b02a12d1dd821118763debec6b83d00a8a0ee419", +- "third_party/externals/opengl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/OpenGL-Registry@14b80ebeab022b2c78f84a573f01028c96075553", +- "third_party/externals/partition_alloc" : "https://chromium.googlesource.com/chromium/src/base/allocator/partition_allocator.git@ce13777cb731e0a60c606d1741091fd11a0574d7", +- "third_party/externals/perfetto" : "https://android.googlesource.com/platform/external/perfetto@93885509be1c9240bc55fa515ceb34811e54a394", + "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406", +- "third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@0390a544a9520c11837f7d2da99a7f480622f29c", + "third_party/externals/vulkanmemoryallocator" : "https://chromium.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator@a6bfc237255a6bac1513f7c1ebde6d8aed6b5191", +- # vulkan-deps is a meta-repo containing several interdependent Khronos Vulkan repositories. +- # When the vulkan-deps revision is updated, those repos (spirv-*, vulkan-*) should be updated as well. + "third_party/externals/vulkan-deps" : "https://chromium.googlesource.com/vulkan-deps@f55240464c0e7ad9fa42130618a2e0532a44c3b3", +- "third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@b8fcf307f1f347089e3c46eb4451d27f32ebc8d3", + "third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@3397e1e4fe0a9964e1837c2934b81835093494b8", +- "third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@392b4893c4955125c1873c33a97f2a8ee8363bd3", +- "third_party/externals/vello" : "https://skia.googlesource.com/external/github.com/linebender/vello.git@3ee3bea02164c5a816fe6c16ef4e3a810edb7620", +- "third_party/externals/vulkan-headers" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers@d1cd37e925510a167d4abef39340dbdea47d8989", +- "third_party/externals/vulkan-tools" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools@8ce6f121d1fcbdf60f0f4264e23fbcd247b9101d", +- "third_party/externals/vulkan-utility-libraries": "https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Utility-Libraries@a528f95dc2f92bdd83c0c32efe2d13c806428c9d", +- "third_party/externals/unicodetools" : "https://chromium.googlesource.com/external/github.com/unicode-org/unicodetools@66a3fa9dbdca3b67053a483d130564eabc5fe095", +- #"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4", + "third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@e3f919ccfe3ef542cfc983a82146070258fb57f8", + "third_party/externals/zlib" : "https://chromium.googlesource.com/chromium/src/third_party/zlib@646b7f569718921d7d4b5b8e22572ff6c76f2596", + +diff --git a/bin/activate-emsdk b/bin/activate-emsdk +index b3c529f..81a1c60 100755 +--- a/bin/activate-emsdk ++++ b/bin/activate-emsdk +@@ -18,6 +18,7 @@ EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py') + EMSDK_VERSION = '4.0.7' + + def main(): ++ return + if sysconfig.get_platform() in ['linux-aarch64', 'linux-arm64']: + # This platform cannot install emsdk at the provided version. See + # https://github.com/emscripten-core/emsdk/blob/main/emscripten-releases-tags.json#L5 diff --git a/scripts/build_Linux.sh b/scripts/build_Linux.sh index 06c37cd3..909ff9bc 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -19,7 +19,7 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m140-minimize-download.patch && \ + patch -p1 < ../patch/skia-m141-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 < ../patch/skia-m132-egl-runtime.diff && \ python3 tools/git-sync-deps && \ diff --git a/scripts/build_Windows.sh b/scripts/build_Windows.sh index a3442c0c..71687250 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -12,7 +12,7 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m140-minimize-download.patch && \ + patch -p1 < ../patch/skia-m141-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ patch -p1 -R < ../patch/0001-Disable-OpenGL-for-Windows-on-ARM64.patch && \ patch -p1 < ../patch/fetch-gn-windows-arm64.diff && \ diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 407204a2..fe666666 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -22,7 +22,7 @@ function apply_patch { } cd skia && \ - patch -p1 < ../patch/skia-m140-minimize-download.patch && \ + patch -p1 < ../patch/skia-m141-minimize-download.patch && \ patch -p1 < ../patch/skia-m132-colrv1-freetype.diff && \ python3 tools/git-sync-deps && \ bin/gn gen out/Release --args=" From 9d24ab3a17627fc66a92a18e233bb940d0482651 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 7 Sep 2025 01:11:15 +0100 Subject: [PATCH 37/43] m141:SkPath::moveTo() changed prototype --- src/skia/Path.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/skia/Path.cpp b/src/skia/Path.cpp index 8234ffc1..750342b6 100644 --- a/src/skia/Path.cpp +++ b/src/skia/Path.cpp @@ -877,7 +877,7 @@ path )docstring", py::arg("x"), py::arg("y")) .def("moveTo", - py::overload_cast(&SkPath::moveTo), + py::overload_cast(&SkPath::moveTo), R"docstring( Adds beginning of contour at :py:class:`Point` p. From c0d859d3fd3d6beb5a838952882a30d544ae38aa Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sun, 7 Sep 2025 20:36:15 +0100 Subject: [PATCH 38/43] pybind11 3.0.1 does not work - segfault on exit from pytest in CI. Back to 2.x Cannot reproduce segfault locally. To investigate. Revert "pybind11 3.0.1 is out; remove limitation not to use 3.0.0" This reverts commit ac7b85a8a8fcf509f88f36dac4219412f877e9cf. --- .github/workflows/ci.yml | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18bf2f07..c581a710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install pybind11 numpy + CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install pybind11 numpy + CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl diff --git a/setup.py b/setup.py index 287e277d..2f53bb30 100644 --- a/setup.py +++ b/setup.py @@ -179,9 +179,9 @@ def build_extensions(self): data_files=data_files, install_requires=[ 'numpy', - 'pybind11>=2.6' + 'pybind11>=2.6,<3.0.0' ], - setup_requires=['pybind11>=2.6'], + setup_requires=['pybind11>=2.6,<3.0.0'], cmdclass={'build_ext': BuildExt}, classifiers=[ 'Development Status :: 4 - Beta', From e8c16154524a7239435b34298510c309aaf6f289 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Tue, 16 Sep 2025 18:36:35 +0100 Subject: [PATCH 39/43] Revert "pybind11 3.0.1 does not work - segfault on exit from pytest in CI. Back to 2.x" This reverts commit c0d859d3fd3d6beb5a838952882a30d544ae38aa. --- .github/workflows/ci.yml | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c581a710..18bf2f07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy + CIBW_BEFORE_BUILD: pip install pybind11 numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl @@ -92,7 +92,7 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} CIBW_ENVIRONMENT_MACOS: TARGET_ARCH=${{ matrix.arch }} MACOSX_DEPLOYMENT_TARGET=11.0 CIBW_BEFORE_ALL: bash scripts/build_${{ runner.os }}.sh - CIBW_BEFORE_BUILD: pip install "pybind11<3.0.0" numpy + CIBW_BEFORE_BUILD: pip install pybind11 numpy CIBW_TEST_REQUIRES: pytest pillow glfw CIBW_TEST_REQUIRES_LINUX: pytest pillow glfw moderngl CIBW_TEST_REQUIRES_MACOS: pytest pillow pyopengl diff --git a/setup.py b/setup.py index a1cac2e5..5d81c7f0 100644 --- a/setup.py +++ b/setup.py @@ -179,9 +179,9 @@ def build_extensions(self): data_files=data_files, install_requires=[ 'numpy', - 'pybind11>=2.6,<3.0.0' + 'pybind11>=2.6' ], - setup_requires=['pybind11>=2.6,<3.0.0'], + setup_requires=['pybind11>=2.6'], cmdclass={'build_ext': BuildExt}, classifiers=[ 'Development Status :: 4 - Beta', From a1338ebdd1f12b4be47adbca9ba1e715214f2efe Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Tue, 16 Sep 2025 18:42:01 +0100 Subject: [PATCH 40/43] Make artefacts available even when pytest fails. This is to see why the pybind11 3.0.1 build segfaults at the end of pytest. https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18bf2f07..d6c3e436 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,7 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" - uses: actions/upload-artifact@v4 + if: always() with: name: wheel-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.cp }} path: ./wheelhouse/*.whl @@ -103,6 +104,7 @@ jobs: CIBW_TEST_SKIP: "*-macosx_arm64" - uses: actions/upload-artifact@v4 + if: always() with: name: wheel-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.cp }} path: ./wheelhouse/*.whl From 300f7305b1348563ec801fe66a000f50beadabb4 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 17 Sep 2025 00:32:42 +0100 Subject: [PATCH 41/43] Upload wheel-fedora:42 --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6c3e436..dea799b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,6 +177,10 @@ jobs: submodules: recursive - run: bash scripts/build_Linux.sh - run: python -m build --wheel + - uses: actions/upload-artifact@v4 + with: + name: wheel-fedora:42 + path: ./dist/*.whl - run: python -m pip install dist/*.whl - run: python -m pip install moderngl - run: python -c 'import moderngl; moderngl_context = moderngl.create_standalone_context(backend="egl"); import skia; interface = skia.GrGLInterface.MakeEGL() ; assert isinstance(skia.GrDirectContext.MakeGL(interface), skia.GrContext) ; print("Success3")' From 7333b2c26f7aab4a6e69106b1732d90670f15745 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 17 Sep 2025 10:44:02 +0100 Subject: [PATCH 42/43] : is not valid as artifact name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dea799b1..0724a384 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -179,7 +179,7 @@ jobs: - run: python -m build --wheel - uses: actions/upload-artifact@v4 with: - name: wheel-fedora:42 + name: wheel-fedora-42 path: ./dist/*.whl - run: python -m pip install dist/*.whl - run: python -m pip install moderngl From e54b1b2c4d1de0cdc15f227c8d31de5edb003cda Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Sat, 15 Nov 2025 21:25:25 +0000 Subject: [PATCH 43/43] Roll skia on m141 (canvaskit/0.40.0-1579-g8843f919a1 to canvaskit/0.40.0-1581-g5eefbe51d1) --- skia | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skia b/skia index 8843f919..5eefbe51 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 8843f919a1f50ea6c11fc2e35fe9c5bc099cb09e +Subproject commit 5eefbe51d17d2e379fa2d7353827e0ccb1e1f601