Revert "Revert "hide nested hinting enum""
This reverts commit 6bd19df9fa
.
Restores original CL, but adds guards for flutter.
Bug: skia:
Change-Id: I380b4ea87d293355026d734249aa2b8c397da144
Reviewed-on: https://skia-review.googlesource.com/c/169345
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
This commit is contained in:
parent
41f2b33c4f
commit
f49563bf92
@ -888,8 +888,8 @@ static void fuzz_paint_text(Fuzz* fuzz, SkPaint* paint) {
|
||||
paint->setEmbeddedBitmapText(make_fuzz_t<bool>(fuzz));
|
||||
paint->setAutohinted( make_fuzz_t<bool>(fuzz));
|
||||
paint->setFakeBoldText( make_fuzz_t<bool>(fuzz));
|
||||
paint->setHinting( make_fuzz_t_range<SkPaint::Hinting>(fuzz, 0,
|
||||
SkPaint::kFull_Hinting));
|
||||
paint->setHinting( make_fuzz_t_range<SkFontHinting>(fuzz, 0,
|
||||
kFull_SkFontHinting));
|
||||
}
|
||||
|
||||
static void fuzz_paint_text_encoding(Fuzz* fuzz, SkPaint* paint) {
|
||||
|
@ -48,7 +48,7 @@ static void init_paint(Fuzz* fuzz, SkPaint* p) {
|
||||
p->setFilterQuality(static_cast<SkFilterQuality>(tmp_u8));
|
||||
|
||||
fuzz->nextRange(&tmp_u8, 0, (int)SkPaint::kFull_Hinting);
|
||||
p->setHinting(static_cast<SkPaint::Hinting>(tmp_u8));
|
||||
p->setHinting(static_cast<SkFontHinting>(tmp_u8));
|
||||
|
||||
fuzz->nextRange(&tmp_u8, 0, (int)SkPaint::kLast_Cap);
|
||||
p->setStrokeCap(static_cast<SkPaint::Cap>(tmp_u8));
|
||||
|
@ -35,7 +35,7 @@ protected:
|
||||
paint.setLCDRenderText(true);
|
||||
//With freetype the default (normal hinting) can be really ugly.
|
||||
//Most distros now set slight (vertical hinting only) in any event.
|
||||
paint.setHinting(SkPaint::kSlight_Hinting);
|
||||
paint.setHinting(kSlight_SkFontHinting);
|
||||
|
||||
const char* text = "Hamburgefons ooo mmm";
|
||||
const size_t textLen = strlen(text);
|
||||
|
@ -184,10 +184,12 @@ static void draw_typeface_rendering_gm(SkCanvas* canvas, sk_sp<SkTypeface> face,
|
||||
// Odd sizes have embedded bitmaps.
|
||||
constexpr SkScalar textSizes[] = { 9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
|
||||
constexpr SkPaint::Hinting hintingTypes[] = { SkPaint::kNo_Hinting,
|
||||
SkPaint::kSlight_Hinting,
|
||||
SkPaint::kNormal_Hinting,
|
||||
SkPaint::kFull_Hinting };
|
||||
constexpr SkFontHinting hintingTypes[] = {
|
||||
kNo_SkFontHinting,
|
||||
kSlight_SkFontHinting,
|
||||
kNormal_SkFontHinting,
|
||||
kFull_SkFontHinting
|
||||
};
|
||||
|
||||
struct SubpixelType {
|
||||
bool requested;
|
||||
@ -228,7 +230,7 @@ static void draw_typeface_rendering_gm(SkCanvas* canvas, sk_sp<SkTypeface> face,
|
||||
|
||||
SkScalar dy = SkScalarCeilToScalar(paint.getFontMetrics(nullptr));
|
||||
y += dy;
|
||||
for (const SkPaint::Hinting& hinting : hintingTypes) {
|
||||
for (const SkFontHinting& hinting : hintingTypes) {
|
||||
paint.setHinting(hinting);
|
||||
|
||||
for (const bool& rotateABit : rotateABitTypes) {
|
||||
|
@ -13,6 +13,10 @@ flutter_defines = [
|
||||
"SK_DISABLE_AAA",
|
||||
"SK_DISABLE_DAA",
|
||||
|
||||
# API staging
|
||||
"SK_SUPPORT_LEGACY_NONCLASS_HINTINGENUM",
|
||||
"SK_SUPPORT_LEGACY_NESTED_HINTINGENUM",
|
||||
|
||||
# Flutter doesn't deserialize anything.
|
||||
"SK_DISABLE_READBUFFER",
|
||||
|
||||
|
@ -66,11 +66,16 @@ public:
|
||||
void DEPRECATED_setAntiAlias(bool);
|
||||
void DEPRECATED_setLCDRender(bool);
|
||||
|
||||
void setHinting(SkFontHinting);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_NESTED_HINTINGENUM
|
||||
Hinting getHinting() const { return (Hinting)fHinting; }
|
||||
void setHinting(SkFontHinting hinting);
|
||||
void setHinting(Hinting hinting) {
|
||||
this->setHinting((SkFontHinting)hinting);
|
||||
}
|
||||
#else
|
||||
SkFontHinting getHinting() const { return (SkFontHinting)fHinting; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a font with the same attributes of this font, but with the specified size.
|
||||
|
@ -198,14 +198,6 @@ public:
|
||||
kFull_Hinting = 3, //!< modifies glyph outlines for maximum constrast
|
||||
};
|
||||
|
||||
/** Returns level of glyph outline adjustment.
|
||||
|
||||
@return one of: kNo_Hinting, kSlight_Hinting, kNormal_Hinting, kFull_Hinting
|
||||
*/
|
||||
Hinting getHinting() const {
|
||||
return static_cast<Hinting>(fBitfields.fHinting);
|
||||
}
|
||||
|
||||
/** Sets level of glyph outline adjustment.
|
||||
Does not check for valid values of hintingLevel.
|
||||
|
||||
@ -214,14 +206,16 @@ public:
|
||||
*/
|
||||
void setHinting(SkFontHinting hintingLevel);
|
||||
|
||||
/** Sets level of glyph outline adjustment.
|
||||
Does not check for valid values of hintingLevel.
|
||||
|
||||
@param hintingLevel one of: kNo_Hinting, kSlight_Hinting, kNormal_Hinting, kFull_Hinting
|
||||
*/
|
||||
void setHinting(Hinting hintingLevel) {
|
||||
this->setHinting((SkFontHinting)hintingLevel);
|
||||
#ifdef SK_SUPPORT_LEGACY_NESTED_HINTINGENUM
|
||||
Hinting getHinting() const { return (Hinting)fBitfields.fHinting; }
|
||||
void setHinting(Hinting h) {
|
||||
this->setHinting((SkFontHinting)h);
|
||||
}
|
||||
#else
|
||||
/** Returns level of glyph outline adjustment.
|
||||
*/
|
||||
SkFontHinting getHinting() const { return (SkFontHinting)fBitfields.fHinting; }
|
||||
#endif
|
||||
|
||||
/** \enum SkPaint::Flags
|
||||
The bit values stored in Flags.
|
||||
|
@ -212,7 +212,7 @@ sk_sp<SkTextBlob> TextAdapter::makeBlob() const {
|
||||
SkPaint font;
|
||||
font.setTypeface(fText.fTypeface);
|
||||
font.setTextSize(fText.fTextSize);
|
||||
font.setHinting(SkPaint::kNo_Hinting);
|
||||
font.setHinting(kNo_SkFontHinting);
|
||||
font.setSubpixelText(true);
|
||||
font.setAntiAlias(true);
|
||||
font.setTextEncoding(SkPaint::kUTF8_TextEncoding);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
SG_ATTRIBUTE(ScaleX , SkScalar , fScaleX )
|
||||
SG_ATTRIBUTE(SkewX , SkScalar , fSkewX )
|
||||
SG_ATTRIBUTE(Align , SkTextUtils::Align , fAlign )
|
||||
SG_ATTRIBUTE(Hinting , SkPaint::Hinting , fHinting )
|
||||
SG_ATTRIBUTE(Hinting , SkFontHinting , fHinting )
|
||||
|
||||
// TODO: add shaping functionality.
|
||||
|
||||
@ -62,7 +62,7 @@ private:
|
||||
SkScalar fScaleX = 1;
|
||||
SkScalar fSkewX = 0;
|
||||
SkTextUtils::Align fAlign = SkTextUtils::kLeft_Align;
|
||||
SkPaint::Hinting fHinting = SkPaintDefaults_Hinting;
|
||||
SkFontHinting fHinting = SkPaintDefaults_Hinting;
|
||||
|
||||
sk_sp<SkTextBlob> fBlob; // cached text blob
|
||||
|
||||
|
@ -159,8 +159,8 @@ static SkBlendMode make_xfermode() {
|
||||
return static_cast<SkBlendMode>(R((int)SkBlendMode::kLastMode+1));
|
||||
}
|
||||
|
||||
static SkPaint::Hinting make_paint_hinting() {
|
||||
return static_cast<SkPaint::Hinting>(R(SkPaint::kFull_Hinting+1));
|
||||
static SkFontHinting make_paint_hinting() {
|
||||
return static_cast<SkFontHinting>(R(static_cast<unsigned>(kFull_SkFontHinting)+1));
|
||||
}
|
||||
|
||||
static SkPaint::Style make_paint_style() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#define kDefault_Size 12
|
||||
#define kDefault_Flags 0
|
||||
#define kDefault_Hinting SkFont::kNormal_Hinting
|
||||
#define kDefault_Hinting kNormal_SkFontHinting
|
||||
|
||||
static inline SkScalar valid_size(SkScalar size) {
|
||||
return SkTMax<SkScalar>(0, size);
|
||||
@ -26,7 +26,7 @@ SkFont::SkFont(sk_sp<SkTypeface> face, SkScalar size, SkScalar scaleX, SkScalar
|
||||
, fScaleX(scaleX)
|
||||
, fSkewX(skewX)
|
||||
, fFlags(flags & kAllFlags)
|
||||
, fHinting(kDefault_Hinting)
|
||||
, fHinting(static_cast<unsigned>(kDefault_Hinting))
|
||||
{}
|
||||
|
||||
SkFont::SkFont() : SkFont(nullptr, kDefault_Size, 1, 0, kDefault_Flags)
|
||||
@ -167,7 +167,7 @@ void SkFont::LEGACY_applyToPaint(SkPaint* paint) const {
|
||||
paint->setAntiAlias(SkToBool(fFlags & kDEPRECATED_Antialias_Flag));
|
||||
paint->setLCDRenderText(SkToBool(fFlags & kDEPRECATED_LCDRender_Flag));
|
||||
|
||||
paint->setHinting((SkPaint::Hinting)this->getHinting());
|
||||
paint->setHinting((SkFontHinting)this->getHinting());
|
||||
}
|
||||
|
||||
SkFont SkFont::LEGACY_ExtractFromPaint(const SkPaint& paint) {
|
||||
@ -197,6 +197,6 @@ SkFont SkFont::LEGACY_ExtractFromPaint(const SkPaint& paint) {
|
||||
|
||||
SkFont font(sk_ref_sp(paint.getTypeface()), paint.getTextSize(), paint.getTextScaleX(),
|
||||
paint.getTextSkewX(), flags);
|
||||
font.setHinting((Hinting)paint.getHinting());
|
||||
font.setHinting((SkFontHinting)paint.getHinting());
|
||||
return font;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ SkPaint::SkPaint() {
|
||||
fBitfields.fJoinType = kDefault_Join;
|
||||
fBitfields.fStyle = kFill_Style;
|
||||
fBitfields.fTextEncoding = kUTF8_TextEncoding;
|
||||
fBitfields.fHinting = SkPaintDefaults_Hinting;
|
||||
fBitfields.fHinting = static_cast<unsigned>(SkPaintDefaults_Hinting);
|
||||
}
|
||||
|
||||
SkPaint::SkPaint(const SkPaint& src)
|
||||
@ -394,7 +394,8 @@ static inline int BPF_Mask(int bits) {
|
||||
return (1 << bits) - 1;
|
||||
}
|
||||
|
||||
static uint32_t pack_paint_flags(unsigned flags, unsigned hint, unsigned filter, unsigned flatFlags) {
|
||||
static uint32_t pack_paint_flags(unsigned flags, unsigned hint, unsigned filter,
|
||||
unsigned flatFlags) {
|
||||
ASSERT_FITS_IN(flags, kFlags_BPF);
|
||||
ASSERT_FITS_IN(hint, kHint_BPF);
|
||||
ASSERT_FITS_IN(filter, kFilter_BPF);
|
||||
@ -409,7 +410,7 @@ static uint32_t pack_paint_flags(unsigned flags, unsigned hint, unsigned filter,
|
||||
|
||||
static FlatFlags unpack_paint_flags(SkPaint* paint, uint32_t packed) {
|
||||
paint->setFlags(packed >> 16);
|
||||
paint->setHinting((SkPaint::Hinting)((packed >> 14) & BPF_Mask(kHint_BPF)));
|
||||
paint->setHinting((SkFontHinting)((packed >> 14) & BPF_Mask(kHint_BPF)));
|
||||
paint->setFilterQuality((SkFilterQuality)((packed >> 10) & BPF_Mask(kFilter_BPF)));
|
||||
return (FlatFlags)(packed & kFlatFlagMask);
|
||||
}
|
||||
@ -441,7 +442,7 @@ void SkPaintPriv::Flatten(const SkPaint& paint, SkWriteBuffer& buffer) {
|
||||
buffer.writeScalar(paint.getStrokeMiter());
|
||||
buffer.writeColor4f(paint.getColor4f());
|
||||
|
||||
buffer.writeUInt(pack_paint_flags(paint.getFlags(), paint.getHinting(),
|
||||
buffer.writeUInt(pack_paint_flags(paint.getFlags(), static_cast<unsigned>(paint.getHinting()),
|
||||
paint.getFilterQuality(), flatFlags));
|
||||
buffer.writeUInt(pack_4(paint.getStrokeCap(), paint.getStrokeJoin(),
|
||||
(paint.getStyle() << 4) | paint.getTextEncoding(),
|
||||
|
@ -25,7 +25,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SkPaintDefaults_Hinting
|
||||
#define SkPaintDefaults_Hinting SkPaint::kNormal_Hinting
|
||||
#define SkPaintDefaults_Hinting kNormal_SkFontHinting
|
||||
#endif
|
||||
|
||||
#ifndef SkPaintDefaults_MiterLimit
|
||||
|
@ -291,7 +291,7 @@ SkScalar SkPaint::setupForAsPaths() {
|
||||
flags |= SkPaint::kSubpixelText_Flag;
|
||||
|
||||
this->setFlags(flags);
|
||||
this->setHinting(SkPaint::kNo_Hinting);
|
||||
this->setHinting(kNo_SkFontHinting);
|
||||
this->setStyle(SkPaint::kFill_Style);
|
||||
this->setPathEffect(nullptr);
|
||||
|
||||
|
@ -27,7 +27,7 @@ SkRunFont::SkRunFont(const SkPaint& paint)
|
||||
, fScaleX(paint.getTextScaleX())
|
||||
, fTypeface(SkPaintPriv::RefTypefaceOrDefault(paint))
|
||||
, fSkewX(paint.getTextSkewX())
|
||||
, fHinting(paint.getHinting())
|
||||
, fHinting(static_cast<unsigned>(paint.getHinting()))
|
||||
, fFlags(paint.getFlags() & kFlagsMask) { }
|
||||
|
||||
void SkRunFont::applyToPaint(SkPaint* paint) const {
|
||||
@ -36,7 +36,7 @@ void SkRunFont::applyToPaint(SkPaint* paint) const {
|
||||
paint->setTextSize(fSize);
|
||||
paint->setTextScaleX(fScaleX);
|
||||
paint->setTextSkewX(fSkewX);
|
||||
paint->setHinting(static_cast<SkPaint::Hinting>(fHinting));
|
||||
paint->setHinting(static_cast<SkFontHinting>(fHinting));
|
||||
|
||||
paint->setFlags((paint->getFlags() & ~kFlagsMask) | fFlags);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ private:
|
||||
sk_sp<SkTypeface> fTypeface;
|
||||
SkScalar fSkewX;
|
||||
|
||||
static_assert(SkPaint::kFull_Hinting < 4, "insufficient_hinting_bits");
|
||||
static_assert(static_cast<unsigned>(kFull_SkFontHinting) < 4, "insufficient_hinting_bits");
|
||||
uint32_t fHinting : 2;
|
||||
static_assert((kFlagsMask & 0xffff) == kFlagsMask, "insufficient_flags_bits");
|
||||
uint32_t fFlags : 16;
|
||||
|
@ -188,7 +188,7 @@ void GrTextContext::InitDistanceFieldPaint(GrTextBlob* blob,
|
||||
skPaint->setAntiAlias(true);
|
||||
skPaint->setLCDRenderText(false);
|
||||
skPaint->setAutohinted(false);
|
||||
skPaint->setHinting(SkPaint::kNormal_Hinting);
|
||||
skPaint->setHinting(kNormal_SkFontHinting);
|
||||
skPaint->setSubpixelText(true);
|
||||
|
||||
skPaint->setMaskFilter(GrSDFMaskFilter::Make());
|
||||
|
@ -1103,7 +1103,7 @@ void SkPDFDevice::internalDrawGlyphRun(const SkGlyphRun& glyphRun, SkPoint offse
|
||||
SkPaint paint(srcPaint);
|
||||
remove_color_filter(&paint);
|
||||
replace_srcmode_on_opaque_paint(&paint);
|
||||
paint.setHinting(SkPaint::kNo_Hinting);
|
||||
paint.setHinting(kNo_SkFontHinting);
|
||||
if (!paint.getTypeface()) {
|
||||
paint.setTypeface(SkTypeface::MakeDefault());
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
SkExclusiveStrikePtr SkPDFFont::MakeVectorCache(SkTypeface* face, int* size) {
|
||||
SkPaint tmpPaint;
|
||||
tmpPaint.setHinting(SkPaint::kNo_Hinting);
|
||||
tmpPaint.setHinting(kNo_SkFontHinting);
|
||||
tmpPaint.setTypeface(sk_ref_sp(face));
|
||||
int unitsPerEm = face->getUnitsPerEm();
|
||||
if (unitsPerEm <= 0) {
|
||||
@ -154,7 +154,7 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::GetMetrics(SkTypeface* typeface,
|
||||
|
||||
if (0 == metrics->fStemV || 0 == metrics->fCapHeight) {
|
||||
SkPaint tmpPaint;
|
||||
tmpPaint.setHinting(SkPaint::kNo_Hinting);
|
||||
tmpPaint.setHinting(kNo_SkFontHinting);
|
||||
tmpPaint.setTypeface(sk_ref_sp(typeface));
|
||||
tmpPaint.setTextSize(1000); // glyph coordinate system
|
||||
if (0 == metrics->fStemV) {
|
||||
|
@ -818,7 +818,7 @@ static int lpaint_setTypeface(lua_State* L) {
|
||||
}
|
||||
|
||||
static int lpaint_getHinting(lua_State* L) {
|
||||
SkLua(L).pushU32(get_obj<SkPaint>(L, 1)->getHinting());
|
||||
SkLua(L).pushU32((unsigned)get_obj<SkPaint>(L, 1)->getHinting());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -249,18 +249,18 @@ static void test_advances(skiatest::Reporter* reporter) {
|
||||
};
|
||||
|
||||
static const struct {
|
||||
SkPaint::Hinting hinting;
|
||||
unsigned flags;
|
||||
SkFontHinting hinting;
|
||||
unsigned flags;
|
||||
} settings[] = {
|
||||
{ SkPaint::kNo_Hinting, 0 },
|
||||
{ SkPaint::kNo_Hinting, SkPaint::kLinearText_Flag },
|
||||
{ SkPaint::kNo_Hinting, SkPaint::kSubpixelText_Flag },
|
||||
{ SkPaint::kSlight_Hinting, 0 },
|
||||
{ SkPaint::kSlight_Hinting, SkPaint::kLinearText_Flag },
|
||||
{ SkPaint::kSlight_Hinting, SkPaint::kSubpixelText_Flag },
|
||||
{ SkPaint::kNormal_Hinting, 0 },
|
||||
{ SkPaint::kNormal_Hinting, SkPaint::kLinearText_Flag },
|
||||
{ SkPaint::kNormal_Hinting, SkPaint::kSubpixelText_Flag },
|
||||
{ kNo_SkFontHinting, 0 },
|
||||
{ kNo_SkFontHinting, SkPaint::kLinearText_Flag },
|
||||
{ kNo_SkFontHinting, SkPaint::kSubpixelText_Flag },
|
||||
{ kSlight_SkFontHinting, 0 },
|
||||
{ kSlight_SkFontHinting, SkPaint::kLinearText_Flag },
|
||||
{ kSlight_SkFontHinting, SkPaint::kSubpixelText_Flag },
|
||||
{ kNormal_SkFontHinting, 0 },
|
||||
{ kNormal_SkFontHinting, SkPaint::kLinearText_Flag },
|
||||
{ kNormal_SkFontHinting, SkPaint::kSubpixelText_Flag },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
|
@ -42,18 +42,18 @@ static void test_cachedfont(skiatest::Reporter* reporter) {
|
||||
};
|
||||
|
||||
static const struct {
|
||||
SkPaint::Hinting hinting;
|
||||
unsigned flags;
|
||||
SkFontHinting hinting;
|
||||
unsigned flags;
|
||||
} settings[] = {
|
||||
{ SkPaint::kNo_Hinting, 0 },
|
||||
{ SkPaint::kNo_Hinting, SkPaint::kLinearText_Flag },
|
||||
{ SkPaint::kNo_Hinting, SkPaint::kSubpixelText_Flag },
|
||||
{ SkPaint::kSlight_Hinting, 0 },
|
||||
{ SkPaint::kSlight_Hinting, SkPaint::kLinearText_Flag },
|
||||
{ SkPaint::kSlight_Hinting, SkPaint::kSubpixelText_Flag },
|
||||
{ SkPaint::kNormal_Hinting, 0 },
|
||||
{ SkPaint::kNormal_Hinting, SkPaint::kLinearText_Flag },
|
||||
{ SkPaint::kNormal_Hinting, SkPaint::kSubpixelText_Flag },
|
||||
{ kNo_SkFontHinting, 0 },
|
||||
{ kNo_SkFontHinting, SkPaint::kLinearText_Flag },
|
||||
{ kNo_SkFontHinting, SkPaint::kSubpixelText_Flag },
|
||||
{ kSlight_SkFontHinting, 0 },
|
||||
{ kSlight_SkFontHinting, SkPaint::kLinearText_Flag },
|
||||
{ kSlight_SkFontHinting, SkPaint::kSubpixelText_Flag },
|
||||
{ kNormal_SkFontHinting, 0 },
|
||||
{ kNormal_SkFontHinting, SkPaint::kLinearText_Flag },
|
||||
{ kNormal_SkFontHinting, SkPaint::kSubpixelText_Flag },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
@ -112,7 +112,7 @@ static void test_aa_hinting(skiatest::Reporter* reporter) {
|
||||
for (bool aa : {false, true}) {
|
||||
paint.setAntiAlias(aa);
|
||||
for (int hint = 0; hint <= 3; ++hint) {
|
||||
paint.setHinting((SkPaint::Hinting)hint);
|
||||
paint.setHinting((SkFontHinting)hint);
|
||||
SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
|
||||
|
||||
SkPaint p2;
|
||||
|
@ -62,7 +62,7 @@ DEF_TEST(GlyphRunBlob, reporter) {
|
||||
font.setTypeface(tf);
|
||||
font.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
font.setStyle(SkPaint::kFill_Style);
|
||||
font.setHinting(SkPaint::kNormal_Hinting);
|
||||
font.setHinting(kNormal_SkFontHinting);
|
||||
font.setTextSize(1u);
|
||||
|
||||
SkTextBlobBuilder blobBuilder;
|
||||
|
@ -99,7 +99,7 @@ DEF_TEST(SkPDF_tagged, r) {
|
||||
SkPaint paint;
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
paint.setSubpixelText(true);
|
||||
paint.setHinting(SkPaint::kNo_Hinting);
|
||||
paint.setHinting(kNo_SkFontHinting);
|
||||
|
||||
// First page.
|
||||
SkCanvas* canvas =
|
||||
|
@ -208,11 +208,11 @@ DEF_TEST(Paint_flattening, reporter) {
|
||||
kMedium_SkFilterQuality,
|
||||
kHigh_SkFilterQuality,
|
||||
};
|
||||
const SkPaint::Hinting hinting[] = {
|
||||
SkPaint::kNo_Hinting,
|
||||
SkPaint::kSlight_Hinting,
|
||||
SkPaint::kNormal_Hinting,
|
||||
SkPaint::kFull_Hinting,
|
||||
const SkFontHinting hinting[] = {
|
||||
kNo_SkFontHinting,
|
||||
kSlight_SkFontHinting,
|
||||
kNormal_SkFontHinting,
|
||||
kFull_SkFontHinting,
|
||||
};
|
||||
const SkPaint::Cap caps[] = {
|
||||
SkPaint::kButt_Cap,
|
||||
@ -329,9 +329,9 @@ DEF_TEST(Paint_getHash, r) {
|
||||
REPORTER_ASSERT(r, paint.getHash() == defaultHash);
|
||||
|
||||
// This is part of fBitfields, the last field we hash.
|
||||
paint.setHinting(SkPaint::kSlight_Hinting);
|
||||
paint.setHinting(kSlight_SkFontHinting);
|
||||
REPORTER_ASSERT(r, paint.getHash() != defaultHash);
|
||||
paint.setHinting(SkPaint::kNormal_Hinting);
|
||||
paint.setHinting(kNormal_SkFontHinting);
|
||||
REPORTER_ASSERT(r, paint.getHash() == defaultHash);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ sk_sp<SkTextBlob> buildTextBlob(sk_sp<SkTypeface> tf, int glyphCount) {
|
||||
font.setTypeface(tf);
|
||||
font.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
font.setStyle(SkPaint::kFill_Style);
|
||||
font.setHinting(SkPaint::kNormal_Hinting);
|
||||
font.setHinting(kNormal_SkFontHinting);
|
||||
font.setTextSize(1u);
|
||||
font.setAntiAlias(true);
|
||||
font.setSubpixelText(true);
|
||||
@ -432,7 +432,7 @@ sk_sp<SkTextBlob> make_blob_causing_fallback(
|
||||
paint.setTextSize(96);
|
||||
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
paint.setStyle(SkPaint::kFill_Style);
|
||||
paint.setHinting(SkPaint::kNormal_Hinting);
|
||||
paint.setHinting(kNormal_SkFontHinting);
|
||||
|
||||
paint.setTypeface(targetTf);
|
||||
|
||||
|
@ -185,7 +185,7 @@ public:
|
||||
font.setTextScaleX(4.2f);
|
||||
font.setTypeface(SkTypeface::MakeDefault());
|
||||
font.setTextSkewX(0.42f);
|
||||
font.setHinting(SkPaint::kFull_Hinting);
|
||||
font.setHinting(kFull_SkFontHinting);
|
||||
font.setAntiAlias(true);
|
||||
font.setFakeBoldText(true);
|
||||
font.setLinearText(true);
|
||||
|
@ -791,19 +791,19 @@ bool SkDrawCommand::flatten(const SkBitmap& bitmap, Json::Value* target,
|
||||
}
|
||||
|
||||
static void apply_paint_hinting(const SkPaint& paint, Json::Value* target) {
|
||||
SkPaint::Hinting hinting = paint.getHinting();
|
||||
SkFontHinting hinting = (SkFontHinting)paint.getHinting();
|
||||
if (hinting != SkPaintDefaults_Hinting) {
|
||||
switch (hinting) {
|
||||
case SkPaint::kNo_Hinting:
|
||||
case kNo_SkFontHinting:
|
||||
(*target)[SKDEBUGCANVAS_ATTRIBUTE_HINTING] = SKDEBUGCANVAS_HINTING_NONE;
|
||||
break;
|
||||
case SkPaint::kSlight_Hinting:
|
||||
case kSlight_SkFontHinting:
|
||||
(*target)[SKDEBUGCANVAS_ATTRIBUTE_HINTING] = SKDEBUGCANVAS_HINTING_SLIGHT;
|
||||
break;
|
||||
case SkPaint::kNormal_Hinting:
|
||||
case kNormal_SkFontHinting:
|
||||
(*target)[SKDEBUGCANVAS_ATTRIBUTE_HINTING] = SKDEBUGCANVAS_HINTING_NORMAL;
|
||||
break;
|
||||
case SkPaint::kFull_Hinting:
|
||||
case kFull_SkFontHinting:
|
||||
(*target)[SKDEBUGCANVAS_ATTRIBUTE_HINTING] = SKDEBUGCANVAS_HINTING_FULL;
|
||||
break;
|
||||
}
|
||||
|
@ -359,20 +359,20 @@ Viewer::Viewer(int argc, char** argv, void* platformData)
|
||||
fCommands.addCommand('H', "Paint", "Hinting mode", [this]() {
|
||||
if (!fPaintOverrides.fHinting) {
|
||||
fPaintOverrides.fHinting = true;
|
||||
fPaint.setHinting(SkPaint::kNo_Hinting);
|
||||
fPaint.setHinting(kNo_SkFontHinting);
|
||||
} else {
|
||||
switch (fPaint.getHinting()) {
|
||||
case SkPaint::kNo_Hinting:
|
||||
fPaint.setHinting(SkPaint::kSlight_Hinting);
|
||||
switch ((SkFontHinting)fPaint.getHinting()) {
|
||||
case kNo_SkFontHinting:
|
||||
fPaint.setHinting(kSlight_SkFontHinting);
|
||||
break;
|
||||
case SkPaint::kSlight_Hinting:
|
||||
fPaint.setHinting(SkPaint::kNormal_Hinting);
|
||||
case kSlight_SkFontHinting:
|
||||
fPaint.setHinting(kNormal_SkFontHinting);
|
||||
break;
|
||||
case SkPaint::kNormal_Hinting:
|
||||
fPaint.setHinting(SkPaint::kFull_Hinting);
|
||||
case kNormal_SkFontHinting:
|
||||
fPaint.setHinting(kFull_SkFontHinting);
|
||||
break;
|
||||
case SkPaint::kFull_Hinting:
|
||||
fPaint.setHinting(SkPaint::kNo_Hinting);
|
||||
case kFull_SkFontHinting:
|
||||
fPaint.setHinting(kNo_SkFontHinting);
|
||||
fPaintOverrides.fHinting = false;
|
||||
break;
|
||||
}
|
||||
@ -710,17 +710,17 @@ void Viewer::updateTitle() {
|
||||
"Force Autohint", "No Force Autohint");
|
||||
|
||||
if (fPaintOverrides.fHinting) {
|
||||
switch (fPaint.getHinting()) {
|
||||
case SkPaint::kNo_Hinting:
|
||||
switch ((SkFontHinting)fPaint.getHinting()) {
|
||||
case kNo_SkFontHinting:
|
||||
paintTitle.append("No Hinting");
|
||||
break;
|
||||
case SkPaint::kSlight_Hinting:
|
||||
case kSlight_SkFontHinting:
|
||||
paintTitle.append("Slight Hinting");
|
||||
break;
|
||||
case SkPaint::kNormal_Hinting:
|
||||
case kNormal_SkFontHinting:
|
||||
paintTitle.append("Normal Hinting");
|
||||
break;
|
||||
case SkPaint::kFull_Hinting:
|
||||
case kFull_SkFontHinting:
|
||||
paintTitle.append("Full Hinting");
|
||||
break;
|
||||
}
|
||||
@ -1614,17 +1614,17 @@ void Viewer::drawImGui() {
|
||||
if (ImGui::CollapsingHeader("Paint")) {
|
||||
int hintingIdx = 0;
|
||||
if (fPaintOverrides.fHinting) {
|
||||
hintingIdx = fPaint.getHinting() + 1;
|
||||
hintingIdx = static_cast<unsigned>(fPaint.getHinting()) + 1;
|
||||
}
|
||||
if (ImGui::Combo("Hinting", &hintingIdx,
|
||||
"Default\0None\0Slight\0Normal\0Full\0\0"))
|
||||
{
|
||||
if (hintingIdx == 0) {
|
||||
fPaintOverrides.fHinting = false;
|
||||
fPaint.setHinting(SkPaint::kNo_Hinting);
|
||||
fPaint.setHinting(kNo_SkFontHinting);
|
||||
} else {
|
||||
fPaintOverrides.fHinting = true;
|
||||
SkPaint::Hinting hinting = SkTo<SkPaint::Hinting>(hintingIdx - 1);
|
||||
SkFontHinting hinting = SkTo<SkFontHinting>(hintingIdx - 1);
|
||||
fPaint.setHinting(hinting);
|
||||
}
|
||||
paramsChanged = true;
|
||||
|
Loading…
Reference in New Issue
Block a user