diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89c2e7e4..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 @@ -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 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/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/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/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..d39e104e 100644 --- a/scripts/build_Linux.sh +++ b/scripts/build_Linux.sh @@ -19,7 +19,8 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m138-minimize-download.patch && \ + 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 85df523e..0ad47504 100644 --- a/scripts/build_Windows.sh +++ b/scripts/build_Windows.sh @@ -12,10 +12,11 @@ fi # Build skia cd skia && \ - patch -p1 < ../patch/skia-m138-minimize-download.patch && \ + 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 && \ + patch -p1 < ../patch/fetch-gn-windows-arm64.diff && \ python tools/git-sync-deps && \ bin/gn gen out/Release --args=" is_official_build=true diff --git a/scripts/build_macOS.sh b/scripts/build_macOS.sh index 25869913..ecc331b6 100644 --- a/scripts/build_macOS.sh +++ b/scripts/build_macOS.sh @@ -22,7 +22,8 @@ function apply_patch { } cd skia && \ - patch -p1 < ../patch/skia-m138-minimize-download.patch && \ + 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=" diff --git a/setup.py b/setup.py index f0e2b708..88b4542f 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( @@ -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', @@ -179,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', diff --git a/skia b/skia index 114d33c6..87d8e1a2 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit 114d33c62998ce5c16f899b9123c22000ca06ddd +Subproject commit 87d8e1a22e2b6d8ed039a53091abfd81691e6eb6 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.