Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
c53ded1
New README.m116
HinTak Jul 27, 2023
55ee755
Bump version up to 116.0
HinTak Jul 27, 2023
637db9c
<skia.h> is not built. Probably best to use individual ones.
HinTak Jul 28, 2023
e48bdc5
m116 uses std::byte,std::void_t,std::optional and requires C++17
HinTak Jul 28, 2023
ff44705
m88 breakage fix for SVGDOM
HinTak Jul 9, 2023
26fae95
Clang warns of error: member access into incomplete type 'SkSVGSVG'
HinTak Jul 10, 2023
c89083f
There is no SkSVGDOM::SkSVGDOM() beyond m87.
HinTak Jul 10, 2023
7365232
have libsvg.so
HinTak Jul 10, 2023
a221dc1
In m88, GrContext was gone and replaced by GrDirectContext or GrRecor…
HinTak Jul 30, 2023
c274131
m88: Remove GrDirectContext->GrContext inheritance; GrContext is enti…
HinTak Jul 30, 2023
00076fb
m88: Manual fix up of GrContext->GrDirectContext change.
HinTak Jul 10, 2023
0ba031a
A lot of includes for non-obvious types
HinTak Jul 30, 2023
53a2d94
m88: prototype change of GrBackendFormat::MakeMock()
HinTak Jul 10, 2023
b2c5b0c
m113: SK_GANESH needs to be defined for SK_SUPPORT_GPU=1
HinTak Jul 30, 2023
fa86dc1
Overloaded methods: SkBitmap::erase()
HinTak Jul 30, 2023
58cc387
m89 overloads SkCanvas::setMatrix()
HinTak Jul 30, 2023
43d5da6
m106 overloads SkColorFilters::Blend()
HinTak Jul 30, 2023
78dbe0a
Revert "m88: Remove GrDirectContext->GrContext inheritance; GrContext…
HinTak Jul 30, 2023
bc6d6c5
m88 combined GrDirectContext+GrContext - so it has both sets of methods.
HinTak Jul 30, 2023
b6a7254
m113 Bulk changes for SkImage->SkImages
HinTak Jul 30, 2023
6fc4b5d
m97: SkImage::BitDepth -> SkImages::BitDepth
HinTak Jul 30, 2023
fce0e04
m114: Deprecate SkImage::encodeToData and migrate all internal uses
HinTak Jul 30, 2023
49cd940
m98: New optional argument
HinTak Jul 30, 2023
2b0a121
Another typo
HinTak Jul 31, 2023
7464b89
m93: overloads SkPathEffect::filterPath()
HinTak Jul 30, 2023
b1acf6c
In m116, SkShaders is a namespace rather than a class
HinTak Jul 30, 2023
2af0661
m93: Just expose factories for patheffects
HinTak Jul 31, 2023
28a1924
SkSurfaceProps::kLegacyFontHost_InitType was removed in m88
HinTak Jul 31, 2023
991ba26
A lot of very questionable comment-out. REVISIT LATER!!
HinTak Jul 31, 2023
f9e31bf
New SamplingOptions class
HinTak Aug 1, 2023
c4f32eb
New SamplingOptions in drawImage() and drawImageRect()
HinTak Aug 1, 2023
85ef81e
New SamplingOptions in drawAtlas too
HinTak Aug 1, 2023
82eb6fb
Better naming
HinTak Aug 2, 2023
a1d3d1b
m90: drawBitmap/drawBitmapRect are gone. Emulate with drawImage/drawI…
HinTak Aug 1, 2023
cfe73ab
m91: Remove legacy colorfilter flags
HinTak Aug 1, 2023
40cf5e6
m104: changes in SkPDF::AttributeList
HinTak Aug 1, 2023
0a62144
m113: `SkImage::CompressionType` has been renamed to `SkTextureCompre…
HinTak Aug 1, 2023
cc0dddc
Missing header for some of the code.
HinTak Aug 1, 2023
6338785
Backward compatiblity - Make "GrDirectContext" alias of "GrContext".
HinTak Aug 1, 2023
31f9cd2
m113: SkImage::CompressionType -> SkTextureCompressionType
HinTak Aug 1, 2023
189e2db
Needs new include for std::nullopt
HinTak Jul 31, 2023
f603934
m97: SkImage::BitDepth -> SkImages::BitDepth
HinTak Jul 31, 2023
640eda1
m111 SkBudgeted -> skgpu::Budgeted in include/gpu/GpuTypes.h
HinTak Jul 31, 2023
2682d0f
one more SkSamplingOptions
HinTak Aug 1, 2023
14fb480
Emulate encodeToData
HinTak Aug 1, 2023
9c69fc1
more emulate encodeToData
HinTak Aug 1, 2023
42ac88f
scalePixels prototype change from SkSamplingOptions()
HinTak Aug 1, 2023
e6e0b35
Notes on removal of SkPath::shrinkToFit
HinTak Jul 31, 2023
5f38f6b
m89: forceClose removed.
HinTak Aug 1, 2023
3d9797c
m93: They no longer inherit from SkPathEffect
HinTak Aug 1, 2023
34f9045
m88: Another SamplingOptions
HinTak Aug 1, 2023
f4cc3fe
m115 surface->surfaces changes
HinTak Jul 31, 2023
7510919
SkSurfaces::RenderTarget is in SkSurfaceGanesh.h
HinTak Jul 31, 2023
cdd85dd
m115: `SkSurface::getBackendTexture` and `SkSurface::getBackendRender…
HinTak Aug 1, 2023
d33a7cc
m116 `SkSurface::BackendSurfaceAccess` is now in the `SkSurfaces` nam…
HinTak Jul 31, 2023
17b7101
m111 SkBudgeted -> skgpu::Budgeted in include/gpu/GpuTypes.h
HinTak Jul 31, 2023
f45feca
Emulate old SkSurface:: constructor, and SkSurface::MakeRasterN32Prem…
HinTak Jul 31, 2023
e844131
m89: Removing SkFilterQuality - that seems to be generally gone
HinTak Aug 1, 2023
1a61f14
m93: Usage of Flattenable changed.
HinTak Jul 31, 2023
94f6c57
More SkImage:: to SkImages::
HinTak Aug 1, 2023
bea23a4
Undo a lot of comment-out, in preparation to merge with pre-m116.0-rc1
HinTak Aug 2, 2023
66ab001
Merge branch 'pre-m116.0-rc1' into m116-public
HinTak Aug 2, 2023
17fffa5
Narrowing the scope of the commenting-out. RE-VISIT!!!
HinTak Aug 2, 2023
5052a1b
Class inheritance changed
HinTak Aug 1, 2023
315ecb2
m116: The deprecated `SkTableColorFilter` class and its methods have …
HinTak Aug 1, 2023
13611da
Comment out test on private method
HinTak Aug 1, 2023
1532e43
New SamplingOptions() in tests
HinTak Aug 1, 2023
7defc46
New SamplingOptions() in tests
HinTak Aug 1, 2023
f13a556
Sync to skia chrome/m116 in the submodule.
HinTak Aug 2, 2023
671f676
skia-m116-minimize-download.patch
HinTak Aug 2, 2023
4c19e0d
The build script has no business doing sys-admin tasks!
HinTak Aug 2, 2023
8b536ec
Adjusting to m91+ way of building the SVG module
HinTak Aug 2, 2023
dee8b1b
Adding the minimize download patch to build script
HinTak Aug 2, 2023
04456dd
Further adjusting build script for m116; not sure we should use old gn
HinTak Aug 2, 2023
0b64ff5
patch no longer apply; just as well
HinTak Aug 2, 2023
a3fd179
patch no-longer apply
HinTak Aug 2, 2023
5c18a9c
Shared libraries compile but does not load - switch back to static li…
HinTak Aug 2, 2023
15dd24a
These attributes are not (yet) available under m116; may never be. RE…
HinTak Jul 31, 2023
792c21d
tests/test_font.py: this segfaults. REVISIT!!!
HinTak Jul 31, 2023
0fc4b49
Updating build dependencies
HinTak Aug 2, 2023
1b676ce
Merge branch 'main' of github.com:kyamagu/skia-python into m116-public
HinTak Aug 2, 2023
392a9bd
Revert "The build script has no business doing sys-admin tasks!"
HinTak Aug 2, 2023
c5e1271
Run yum tasks only if the script is run as root (in CI)
HinTak Aug 2, 2023
4b6ed1a
Revert "Further adjusting build script for m116; not sure we should u…
HinTak Aug 2, 2023
3d6980b
Try to use python3 explicitly - it looks like this is why CI failed.
HinTak Aug 2, 2023
5e21c3f
make_data_assembly.patch no-longer applies
HinTak Aug 2, 2023
27198b0
Adjust MacOS/Windows build script according to m91+ way of building s…
HinTak Aug 2, 2023
cdffda0
Update the windows and macos section of setup.py for svg m88+
HinTak Aug 2, 2023
8cf897f
The build host's freetype is too old to support features in skia m116…
HinTak Aug 2, 2023
4146f26
Use a more recent gn 2082 from 1774, as it seems to do with m116 on m…
HinTak Aug 2, 2023
a39eeb3
CI problem with MacOS X: python is python2
HinTak Aug 2, 2023
3681201
SK_GL needs to have SK_GANESH defined to work
HinTak Aug 2, 2023
959157b
skunicode.lib uses __imp_RegCloseKey etc from Advapi32; CI Failure
HinTak Aug 3, 2023
4d91010
../patch/find_xcode_sysroot.patch no longer applies; CI failure
HinTak Aug 3, 2023
91e7141
m116 needs c++17;Mac OS X CI failure
HinTak Aug 3, 2023
246af97
Undo a lot of comment-out, in preparation to merge with pre-m116.0-rc2
HinTak Aug 4, 2023
2067f34
Adjusting to m91+ way of building the SVG module
HinTak Aug 2, 2023
3445c28
Adding the minimize download patch to build script
HinTak Aug 2, 2023
6328c06
patch no longer apply; just as well
HinTak Aug 2, 2023
fbb9aac
patch no-longer apply
HinTak Aug 4, 2023
fb1b994
Run yum tasks only if the script is run as root (in CI)
HinTak Aug 2, 2023
d12bbe0
Try to use python3 explicitly - it looks like this is why CI failed.
HinTak Aug 4, 2023
1a10066
make_data_assembly.patch no-longer applies
HinTak Aug 2, 2023
7e04252
Adjust MacOS/Windows build script according to m91+ way of building s…
HinTak Aug 2, 2023
69ba47c
skia-m116-minimize-download.patch
HinTak Aug 2, 2023
2da7ac7
The build host's freetype is too old to support features in skia m116…
HinTak Aug 2, 2023
dbedc09
Use a more recent gn 2082 from 1774, as it seems to do with m116 on m…
HinTak Aug 2, 2023
0da5cfd
CI problem with MacOS X: python is python2
HinTak Aug 2, 2023
a2dbdb1
../patch/find_xcode_sysroot.patch no longer applies; CI failure
HinTak Aug 3, 2023
9a06317
Exposure COLRv1 functionality to skia-python + freetype-py's use
HinTak Aug 3, 2023
6c59fc0
Adding SkSVGDOM::renderNode(); depends on m103+
HinTak Aug 3, 2023
4d9e399
Hook up 3-arg contructor to SkMemoryStream
HinTak Aug 3, 2023
47d56a3
Fixes gn building with newer gcc
HinTak Aug 4, 2023
7f2ee6c
Update Bitmap.cpp - obviously a cut and paste typo from Pixmap.cpp
HinTak Jul 5, 2023
d7e147a
Sync to skia chrome/m116 in the submodule.
HinTak Aug 2, 2023
005467a
m107: Prototype change of GrDirectContext::createBackendTexture
HinTak Aug 4, 2023
13d0ea9
m88: Prototype change of GrDirectContext::flushAndSubmit
HinTak Aug 2, 2023
c4b4451
m114: Overloaded method for GrDirectContext::flushAndSubmit
HinTak Aug 2, 2023
40d62b4
m114: Switching prototype of SkMipmapBuilder::attachTo()
HinTak Aug 2, 2023
3f78972
m115: Overloaded SkImage::makeRasterImage
HinTak Aug 2, 2023
95f2db6
New SkSamplingOptions& option, and overloading &SkImage::makeRasterImage
HinTak Aug 2, 2023
1b1c857
m88: SkImageFilter::CropRect moved to SkImageFilters::CropRect
HinTak Aug 3, 2023
5d11411
SkImageFilters::CropRect constructor change
HinTak Aug 3, 2023
e850898
Stray comments
HinTak Aug 4, 2023
06d4e4c
A few more changes of SkFilterQuality -> SkSamplingOptions
HinTak Aug 3, 2023
93f43c5
m89: SkYUVAInfo::PlanarConfig was splitted into combination of two en…
HinTak Aug 3, 2023
1e379ee
Splitting SkYUVAInfo::PlanarConfig into SkYUVAInfo::PlaneConfig and S…
HinTak Aug 3, 2023
31966d4
m91: New Extra argument to SkPicture:makeShader()
HinTak Aug 2, 2023
45669b2
m116: SkPerlinNoiseShader is in Shaders namespace, no longer in its o…
HinTak Aug 3, 2023
79296be
m88: Prototype change of SkSurface::flushAndSubmit
HinTak Aug 2, 2023
f1961c9
m108: GrBackendSurfaceMutableState to skgpu::MutableTextureState
HinTak Aug 2, 2023
dc8f1da
Merge tag 'pre-m116.0-rc2' into m116-public
HinTak Aug 4, 2023
6727bb1
Mention REVISIT
HinTak Aug 4, 2023
cc4759d
Adjusting the tests for split SkYUVAInfo::PlaneConfig and SkYUVAInfo:…
HinTak Aug 3, 2023
f0462f4
Fix up commented-out post pre-m116.0-rc2 merge
HinTak Aug 4, 2023
5c2dc47
Mention segfault and REVISIT in disabled test
HinTak Aug 4, 2023
3040ff7
Revert accidentally included re-indentation; no code change
HinTak Aug 4, 2023
0045821
Updating README.m116.md
HinTak Aug 4, 2023
ea0e2cd
CI failure log says Skia internals start to require Mac OS X 10.13.
HinTak Aug 4, 2023
60dbfcf
Can't make everybody happy: 'gcc version 13.2.1' wants this patch, CI…
HinTak Aug 4, 2023
04d7eb9
Apparently "uint" is not a type on windows. CI Failure on windows.
HinTak Aug 4, 2023
3366c2d
SkBitmap::makeShader() takes new "SkSamplingOptions" argument
HinTak Aug 4, 2023
65ca4b3
SkColorFilter::GetFlattenableType() is gone, but there is a proper Sk…
HinTak Aug 4, 2023
b73c10a
Exposing the two COLRv1 functsions to Python
HinTak Aug 4, 2023
af085f1
skia.GrBackendSurfaceMutableState returns a slightly different enum i…
HinTak Aug 4, 2023
999b13b
GetFlattenableType/Deserialize should work on m116
HinTak Aug 4, 2023
f241ac2
SkFilterMode is used in the newer SkPicture::makeShader() in m116
HinTak Aug 4, 2023
3b2a275
More adjusting the tests for split SkYUVAInfo::PlaneConfig and SkYUVA…
HinTak Aug 4, 2023
d44b1e9
Tests both of the new "FilterMode" enum argument of Picture::makeShad…
HinTak Aug 4, 2023
9bb3559
Adjusting test for path::dump() where middle argument is gone
HinTak Aug 4, 2023
7a13f2e
Another PointData inner class in PathEffect. Gone in m116. May not ne…
HinTak Aug 4, 2023
f003c6b
Two more adjustments to tests about skia.FilterQuality gone or replac…
HinTak Aug 4, 2023
f7d10d0
Returned type changed in m116
HinTak Aug 4, 2023
ad18fc7
Modify and add tests for new "SamplingOptions" argument for Image::ma…
HinTak Aug 4, 2023
4215fe7
Adjust test to prototype change of skia.ImageFilters.Magnifier
HinTak Aug 4, 2023
4cb4bcd
REVISIT: Canvas::drawImage which takes (IRect, Rect, ...) was gone
HinTak Aug 4, 2023
8119d3a
This other IRect seems to be gone too. REVISIT
HinTak Aug 4, 2023
f964d19
Skip tests that calls "toLegacy()" method; Not surprisedly gone in m116
HinTak Aug 4, 2023
c522968
Another definitely gone method
HinTak Aug 4, 2023
b1713c8
PointData inner class in PathEffect. Gone/Hidden in m116. May not nee…
HinTak Aug 4, 2023
664057f
Changing version to 116.0b1
HinTak Aug 4, 2023
2702abe
Okay, so this only works on Linux. Fair enough.
HinTak Aug 4, 2023
c25f83b
Bulk marking all failed/error tests as skip(reason='m116:REVISIT')
HinTak Aug 5, 2023
35cb64b
Freetype include path of the bundled freetype
HinTak Aug 5, 2023
445ec34
Use minimize-download patch in aarch64 CI job, too
HinTak Aug 5, 2023
a92ef57
Updating README.m116.md
HinTak Aug 5, 2023
38a2576
Updating README.m116.md
HinTak Aug 5, 2023
bbef097
Update README.m116.md
HinTak Aug 5, 2023
3962c78
Update README.m116.md
HinTak Aug 5, 2023
50aaa54
Update README.m116.md
HinTak Aug 5, 2023
ac9ade6
Update README.m116.md
HinTak Aug 5, 2023
09e25d7
Undo skia-m116-minimize-download.patch after pre-fetch. CI failure
HinTak Aug 5, 2023
5c57d2d
Emulate RSVG's API behavior for id=NULL to SkSVGDOM::renderNode()
HinTak Aug 6, 2023
43b5dba
stray space mistake
HinTak Aug 6, 2023
b8cf223
SkImageFilters::AlphaThreshold removed in m116
HinTak Aug 7, 2023
81cfd0d
Marking test_PerlinNoiseShader_MakeImprovedNoise as xfail, from upstr…
HinTak Aug 7, 2023
aab220b
TableColorFilter class removed in m116
HinTak Aug 7, 2023
53631e1
m116: The `SkYUVAPixmapInfo::SupportedDataTypes(const GrImageContext&…
HinTak Aug 7, 2023
8f13be0
m115: Try emulate SkDrawable::newPictureSnapshot with SkDrawable::mak…
HinTak Aug 7, 2023
83a0452
m111: SkBackingFit is no longer part of the public API.
HinTak Aug 7, 2023
4bddbe3
m110: SkPaint::getFillPath has been replaced with skpathutils::FillPa…
HinTak Aug 7, 2023
83c5f3e
Typo
HinTak Aug 7, 2023
b7139b1
Basic isinstance test for skia.SamplingOptions
HinTak Aug 7, 2023
558b2de
One-line mention about README.m116 at the top-level README
HinTak Aug 7, 2023
5959274
Bump version up to v116.0b2
HinTak Aug 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
skia
key: linux-aarch64-skia-${{ github.sha }}
- name: Pre-fetch skia deps
run: git config --global core.compression 0 && cd skia && python tools/git-sync-deps
run: git config --global core.compression 0 && cd skia && patch -p1 -i ../patch/skia-m116-minimize-download.patch && python tools/git-sync-deps && patch -p1 -R -i ../patch/skia-m116-minimize-download.patch
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Build skia
Expand Down
81 changes: 81 additions & 0 deletions README.m116.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
This is a partial port of [skia-python](https://github.com/kyamagu/skia-python/)
from `m87` to `m116`, possibly disabling any `m87` APIs that have no close `m116` equivalents.

It concentrates on OT-SVG, and fixing these two issues:

* [SkSVGDOM::renderNode() is not exposed in python](https://github.com/kyamagu/skia-python/issues/192)
* [three-args contructor to SkMemoryStream not exposed.](https://github.com/kyamagu/skia-python/issues/194)

The SVG module left experimental in `m88` upstream. It has received many improvements since.

Some COLRv1-related Skia internals from upstream's on-going effort in this area
are also exposed for access. This experimental functionality is available to
Linux/FreeType users only.

Special mention of [0lru](https://github.com/0lru) who provided a
[draft m98 pull](https://github.com/kyamagu/skia-python/pull/181) for which some ideas
of this update had taken from.

# General overview of changes between `m87` and `m116`

* TL;DR - `m87` users would likely find most existing python scripts work. Some
routines need a new `skia.SamplingOptions()` argument, or
switch from `skia.FilterQuality` to `skia.SamplingOptions()`.
Please report `AttributeError: 'skia.AAA' object has no attribute 'BBB'` errors,
to prioritize fixing remaining differences between `m87` and `m116`.

* The number of public symbols/routines in upstream skia is around 2400,
consistently between `m87` and `m116` (`m88`, `m98`, `m103` were examined).
skia-python `m87` accesses just over ~1000 at link time, and possibly
another 100 or two via `dynamic_cast`'ing at runtime. Less than ~800
of them has exact equivalents in `m116`. A good proportion of
the 200+ differ by additional arguments, often with defaults
(e.g. `skia.SamplingOptions()`). A few with not-useful arguments have them removed.
Some of the rest, like the Image I/O routines and Surface routines,
are considered too often used and too important, and are emulated in m116. The rest ... read on:

* Be **WARN**'ed: some `m87` APIs (about 5% in total, many in the `ImageFilter` namespace)
are removed/disabled when there are no obvious new-equivalents, or not-too-troblesome
emulations with `m116`. The "AttributeError" error mentioned above.

* Where it is possible, when `m87` APIs disappear, emulations with `m116`
is done. So these are "new emulations of old APIs". While they work,
they might be withdrawn/changed later:

Image I/O and decoding routines -
`encodeToData`, `MakeRasterCopy`,
`MakeFromRaster`, `MakeFromBitmap`, `MakeFromEncoded`,
`MakeTextureFromCompressed`, `MakeRasterFromCompressed`,
`MakeFromTexture`, `MakeFromCompressedTexture`,
`MakeCrossContextFromPixmap`, `MakeFromAdoptedTexture`,
`MakeFromYUVATexturesCopy`, `MakeFromYUVATexturesCopyWithExternalBackend`,
`MakeFromYUVATextures`, `MakeFromYUVAPixmaps`, `MakeFromYUVAPixmaps`,
`MakeFromPicture`, `MakeBackendTextureFromSkImage`,
`MakeBackendTextureFromSkImage`
- these are emulated in `m116`. In particular, upstream recommends
using the graphic format encoding/decoding routines directly. Not yet directly exposed in `skia-python`.

Surface methods -
`Surface.MakeRasterN32Premul`, `Surface.MakeRasterDirect`,
`Surface.getBackendTexture`, `Surface.getBackendRenderTarget`,
`Surface.MakeRaster`, `Surface.MakeFromBackendTexture`,
`Surface.MakeFromBackendRenderTarget`, `Surface::MakeRenderTarget`,
`Surface.MakeNull`.
- these are simple renamings; we might add the new names and remove
the old names, and document them as renamed.

* Most `GrContext` class methods were merged into `GrDirectContext` class
methods. For now, we have an alias between those two classes, and
internally, use `GrContext` as it is shorter. In the long term,
people should use `GrDirectContext`, to align with upstream documentation.

* New `SamplingOptions` class; there is only a default constructor for now.
Many APIs changes from `m87` to `m116` concern adding new options with it, or
changing from `FilterQuality` enum to `SamplingOptions`. If you use any
value other than the default `FilterQuality.kMedium_SkFilterQuality`
enum, you'll need to request addition to the `SamplingOptions` class.

* `yuvainfo.PlanarConfig` enums were splitted into a combination of
`yuvainfo.PlaneConfig` and `yuvainfo.Subsampling` enums. Where the former
enum was used in `m87`, it is the equivalent of a combination of the latter
two in `m116`.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ https://kyamagu.github.io/skia-python
- [Tutorial](https://kyamagu.github.io/skia-python/tutorial/)
- [Reference](https://kyamagu.github.io/skia-python/reference.html)

- For information about the `m87` to `m116` changes, and tips on migration: [README.m116](README.m116.md).

## Contributing

Feel free to [post an issue](https://github.com/kyamagu/skia-python/issues) or [PR](https://github.com/kyamagu/skia-python/pulls).
22 changes: 22 additions & 0 deletions patch/gn-newer-gcc-warnings-as-errors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/src/gn/desc_builder.cc b/src/gn/desc_builder.cc
index 444a5e02..3ef170c3 100644
--- a/src/gn/desc_builder.cc
+++ b/src/gn/desc_builder.cc
@@ -167,7 +167,7 @@ class BaseDescBuilder {
base::ListValue res;
for (const auto& v : vector)
res.GetList().emplace_back(ToBaseValue(v));
- return std::move(res);
+ return res;
}

base::Value ToBaseValue(const Scope* scope) {
@@ -176,7 +176,7 @@ class BaseDescBuilder {
scope->GetCurrentScopeValues(&map);
for (const auto& v : map)
res.SetKey(v.first, ToBaseValue(v.second));
- return std::move(res);
+ return res;
}

base::Value ToBaseValue(const Value& val) {
197 changes: 197 additions & 0 deletions patch/skia-m116-colrv1-freetype.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index eae8c84..8388891 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -24,6 +24,8 @@
#include "src/sfnt/SkOTTable_OS_2.h"

#ifdef SK_TYPEFACE_FACTORY_FREETYPE
+enum class FT_Color_Root_Transform_;
+typedef FT_Color_Root_Transform_ FT_Color_Root_Transform; /* freetype/ftcolor.h */
#include "src/ports/SkFontHost_FreeType_common.h"
#endif

diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h
index 7955049..8551cf7 100644
--- a/src/ports/SkFontConfigTypeface.h
+++ b/src/ports/SkFontConfigTypeface.h
@@ -12,6 +12,8 @@
#include "include/core/SkStream.h"
#include "include/ports/SkFontConfigInterface.h"
#include "src/core/SkFontDescriptor.h"
+enum class FT_Color_Root_Transform_;
+typedef FT_Color_Root_Transform_ FT_Color_Root_Transform; /* freetype/ftcolor.h */
#include "src/ports/SkFontHost_FreeType_common.h"

class SkFontDescriptor;
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index f46bf19..def997a 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -31,7 +31,6 @@
#include "src/core/SkMask.h"
#include "src/core/SkMaskGamma.h"
#include "src/core/SkScalerContext.h"
-#include "src/ports/SkFontHost_FreeType_common.h"
#include "src/sfnt/SkOTUtils.h"
#include "src/sfnt/SkSFNTHeader.h"
#include "src/sfnt/SkTTCFHeader.h"
@@ -49,6 +48,7 @@
#ifdef FT_COLOR_H // 2.10.0
# include <freetype/ftcolor.h>
#endif
+#include "src/ports/SkFontHost_FreeType_common.h"
#include <freetype/freetype.h>
#include <freetype/ftlcdfil.h>
#include <freetype/ftmodapi.h>
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 355ee02..22cd6af 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -6,7 +6,6 @@
* found in the LICENSE file.
*/

-#include "src/ports/SkFontHost_FreeType_common.h"

#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
@@ -32,6 +31,7 @@
#ifdef FT_COLOR_H
# include <freetype/ftcolor.h>
#endif
+#include "src/ports/SkFontHost_FreeType_common.h"
#include <freetype/ftimage.h>
#include <freetype/ftoutln.h>
#include <freetype/ftsizes.h>
@@ -1558,6 +1558,41 @@ bool SkScalerContext_FreeType_Base::drawCOLRv1Glyph(FT_Face face,
SkASSERTF(haveLayers, "Could not get COLRv1 layers from '%s'.", face->family_name);
return haveLayers;
}
+/*
+ * This content is mostly just
+ * SkTypeface_FreeType::FaceRec::setupPalette()
+ + + SkScalerContext_FreeType_Base::drawCOLRv1Glyph()
+ +*/
+bool SkScalerContext_FreeType_Base::skia_colrv1_start_glyph(SkCanvas* canvas,
+ FT_Face face,
+ uint16_t glyphId,
+ FT_UShort palette_index,
+ FT_Color_Root_Transform rootTransform
+ ) {
+ uint32_t fForegroundColor{SK_ColorBLACK};
+ FT_Palette_Data paletteData;
+ FT_Palette_Data_Get(face, &paletteData);
+
+ FT_Color* ftPalette = nullptr;
+ FT_Palette_Select(face, palette_index, &ftPalette);
+ std::unique_ptr<SkColor[]> ptr_palette(new SkColor[paletteData.num_palette_entries]);
+ for (int i = 0; i < paletteData.num_palette_entries; ++i) {
+ ptr_palette[i] = SkColorSetARGB(ftPalette[i].alpha,
+ ftPalette[i].red,
+ ftPalette[i].green,
+ ftPalette[i].blue);
+ }
+ SkSpan<SkColor> palette(ptr_palette.get(), paletteData.num_palette_entries);
+
+ VisitedSet activePaints;
+ bool haveLayers = colrv1_start_glyph(canvas, palette,
+ fForegroundColor, // FT_Palette_Get_Foreground_Color?
+ face, glyphId,
+ FT_COLOR_INCLUDE_ROOT_TRANSFORM,
+ &activePaints);
+ SkASSERTF(haveLayers, "Could not get COLRv1 layers from '%s'.", face->family_name);
+ return haveLayers;
+}
#endif // TT_SUPPORT_COLRV1

#ifdef FT_COLOR_H
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
index 1d3a8f8..820106a 100644
--- a/src/ports/SkFontHost_FreeType_common.h
+++ b/src/ports/SkFontHost_FreeType_common.h
@@ -29,6 +29,7 @@ typedef struct FT_FaceRec_* FT_Face;
typedef struct FT_StreamRec_* FT_Stream;
typedef signed long FT_Pos;
typedef struct FT_BBox_ FT_BBox;
+typedef unsigned short FT_UShort; /* freetype/fttypes.h */


#ifdef SK_DEBUG
@@ -41,7 +42,15 @@ const char* SkTraceFtrGetError(int);
#endif


-class SkScalerContext_FreeType_Base : public SkScalerContext {
+class SK_SPI SkScalerContext_FreeType_Base : public SkScalerContext {
+public:
+ static bool computeColrV1GlyphBoundingBox(FT_Face, SkGlyphID, SkRect* bounds);
+ static bool skia_colrv1_start_glyph(SkCanvas* canvas,
+ FT_Face face,
+ uint16_t glyphId,
+ FT_UShort palette_index,
+ FT_Color_Root_Transform rootTransform
+ );
protected:
// See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_handling.html#FT_Bitmap_Embolden
// This value was chosen by eyeballing the result in Firefox and trying to match it.
@@ -68,7 +77,6 @@ protected:
* configure size, matrix and load glyphs as needed after using this function to restore the
* state of FT_Face.
*/
- static bool computeColrV1GlyphBoundingBox(FT_Face, SkGlyphID, SkRect* bounds);

struct ScalerContextBits {
static const constexpr uint32_t COLRv0 = 1;
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 25cc9f9..d9af46b 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -23,6 +23,8 @@
#include "src/core/SkFontDescriptor.h"
#include "src/core/SkOSFile.h"
#include "src/core/SkTypefaceCache.h"
+enum class FT_Color_Root_Transform_;
+typedef FT_Color_Root_Transform_ FT_Color_Root_Transform; /* freetype/ftcolor.h */
#include "src/ports/SkFontHost_FreeType_common.h"
#include "src/ports/SkFontMgr_android_parser.h"

diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp
index cfa39ef..9d61da9 100644
--- a/src/ports/SkFontMgr_custom.cpp
+++ b/src/ports/SkFontMgr_custom.cpp
@@ -16,6 +16,8 @@
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTemplates.h"
#include "src/core/SkFontDescriptor.h"
+enum class FT_Color_Root_Transform_;
+typedef FT_Color_Root_Transform_ FT_Color_Root_Transform; /* freetype/ftcolor.h */
#include "src/ports/SkFontHost_FreeType_common.h"
#include "src/ports/SkFontMgr_custom.h"

diff --git a/src/ports/SkFontMgr_custom.h b/src/ports/SkFontMgr_custom.h
index 1e78f0b..8a22c02 100644
--- a/src/ports/SkFontMgr_custom.h
+++ b/src/ports/SkFontMgr_custom.h
@@ -14,6 +14,8 @@
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTArray.h"
+enum class FT_Color_Root_Transform_;
+typedef FT_Color_Root_Transform_ FT_Color_Root_Transform; /* freetype/ftcolor.h */
#include "src/ports/SkFontHost_FreeType_common.h"

class SkData;
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp
index 8022ac2..bee83e8 100644
--- a/src/ports/SkFontMgr_fontconfig.cpp
+++ b/src/ports/SkFontMgr_fontconfig.cpp
@@ -22,6 +22,8 @@
#include "src/core/SkFontDescriptor.h"
#include "src/core/SkOSFile.h"
#include "src/core/SkTypefaceCache.h"
+enum class FT_Color_Root_Transform_;
+typedef FT_Color_Root_Transform_ FT_Color_Root_Transform; /* freetype/ftcolor.h */
#include "src/ports/SkFontHost_FreeType_common.h"

#include <fontconfig/fontconfig.h>
Loading