Revert "Revert "hide nested hinting enum""
This reverts commit 6bd19df9fa9d26d9de4de646b2cdf82ff5dca67c.
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>
diff --git a/fuzz/FuzzCanvas.cpp b/fuzz/FuzzCanvas.cpp
index ae675e7..fe03b2f 100644
--- a/fuzz/FuzzCanvas.cpp
+++ b/fuzz/FuzzCanvas.cpp
@@ -888,8 +888,8 @@
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) {
diff --git a/fuzz/FuzzDrawFunctions.cpp b/fuzz/FuzzDrawFunctions.cpp
index 00166a9..56e6cdf 100644
--- a/fuzz/FuzzDrawFunctions.cpp
+++ b/fuzz/FuzzDrawFunctions.cpp
@@ -48,7 +48,7 @@
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));
diff --git a/gm/fontscaler.cpp b/gm/fontscaler.cpp
index 0ff4d50..14f6138 100644
--- a/gm/fontscaler.cpp
+++ b/gm/fontscaler.cpp
@@ -35,7 +35,7 @@
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);
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index fe43e75..a7287ec 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -184,10 +184,12 @@
// 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 @@
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) {
diff --git a/gn/flutter_defines.gni b/gn/flutter_defines.gni
index 37fa386..29a0e88 100644
--- a/gn/flutter_defines.gni
+++ b/gn/flutter_defines.gni
@@ -13,6 +13,10 @@
"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",
diff --git a/include/core/SkFont.h b/include/core/SkFont.h
index 2311491..7ef02dc 100644
--- a/include/core/SkFont.h
+++ b/include/core/SkFont.h
@@ -66,11 +66,16 @@
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.
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 2f278c9..32e2896 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -198,14 +198,6 @@
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 @@
*/
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.
diff --git a/modules/skottie/src/SkottieAdapter.cpp b/modules/skottie/src/SkottieAdapter.cpp
index 1426b79..d449856 100644
--- a/modules/skottie/src/SkottieAdapter.cpp
+++ b/modules/skottie/src/SkottieAdapter.cpp
@@ -212,7 +212,7 @@
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);
diff --git a/modules/sksg/include/SkSGText.h b/modules/sksg/include/SkSGText.h
index cce9c5a..605e608 100644
--- a/modules/sksg/include/SkSGText.h
+++ b/modules/sksg/include/SkSGText.h
@@ -38,7 +38,7 @@
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 @@
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
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index 60349e9..f3fc02f 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -159,8 +159,8 @@
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() {
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index c4a02e9..7216e51 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -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 @@
, 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 @@
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 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;
}
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 73c7013..e7ed230 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -59,7 +59,7 @@
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 @@
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 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 @@
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(),
diff --git a/src/core/SkPaintDefaults.h b/src/core/SkPaintDefaults.h
index 3ea1cd3..708365b 100644
--- a/src/core/SkPaintDefaults.h
+++ b/src/core/SkPaintDefaults.h
@@ -25,7 +25,7 @@
#endif
#ifndef SkPaintDefaults_Hinting
- #define SkPaintDefaults_Hinting SkPaint::kNormal_Hinting
+ #define SkPaintDefaults_Hinting kNormal_SkFontHinting
#endif
#ifndef SkPaintDefaults_MiterLimit
diff --git a/src/core/SkPaint_text.cpp b/src/core/SkPaint_text.cpp
index fcbc7d4..21a7c95 100644
--- a/src/core/SkPaint_text.cpp
+++ b/src/core/SkPaint_text.cpp
@@ -291,7 +291,7 @@
flags |= SkPaint::kSubpixelText_Flag;
this->setFlags(flags);
- this->setHinting(SkPaint::kNo_Hinting);
+ this->setHinting(kNo_SkFontHinting);
this->setStyle(SkPaint::kFill_Style);
this->setPathEffect(nullptr);
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index 4d1a664..627e2de 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -27,7 +27,7 @@
, 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 @@
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);
}
diff --git a/src/core/SkTextBlobPriv.h b/src/core/SkTextBlobPriv.h
index 67c97e6..149e652 100644
--- a/src/core/SkTextBlobPriv.h
+++ b/src/core/SkTextBlobPriv.h
@@ -92,7 +92,7 @@
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;
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 94ce203..ee8f1d00 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -188,7 +188,7 @@
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());
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index f0f9abc..490edfb 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1103,7 +1103,7 @@
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());
}
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index d797338..8f31408 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -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 @@
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) {
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 495a4f6..561953e 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -818,7 +818,7 @@
}
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;
}
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index fc1b53d..39ebcc7 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -249,18 +249,18 @@
};
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 {
diff --git a/tests/FontObjTest.cpp b/tests/FontObjTest.cpp
index fa96112..4f7e526 100644
--- a/tests/FontObjTest.cpp
+++ b/tests/FontObjTest.cpp
@@ -42,18 +42,18 @@
};
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 @@
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;
diff --git a/tests/GlyphRunTest.cpp b/tests/GlyphRunTest.cpp
index 877686d..a3153fc 100644
--- a/tests/GlyphRunTest.cpp
+++ b/tests/GlyphRunTest.cpp
@@ -62,7 +62,7 @@
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;
diff --git a/tests/PDFTaggedTest.cpp b/tests/PDFTaggedTest.cpp
index ca41892..f836138 100644
--- a/tests/PDFTaggedTest.cpp
+++ b/tests/PDFTaggedTest.cpp
@@ -99,7 +99,7 @@
SkPaint paint;
paint.setColor(SK_ColorBLACK);
paint.setSubpixelText(true);
- paint.setHinting(SkPaint::kNo_Hinting);
+ paint.setHinting(kNo_SkFontHinting);
// First page.
SkCanvas* canvas =
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index fa1340c..304dd02 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -208,11 +208,11 @@
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 @@
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);
}
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index 4d87dee..2728c76 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -70,7 +70,7 @@
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 @@
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);
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index a6ab362..158b0b9 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -185,7 +185,7 @@
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);
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index be506e7..229cd49 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -791,19 +791,19 @@
}
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;
}
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index bf779e9..0ced76a 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -359,20 +359,20 @@
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 @@
"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 @@
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;