Add support for FT_COLR_PAINTFORMAT_SCALE

ff40776591..d3dc2da9b2

This was added to the specification and recently added to FreeType. This
also involves rolling FreeType.

Change-Id: I8784bf6af900a7ecedbd1647cfcd851ad8a81dd1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/424096
Commit-Queue: Dominik Röttsches <drott@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
This commit is contained in:
Ben Wagner 2021-07-01 14:10:55 -04:00 committed by Skia Commit-Bot
parent 9c060b55e1
commit a149e8ff05
2 changed files with 15 additions and 1 deletions

2
DEPS
View File

@ -23,7 +23,7 @@ deps = {
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@c8d0c9b1d16bfda56f15165d39e0ffa360a11123",
"third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@a0bca08de07c7d7651047bedc0b653cfaaa4f2ae",
"third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@a28238bdeebc087071777001245df1876a11f5ee",
"third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@ff40776591f215a05c0ed1bf49069090e5180578",
"third_party/externals/freetype" : "https://chromium.googlesource.com/chromium/src/third_party/freetype2.git@d3dc2da9b27af5b90575d62989389cc65fe7977c",
"third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@3a74ee528255cc027d84b204a87b5c25e47bff79",
"third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@a0718d4f121727e30b8d52c7a189ebf5ab52421f",
"third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@9418dcb69355558f70de260483424412c5ca2fce",

View File

@ -714,6 +714,7 @@ void colrv1_draw_paint(SkCanvas* canvas,
}
case FT_COLR_PAINTFORMAT_TRANSFORM:
case FT_COLR_PAINTFORMAT_TRANSLATE:
case FT_COLR_PAINTFORMAT_SCALE:
case FT_COLR_PAINTFORMAT_ROTATE:
case FT_COLR_PAINTFORMAT_SKEW:
SkASSERT(false); // Transforms handled in colrv1_transform.
@ -769,6 +770,14 @@ void colrv1_transform(SkCanvas* canvas, FT_Face face, FT_COLR_Paint colrv1_paint
-SkFixedToScalar(colrv1_paint.u.translate.dy));
break;
}
case FT_COLR_PAINTFORMAT_SCALE: {
transform.setScaleTranslate(
SkFixedToScalar(colrv1_paint.u.scale.scale_x),
SkFixedToScalar(colrv1_paint.u.scale.scale_y),
SkFixedToScalar(colrv1_paint.u.scale.center_x),
-SkFixedToScalar(colrv1_paint.u.scale.center_y));
break;
}
case FT_COLR_PAINTFORMAT_ROTATE: {
transform = SkMatrix::RotateDeg(
SkFixedToScalar(colrv1_paint.u.rotate.angle),
@ -890,6 +899,11 @@ bool colrv1_traverse_paint(SkCanvas* canvas,
traverse_result = colrv1_traverse_paint(canvas, palette, face,
paint.u.translate.paint, visited_set);
break;
case FT_COLR_PAINTFORMAT_SCALE:
colrv1_transform(canvas, face, paint);
traverse_result = colrv1_traverse_paint(canvas, palette, face,
paint.u.scale.paint, visited_set);
break;
case FT_COLR_PAINTFORMAT_ROTATE:
colrv1_transform(canvas, face, paint);
traverse_result =