From c8c99dc32e4db207d911c24f094aaa4111ab9c33 Mon Sep 17 00:00:00 2001 From: nieyuyao Date: Sun, 30 Jul 2023 18:31:54 +0800 Subject: [PATCH] chore(deps): upgrade skia to m116 --- .gitmodules | 2 +- __test__/pathkit.spec.ts | 4 +-- __test__/svg-canvas.spec.ts.md | 2 +- __test__/svg-canvas.spec.ts.snap | Bin 8349 -> 8351 bytes index.js | 4 +-- scripts/build-skia.js | 8 +++--- skia | 2 +- skia-c/skia_c.cpp | 42 +++++++++++++++++++++---------- skia-c/skia_c.hpp | 6 +++-- src/global_fonts.rs | 4 +-- src/sk.rs | 6 +++-- 11 files changed, 50 insertions(+), 30 deletions(-) diff --git a/.gitmodules b/.gitmodules index a4669ba4..a77a2c57 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "skia"] path = skia url = https://github.com/google/skia.git - branch = chrome/m89 + branch = chrome/m116 [submodule "depot_tools"] path = depot_tools url = https://github.com/rust-skia/depot_tools.git diff --git a/__test__/pathkit.spec.ts b/__test__/pathkit.spec.ts index b27de371..75b5b409 100644 --- a/__test__/pathkit.spec.ts +++ b/__test__/pathkit.spec.ts @@ -180,7 +180,7 @@ test('Convert stroke to path 2', (t) => { path.stroke({ width: 10, join: StrokeJoin.Round, miterLimit: 1 }).simplify() const svg = `` - const expected = `` + const expected = `` t.is(svg, expected) }) @@ -213,7 +213,7 @@ test('StrokeJoin.Round', (t) => { t.is( box.toSVGString(), - 'M-10 100L-10 0Q-10 -0.245486 -9.98795 -0.490677Q-9.97591 -0.735867 -9.95185 -0.980171Q-9.92778 -1.22448 -9.89176 -1.4673Q-9.85574 -1.71013 -9.80785 -1.9509Q-9.75996 -2.19167 -9.70031 -2.4298Q-9.64066 -2.66793 -9.5694 -2.90285Q-9.49814 -3.13776 -9.41544 -3.3689Q-9.33274 -3.60003 -9.23879 -3.82683Q-9.14485 -4.05363 -9.03989 -4.27555Q-8.93493 -4.49747 -8.81921 -4.71397Q-8.70349 -4.93047 -8.57729 -5.14103Q-8.45108 -5.35159 -8.31469 -5.5557Q-8.17831 -5.75982 -8.03207 -5.95699Q-7.88584 -6.15417 -7.7301 -6.34393Q-7.57437 -6.5337 -7.40951 -6.71559Q-7.24465 -6.89748 -7.07107 -7.07107Q-6.89748 -7.24465 -6.71559 -7.40951Q-6.5337 -7.57437 -6.34393 -7.7301Q-6.15417 -7.88584 -5.95699 -8.03207Q-5.75982 -8.17831 -5.5557 -8.3147Q-5.35159 -8.45108 -5.14103 -8.57729Q-4.93047 -8.70349 -4.71397 -8.81921Q-4.49747 -8.93493 -4.27555 -9.03989Q-4.05363 -9.14485 -3.82683 -9.23879Q-3.60003 -9.33274 -3.3689 -9.41544Q-3.13776 -9.49814 -2.90285 -9.5694Q-2.66793 -9.64066 -2.4298 -9.70031Q-2.19167 -9.75996 -1.9509 -9.80785Q-1.71013 -9.85574 -1.4673 -9.89176Q-1.22448 -9.92778 -0.980171 -9.95185Q-0.735867 -9.97591 -0.490677 -9.98795Q-0.245486 -10 0 -10L100 -10Q100.245 -10 100.491 -9.98795Q100.736 -9.97591 100.98 -9.95185Q101.224 -9.92778 101.467 -9.89176Q101.71 -9.85574 101.951 -9.80785Q102.192 -9.75996 102.43 -9.70031Q102.668 -9.64066 102.903 -9.5694Q103.138 -9.49814 103.369 -9.41544Q103.6 -9.33274 103.827 -9.23879Q104.054 -9.14485 104.276 -9.03989Q104.497 -8.93493 104.714 -8.81921Q104.93 -8.70349 105.141 -8.57729Q105.352 -8.45108 105.556 -8.31469Q105.76 -8.17831 105.957 -8.03207Q106.154 -7.88584 106.344 -7.7301Q106.534 -7.57437 106.716 -7.40951Q106.897 -7.24465 107.071 -7.07107Q107.245 -6.89748 107.41 -6.71559Q107.574 -6.5337 107.73 -6.34393Q107.886 -6.15417 108.032 -5.95699Q108.178 -5.75982 108.315 -5.5557Q108.451 -5.35159 108.577 -5.14103Q108.703 -4.93047 108.819 -4.71397Q108.935 -4.49747 109.04 -4.27555Q109.145 -4.05363 109.239 -3.82683Q109.333 -3.60003 109.415 -3.3689Q109.498 -3.13776 109.569 -2.90285Q109.641 -2.66793 109.7 -2.4298Q109.76 -2.19167 109.808 -1.9509Q109.856 -1.71013 109.892 -1.4673Q109.928 -1.22448 109.952 -0.980171Q109.976 -0.735867 109.988 -0.490677Q110 -0.245486 110 0L110 100Q110 100.245 109.988 100.491Q109.976 100.736 109.952 100.98Q109.928 101.224 109.892 101.467Q109.856 101.71 109.808 101.951Q109.76 102.192 109.7 102.43Q109.641 102.668 109.569 102.903Q109.498 103.138 109.415 103.369Q109.333 103.6 109.239 103.827Q109.145 104.054 109.04 104.276Q108.935 104.497 108.819 104.714Q108.703 104.93 108.577 105.141Q108.451 105.352 108.315 105.556Q108.178 105.76 108.032 105.957Q107.886 106.154 107.73 106.344Q107.574 106.534 107.41 106.716Q107.245 106.897 107.071 107.071Q106.897 107.245 106.716 107.41Q106.534 107.574 106.344 107.73Q106.154 107.886 105.957 108.032Q105.76 108.178 105.556 108.315Q105.352 108.451 105.141 108.577Q104.93 108.703 104.714 108.819Q104.497 108.935 104.276 109.04Q104.054 109.145 103.827 109.239Q103.6 109.333 103.369 109.415Q103.138 109.498 102.903 109.569Q102.668 109.641 102.43 109.7Q102.192 109.76 101.951 109.808Q101.71 109.856 101.467 109.892Q101.224 109.928 100.98 109.952Q100.736 109.976 100.491 109.988Q100.245 110 100 110L0 110Q-0.245486 110 -0.490677 109.988Q-0.735867 109.976 -0.980171 109.952Q-1.22448 109.928 -1.4673 109.892Q-1.71013 109.856 -1.9509 109.808Q-2.19167 109.76 -2.4298 109.7Q-2.66793 109.641 -2.90285 109.569Q-3.13776 109.498 -3.3689 109.415Q-3.60003 109.333 -3.82683 109.239Q-4.05363 109.145 -4.27555 109.04Q-4.49747 108.935 -4.71397 108.819Q-4.93047 108.703 -5.14103 108.577Q-5.35159 108.451 -5.5557 108.315Q-5.75982 108.178 -5.95699 108.032Q-6.15417 107.886 -6.34393 107.73Q-6.5337 107.574 -6.71559 107.41Q-6.89748 107.245 -7.07107 107.071Q-7.24465 106.897 -7.40951 106.716Q-7.57437 106.534 -7.7301 106.344Q-7.88584 106.154 -8.03207 105.957Q-8.17831 105.76 -8.3147 105.556Q-8.45108 105.352 -8.57729 105.141Q-8.70349 104.93 -8.81921 104.714Q-8.93493 104.497 -9.03989 104.276Q-9.14485 104.054 -9.23879 103.827Q-9.33274 103.6 -9.41544 103.369Q-9.49814 103.138 -9.5694 102.903Q-9.64066 102.668 -9.70031 102.43Q-9.75996 102.192 -9.80785 101.951Q-9.85574 101.71 -9.89176 101.467Q-9.92778 101.224 -9.95185 100.98Q-9.97591 100.736 -9.98795 100.491Q-10 100.245 -10 100ZM10 10L10 90L90 90L90 10L10 10Z', + 'M-10 100L-10 0Q-10 -0.245486 -9.98796 -0.490677Q-9.97591 -0.735867 -9.95185 -0.980171Q-9.92779 -1.22448 -9.89176 -1.4673Q-9.85574 -1.71013 -9.80785 -1.9509Q-9.75996 -2.19167 -9.70031 -2.4298Q-9.64067 -2.66793 -9.5694 -2.90285Q-9.49814 -3.13776 -9.41544 -3.3689Q-9.33274 -3.60003 -9.2388 -3.82683Q-9.14485 -4.05363 -9.03989 -4.27555Q-8.93493 -4.49747 -8.81921 -4.71397Q-8.70349 -4.93047 -8.57729 -5.14103Q-8.45108 -5.35159 -8.3147 -5.5557Q-8.17831 -5.75982 -8.03208 -5.95699Q-7.88584 -6.15417 -7.73011 -6.34393Q-7.57437 -6.5337 -7.40951 -6.71559Q-7.24465 -6.89748 -7.07107 -7.07107Q-6.89748 -7.24465 -6.71559 -7.40951Q-6.5337 -7.57437 -6.34393 -7.7301Q-6.15417 -7.88584 -5.95699 -8.03207Q-5.75982 -8.17831 -5.5557 -8.3147Q-5.35159 -8.45108 -5.14103 -8.57729Q-4.93047 -8.70349 -4.71397 -8.81921Q-4.49747 -8.93493 -4.27555 -9.03989Q-4.05363 -9.14485 -3.82683 -9.23879Q-3.60003 -9.33274 -3.3689 -9.41544Q-3.13776 -9.49814 -2.90285 -9.5694Q-2.66793 -9.64067 -2.4298 -9.70031Q-2.19167 -9.75996 -1.9509 -9.80785Q-1.71013 -9.85574 -1.4673 -9.89176Q-1.22448 -9.92778 -0.980171 -9.95185Q-0.735867 -9.97591 -0.490677 -9.98796Q-0.245486 -10 0 -10L100 -10Q100.245 -10 100.491 -9.98795Q100.736 -9.97591 100.98 -9.95185Q101.224 -9.92779 101.467 -9.89176Q101.71 -9.85574 101.951 -9.80785Q102.192 -9.75996 102.43 -9.70031Q102.668 -9.64067 102.903 -9.5694Q103.138 -9.49814 103.369 -9.41544Q103.6 -9.33274 103.827 -9.2388Q104.054 -9.14485 104.276 -9.03989Q104.497 -8.93493 104.714 -8.81921Q104.93 -8.70349 105.141 -8.57729Q105.352 -8.45108 105.556 -8.3147Q105.76 -8.17831 105.957 -8.03208Q106.154 -7.88584 106.344 -7.73011Q106.534 -7.57437 106.716 -7.40951Q106.897 -7.24465 107.071 -7.07107Q107.245 -6.89748 107.41 -6.71559Q107.574 -6.5337 107.73 -6.34393Q107.886 -6.15417 108.032 -5.95699Q108.178 -5.75982 108.315 -5.5557Q108.451 -5.35159 108.577 -5.14103Q108.703 -4.93047 108.819 -4.71397Q108.935 -4.49747 109.04 -4.27555Q109.145 -4.05363 109.239 -3.82683Q109.333 -3.60003 109.415 -3.3689Q109.498 -3.13776 109.569 -2.90285Q109.641 -2.66793 109.7 -2.4298Q109.76 -2.19167 109.808 -1.9509Q109.856 -1.71013 109.892 -1.4673Q109.928 -1.22448 109.952 -0.980171Q109.976 -0.735867 109.988 -0.490677Q110 -0.245486 110 0L110 100Q110 100.245 109.988 100.491Q109.976 100.736 109.952 100.98Q109.928 101.224 109.892 101.467Q109.856 101.71 109.808 101.951Q109.76 102.192 109.7 102.43Q109.641 102.668 109.569 102.903Q109.498 103.138 109.415 103.369Q109.333 103.6 109.239 103.827Q109.145 104.054 109.04 104.276Q108.935 104.497 108.819 104.714Q108.703 104.93 108.577 105.141Q108.451 105.352 108.315 105.556Q108.178 105.76 108.032 105.957Q107.886 106.154 107.73 106.344Q107.574 106.534 107.41 106.716Q107.245 106.897 107.071 107.071Q106.897 107.245 106.716 107.41Q106.534 107.574 106.344 107.73Q106.154 107.886 105.957 108.032Q105.76 108.178 105.556 108.315Q105.352 108.451 105.141 108.577Q104.93 108.703 104.714 108.819Q104.497 108.935 104.276 109.04Q104.054 109.145 103.827 109.239Q103.6 109.333 103.369 109.415Q103.138 109.498 102.903 109.569Q102.668 109.641 102.43 109.7Q102.192 109.76 101.951 109.808Q101.71 109.856 101.467 109.892Q101.224 109.928 100.98 109.952Q100.736 109.976 100.491 109.988Q100.245 110 100 110L0 110Q-0.245486 110 -0.490677 109.988Q-0.735867 109.976 -0.980171 109.952Q-1.22448 109.928 -1.4673 109.892Q-1.71013 109.856 -1.9509 109.808Q-2.19167 109.76 -2.4298 109.7Q-2.66793 109.641 -2.90285 109.569Q-3.13776 109.498 -3.3689 109.415Q-3.60003 109.333 -3.82683 109.239Q-4.05363 109.145 -4.27555 109.04Q-4.49747 108.935 -4.71397 108.819Q-4.93047 108.703 -5.14103 108.577Q-5.35159 108.451 -5.5557 108.315Q-5.75982 108.178 -5.95699 108.032Q-6.15417 107.886 -6.34393 107.73Q-6.5337 107.574 -6.71559 107.41Q-6.89748 107.245 -7.07107 107.071Q-7.24465 106.897 -7.40951 106.716Q-7.57437 106.534 -7.7301 106.344Q-7.88584 106.154 -8.03207 105.957Q-8.17831 105.76 -8.3147 105.556Q-8.45108 105.352 -8.57729 105.141Q-8.70349 104.93 -8.81921 104.714Q-8.93493 104.497 -9.03989 104.276Q-9.14485 104.054 -9.23879 103.827Q-9.33274 103.6 -9.41544 103.369Q-9.49814 103.138 -9.5694 102.903Q-9.64067 102.668 -9.70031 102.43Q-9.75996 102.192 -9.80785 101.951Q-9.85574 101.71 -9.89176 101.467Q-9.92778 101.224 -9.95185 100.98Q-9.97591 100.736 -9.98796 100.491Q-10 100.245 -10 100ZM10 10L10 90L90 90L90 10L10 10Z', ) }) diff --git a/__test__/svg-canvas.spec.ts.md b/__test__/svg-canvas.spec.ts.md index d65a4988..5b3d5ab7 100644 --- a/__test__/svg-canvas.spec.ts.md +++ b/__test__/svg-canvas.spec.ts.md @@ -12,7 +12,7 @@ Generated by [AVA](https://avajs.dev). ␊ - ␊ + ` ## should be able to export text diff --git a/__test__/svg-canvas.spec.ts.snap b/__test__/svg-canvas.spec.ts.snap index e3addf9ee9d8d4ebb48c3687b29751c4ecff621f..fffa9a03d8797a979df2cb9941daf5f497c279fd 100644 GIT binary patch delta 7760 zcmYjVWl&trw#D7u9fDhc;0f;THoIF!9*{!*H8XZZlCsgw92RVSE+1YV|R^25*sq$qyU&m%9$upx*t2t1!X_+%_H?m_xA zerB73S@qu5bX9%$y`VFAa#Px%PAT@3249RK@2!83Qq8kwZ#x=gi|~OJu-agm+xUTD zuen^(C86mwAGHdHE=_}tiT7(oy{dYls`h7%;=s%ZuBrjlGt80Jysw!J`Cx5Un#>PU z-<4P;v{p0o-C3pFdqIB$@mvugZu*c)4E@Q#h2m)a?Ehevi^RtOmga{1|PUfo?39*hU6avC?7c9UXS?els`$Q@6k&c_VW++de?9_ z`|Y@Plap!K@OsyBM;ot^pvL6elQybEE7U5{>m_r8wyCvL8dek}4rRVod>>nlk4o@+ ze@I!+-VwE`nW?aOIcuHfpEEsZ=0!~;kJyD= zGZZ%KC>mVI?A*N^tsb~TGIs_ic=)YO0ztTB=SPBNMoE9u`&}=5pW|XGw5H~{q9~)0 z_-Y4B$EaTJoXz*;!2#k@>6vr8)|+qYGsh9t{0l}|qoC_|Fz!RW-GPlGuZwyZ4R6+9 zE?%qg!%Fe*2f*#!aSuo2cL#xHuYC+OuenMRI!;l!Z9^7B-hsDs9=tbj5oSUUY5PL! zx&^e}KpJG;#ExOHDN*x$PlCrx9U^5-`yuTeNK;@e>J)4mOu-#6^pj?H+?kM&_yl)YB=u#`9`^eFJ51tmJZ9?tHg!Sup?ZSFrBgrBRVd0w=P!y+G$8!x4)1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*<-Nlej+_s3W(Wib%_`>d8J80VB z0&cZ$j>zo*aXVbVK6UwUuj^i{Wc$9Y#~Zd3VR2+mC*6eWG?b*9$U z`1cb-VAdG-*+w19@>7UlDToiZXK`N0UGRbV<9%XCZ}R0jZu)3mND)%APdyC`aA?l5 zb+)edMqcOw=Cj_hY{;#9A^1`w_GKi$#fw|L?IpPHe7!o6|6Vr#1?&Zh-Ot&&?Ea_P z@@PbF$+iRD$&UF0X=GkVZ|cQ*^)ml`oOOXuy{5y(;_(Cop$%K>AX^Op+-Dm&9h#Gf z{ij>zQZdpIs97+Z*d!4IY<00jH@ z=glsZ?)y4V{rc_z*d0jP@DiuAR;n0sh+qfeKcgV->yR#Awi06>YV*$=hJJ05KGW9M z2EcyKf7tAT{@n}#ku%11lN} z*1(_#-81t!cw~G@)SLd}g-&Qc{h_lc;-9fyXR~m=vs(5PntU*b{M&9j7-T!9cZzeh z+1d9%@VwNC(%n`Ed5LAmjlP(x^n<}?RN5TPte$l^UCcha{9H=!(DyLwHT<f6E z_c<0`S7F<_M4Atmb}x13idFY^||uUDe^-TI>t4$qoNIE5GrSSoR>$Ew z$>u7|EhRe$_lDOs{1Y?aZ1!2Ss+PSfIl3+Ir1P}WPXT_#GZ(Xz4kvIi+cw5sULxIe aC!8cU%bkmyUh>d>7G9GQ;%zlSLi!(4ru{|$ diff --git a/index.js b/index.js index 3b8719b5..7ee4ab40 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ const Fonts = [] if (!('families' in GlobalFonts)) { Object.defineProperty(GlobalFonts, 'families', { get: function () { - return JSON.parse(GlobalFonts.getFamilies()) + return JSON.parse(GlobalFonts.getFamilies().toString()) }, }) } @@ -42,7 +42,7 @@ if (!('families' in GlobalFonts)) { if (!('has' in GlobalFonts)) { Object.defineProperty(GlobalFonts, 'has', { value: function has(name) { - return !!JSON.parse(GlobalFonts.getFamilies()).find(({ family }) => family === name) + return !!JSON.parse(GlobalFonts.getFamilies().toString()).find(({ family }) => family === name) }, configurable: false, enumerable: false, diff --git a/scripts/build-skia.js b/scripts/build-skia.js index 7c3e5af5..f2899e23 100644 --- a/scripts/build-skia.js +++ b/scripts/build-skia.js @@ -158,11 +158,11 @@ switch (TARGET_TRIPLE) { case 'aarch64-unknown-linux-musl': const gccVersion = execSync('ls /aarch64-linux-musl-cross/aarch64-linux-musl/include/c++').toString('utf8').trim() ExtraSkiaBuildFlag += ' target_cpu="arm64" target_os="linux"' - ExtraCflags = `"--target=aarch64-unknown-linux-musl", "--sysroot=/aarch64-linux-musl-cross/aarch64-linux-musl", "--gcc-toolchain=aarch64-linux-musl-gcc", "-B/aarch64-linux-musl-cross/aarch64-linux-musl/bin", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}/aarch64-linux-musl", "-march=armv8-a"` - ExtraCflagsCC += `, "--target=aarch64-unknown-linux-musl", "--sysroot=/aarch64-linux-musl-cross/aarch64-linux-musl", "--gcc-toolchain=aarch64-linux-musl-gcc", "-B/aarch64-linux-musl-cross/aarch64-linux-musl/bin", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}/aarch64-linux-musl", "-march=armv8-a"` - ExtraLdFlags = `"--target=aarch64-unknown-linux-musl", "--sysroot=/aarch64-linux-musl-cross/usr", "-B/aarch64-linux-musl-cross/usr/aarch64-linux-musl/bin", "-L/aarch64-linux-musl-cross/usr/aarch64-linux-musl/lib", "-L/aarch64-linux-musl-cross/usr/lib/gcc/aarch64-linux-musl/${gccVersion}"` + ExtraCflags = `"--target=aarch64-unknown-linux-musl", "-B/aarch64-linux-musl-cross/aarch64-linux-musl/bin", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}/aarch64-linux-musl", "-march=armv8-a"` + ExtraCflagsCC += `, "--target=aarch64-unknown-linux-musl", "-B/aarch64-linux-musl-cross/aarch64-linux-musl/bin", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}", "-I/aarch64-linux-musl-cross/aarch64-linux-musl/include/c++/${gccVersion}/aarch64-linux-musl", "-march=armv8-a"` + ExtraLdFlags = `"--target=aarch64-unknown-linux-musl", "-B/aarch64-linux-musl-cross/usr/aarch64-linux-musl/bin", "-L/aarch64-linux-musl-cross/usr/aarch64-linux-musl/lib", "-L/aarch64-linux-musl-cross/usr/lib/gcc/aarch64-linux-musl/${gccVersion}"` ExtraAsmFlags = - '"--sysroot=/aarch64-linux-musl-cross/aarch64-linux-musl", "--target=aarch64-unknown-linux-musl", "-march=armv8-a"' + '"--target=aarch64-unknown-linux-musl", "-march=armv8-a"' GN_ARGS.push( `extra_ldflags=[${ExtraLdFlags}]`, `ar="aarch64-linux-musl-ar"`, diff --git a/skia b/skia index d13352a7..7bfc95e8 160000 --- a/skia +++ b/skia @@ -1 +1 @@ -Subproject commit d13352a7937791d666f770ac7026085dc844c006 +Subproject commit 7bfc95e8576e909bd0ecab9c9c6ff9280e2f473c diff --git a/skia-c/skia_c.cpp b/skia-c/skia_c.cpp index 4b394c13..d1c9ea1c 100644 --- a/skia-c/skia_c.cpp +++ b/skia-c/skia_c.cpp @@ -21,7 +21,7 @@ extern "C" { void SkStrSplit(const char* str, const char* delimiters, - SkTArray* out) { + skia_private::TArray* out) { // Skip any delimiters. str += strspn(str, delimiters); if (!*str) { @@ -93,7 +93,7 @@ extern "C" SkGraphics::Init(); auto color_space = COLOR_SPACE_CAST; auto info = SkImageInfo::Make(width, height, kRGBA_8888_SkColorType, alphaType, color_space); - auto surface = SkSurface::MakeRaster(info); + auto surface = SkSurfaces::Raster(info); if (surface) { @@ -140,7 +140,7 @@ extern "C" bool skiac_surface_save(skiac_surface *c_surface, const char *path) { auto image = SURFACE_CAST->makeImageSnapshot(); - auto data = image->encodeToData(SkEncodedImageFormat::kPNG, 0); + auto data = SkPngEncoder::Encode(nullptr, image.release(), SkPngEncoder::Options()); if (data) { SkFILEWStream stream(path); @@ -220,24 +220,36 @@ extern "C" void skiac_surface_png_data(skiac_surface *c_surface, skiac_sk_data *data) { auto image = SURFACE_CAST->makeImageSnapshot(); - auto png_data = image->encodeToData().release(); + auto png_data = SkPngEncoder::Encode(nullptr, image.release(), SkPngEncoder::Options()); if (png_data) { data->ptr = png_data->bytes(); data->size = png_data->size(); - data->data = reinterpret_cast(png_data); + data->data = reinterpret_cast(png_data.release()); } } void skiac_surface_encode_data(skiac_surface *c_surface, skiac_sk_data *data, int format, int quality) { auto image = SURFACE_CAST->makeImageSnapshot(); - auto encoded_data = image->encodeToData((SkEncodedImageFormat)format, quality).release(); + sk_sp encoded_data; + if (format == int(SkEncodedImageFormat::kJPEG)) { + SkJpegEncoder::Options options; + options.fQuality = quality; + encoded_data = SkJpegEncoder::Encode(nullptr, image.release(), options); + } else if (format == int(SkEncodedImageFormat::kPNG)) { + encoded_data = SkPngEncoder::Encode(nullptr, image.release(), SkPngEncoder::Options()); + } else if (format == int(SkEncodedImageFormat::kWEBP)){ + SkWebpEncoder::Options options; + options.fCompression = quality == 100 ? SkWebpEncoder::Compression::kLossless : SkWebpEncoder::Compression::kLossy; + options.fQuality = quality == 100 ? 75 : quality; + encoded_data = SkWebpEncoder::Encode(nullptr, image.release(), options); + } if (encoded_data) { data->ptr = const_cast(encoded_data->bytes()); data->size = encoded_data->size(); - data->data = reinterpret_cast(encoded_data); + data->data = reinterpret_cast(encoded_data.release()); } } @@ -323,7 +335,7 @@ extern "C" { const auto src_rect = SkRect::MakeXYWH(sx, sy, s_width, s_height); const auto dst_rect = SkRect::MakeXYWH(dx, dy, d_width, d_height); - auto sk_image = SkImage::MakeFromBitmap(*BITMAP_CAST); + auto sk_image = SkImages::RasterFromBitmap(*BITMAP_CAST); auto fq = enable_smoothing ? filter_quality : 0; const auto sampling = SamplingOptionsFromFQ(fq); auto paint = reinterpret_cast(c_paint); @@ -403,7 +415,7 @@ extern "C" auto font_collection = c_collection->collection; auto font_style = SkFontStyle(weight, stretch, (SkFontStyle::Slant)slant); auto text_direction = (TextDirection)direction; - SkTArray families; + skia_private::TArray families; SkStrSplit(font_family, ",", &families); TextStyle text_style; std::vector families_vec; @@ -612,7 +624,7 @@ extern "C" auto color_space = COLOR_SPACE_CAST; auto info = SkImageInfo::Make(width, height, SkColorType::kRGBA_8888_SkColorType, SkAlphaType::kUnpremul_SkAlphaType, color_space); auto data = SkData::MakeFromMalloc(pixels, length); - auto image = SkImage::MakeRasterData(info, data, row_bytes); + auto image = SkImages::RasterFromData(info, data, row_bytes); auto src_rect = SkRect::MakeXYWH(dirty_x, dirty_y, dirty_width, dirty_height); auto dst_rect = SkRect::MakeXYWH(x + dirty_x, y + dirty_y, dirty_width, dirty_height); const auto sampling = SkSamplingOptions(SkCubicResampler::Mitchell()); @@ -1396,7 +1408,7 @@ extern "C" skiac_image_filter *skiac_image_filter_from_argb(const uint8_t table_a[256], const uint8_t table_r[256], const uint8_t table_g[256], const uint8_t table_b[256], skiac_image_filter *c_image_filter) { - auto cf = SkTableColorFilter::MakeARGB(table_a, table_r, table_g, table_b); + auto cf = SkColorFilters::TableARGB(table_a, table_r, table_g, table_b); auto chained_filter = sk_sp(IMAGE_FILTER_CAST); if (c_image_filter) { @@ -1547,7 +1559,12 @@ extern "C" return c_font_collection->assets->countFamilies(); } - void skiac_font_collection_get_family(skiac_font_collection *c_font_collection, uint32_t i, skiac_string *c_string, void *on_get_style_rust, skiac_on_match_font_style on_match_font_style) + void skiac_font_collection_get_family( + skiac_font_collection *c_font_collection, + uint32_t i, + skiac_string *c_string, + void *on_get_style_rust, + skiac_on_match_font_style on_match_font_style) { auto name = new SkString(); c_font_collection->assets->getFamilyName(i, name); @@ -1562,7 +1579,6 @@ extern "C" on_match_font_style(style.width(), style.weight(), (int)style.slant(), on_get_style_rust); } } - font_style_set->unref(); c_string->length = name->size(); c_string->ptr = name->c_str(); c_string->sk_string = name; diff --git a/skia-c/skia_c.hpp b/skia-c/skia_c.hpp index e04fb144..68998188 100644 --- a/skia-c/skia_c.hpp +++ b/skia-c/skia_c.hpp @@ -28,10 +28,12 @@ #include #include #include -#include #include #include #include +#include +#include +#include #include #include #include @@ -111,7 +113,7 @@ class TypefaceFontProviderCustom : public TypefaceFontProvider { return nullptr; } - return sk_sp(const_cast(tf)); + return sk_sp(tf); } private: diff --git a/src/global_fonts.rs b/src/global_fonts.rs index 0f4b0abf..51262ada 100644 --- a/src/global_fonts.rs +++ b/src/global_fonts.rs @@ -52,9 +52,9 @@ pub mod GlobalFonts { } #[napi] - pub fn get_families() -> Result { + pub fn get_families() -> Result { let font = get_font().map_err(into_napi_error)?; - Ok(serde_json::to_string(&font.get_families())?) + Ok(serde_json::to_vec(&font.get_families())?.into()) } #[napi] diff --git a/src/sk.rs b/src/sk.rs index 9646b4fd..a6cc2480 100644 --- a/src/sk.rs +++ b/src/sk.rs @@ -3517,7 +3517,7 @@ impl FontCollection { unsafe { let size = ffi::skiac_font_collection_get_default_fonts_count(self.0); for i in 0..size { - let mut styles = Vec::new(); + let mut styles = Vec::with_capacity(4); let on_get_style: Box = Box::new(|width: i32, weight: i32, slant: i32| { styles.push(( @@ -3536,14 +3536,16 @@ impl FontCollection { length: 0, sk_string: ptr::null_mut(), }; + let on_get_style_ptr: *mut dyn FnMut(i32, i32, i32) = Box::into_raw(Box::new(on_get_style)); ffi::skiac_font_collection_get_family( self.0, i, &mut name, - Box::into_raw(Box::new(on_get_style)) as *mut c_void, + on_get_style_ptr.cast(), Some(skiac_on_get_style), ); let c_str: &CStr = CStr::from_ptr(name.ptr); + drop(Box::from_raw(on_get_style_ptr)); names.push(FontStyleSet { family: c_str.to_string_lossy().into_owned(), styles: styles