Respect aliased color glyph rendering with FreeType

The FreeType port always requested that color glyphs be antialiased.
Respect the setting for aliased glyph rendering with color glyphs.

Change-Id: If9a477b705a91b1284739bd190aea90b2929612f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/512949
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2022-02-25 14:23:54 -05:00 committed by SkCQ
parent 07f3d2067a
commit 636953d234
2 changed files with 3 additions and 3 deletions

View File

@ -851,7 +851,7 @@ SkScalerContext_FreeType::SkScalerContext_FreeType(sk_sp<SkTypeface_FreeType> ty
// See http://code.google.com/p/chromium/issues/detail?id=43252#c24
loadFlags = FT_LOAD_TARGET_MONO;
if (fRec.getHinting() == SkFontHinting::kNone) {
loadFlags = FT_LOAD_NO_HINTING;
loadFlags |= FT_LOAD_NO_HINTING;
linearMetrics = true;
}
} else {

View File

@ -1242,8 +1242,6 @@ bool SkScalerContext_FreeType_Base::drawColorGlyph(FT_Face face,
uint32_t loadGlyphFlags,
SkSpan<SkColor> palette,
SkCanvas* canvas) {
SkPaint paint;
paint.setAntiAlias(true);
// Only attempt to draw a COLRv1 glyph if FreeType is new enough to have the COLRv1 support.
#ifdef TT_SUPPORT_COLRV1
@ -1264,6 +1262,8 @@ bool SkScalerContext_FreeType_Base::drawColorGlyph(FT_Face face,
layerIterator.p = nullptr;
FT_UInt layerGlyphIndex = 0;
FT_UInt layerColorIndex = 0;
SkPaint paint;
paint.setAntiAlias(!(loadGlyphFlags & FT_LOAD_TARGET_MONO));
while (FT_Get_Color_Glyph_Layer(face, glyph.getGlyphID(), &layerGlyphIndex,
&layerColorIndex, &layerIterator)) {
haveLayers = true;