Revert "rm legacy flags for hinting enum"

This reverts commit 5cd242b4fc.

Reason for revert: breaking google3

Original change's description:
> rm legacy flags for hinting enum
> 
> Bug: skia:
> Change-Id: I56ad33fa30aa8cec8a60cd70d4e4767defb923ca
> Reviewed-on: https://skia-review.googlesource.com/c/170105
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com

Change-Id: Iffa9b20d77455b4554aae132268af8a0cf252496
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/170270
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-11-09 21:59:13 +00:00 committed by Skia Commit-Bot
parent 5327536d17
commit d7a4bea20a
4 changed files with 56 additions and 7 deletions

View File

@ -47,7 +47,7 @@ static void init_paint(Fuzz* fuzz, SkPaint* p) {
fuzz->nextRange(&tmp_u8, 0, (int)kHigh_SkFilterQuality);
p->setFilterQuality(static_cast<SkFilterQuality>(tmp_u8));
fuzz->nextRange(&tmp_u8, 0, (int)SkFontHinting::kFull);
fuzz->nextRange(&tmp_u8, 0, (int)SkPaint::kFull_Hinting);
p->setHinting(static_cast<SkFontHinting>(tmp_u8));
fuzz->nextRange(&tmp_u8, 0, (int)SkPaint::kLast_Cap);

View File

@ -66,9 +66,17 @@ public:
void DEPRECATED_setAntiAlias(bool);
void DEPRECATED_setLCDRender(bool);
SkFontHinting getHinting() const { return (SkFontHinting)fHinting; }
void setHinting(SkFontHinting);
#ifdef SK_SUPPORT_LEGACY_NESTED_HINTINGENUM
Hinting getHinting() const { return (Hinting)fHinting; }
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.
* If size is not supported (e.g. <= 0 or non-finite) NULL will be returned.

View File

@ -18,6 +18,14 @@ enum SkTextEncoding : uint8_t {
kGlyphID_SkTextEncoding,
};
#ifdef SK_SUPPORT_LEGACY_NONCLASS_HINTINGENUM
enum SkFontHinting : uint8_t {
kNo_SkFontHinting = 0, //!< glyph outlines unchanged
kSlight_SkFontHinting = 1, //!< minimal modification to improve constrast
kNormal_SkFontHinting = 2, //!< glyph outlines modified to improve constrast
kFull_SkFontHinting = 3, //!< modifies glyph outlines for maximum constrast
};
#else
enum class SkFontHinting {
kNone, //!< glyph outlines unchanged
kSlight, //!< minimal modification to improve constrast
@ -29,5 +37,6 @@ enum class SkFontHinting {
#define kSlight_SkFontHinting SkFontHinting::kSlight
#define kNormal_SkFontHinting SkFontHinting::kNormal
#define kFull_SkFontHinting SkFontHinting::kFull
#endif
#endif

View File

@ -183,12 +183,20 @@ public:
*/
void reset();
/** Returns level of glyph outline adjustment.
/** \enum SkPaint::Hinting
Hinting adjusts the glyph outlines so that the shape provides a uniform
look at a given point size on font engines that support it. Hinting may have a
muted effect or no effect at all depending on the platform.
@return one of: SkFontHinting::kNone, SkFontHinting::kSlight, SkFontHinting::kNormal,
SkFontHinting::kFull
*/
SkFontHinting getHinting() const { return (SkFontHinting)fBitfields.fHinting; }
The four levels roughly control corresponding features on platforms that use FreeType
as the font engine.
*/
enum Hinting : uint8_t {
kNo_Hinting = 0, //!< glyph outlines unchanged
kSlight_Hinting = 1, //!< minimal modification to improve constrast
kNormal_Hinting = 2, //!< glyph outlines modified to improve constrast
kFull_Hinting = 3, //!< modifies glyph outlines for maximum constrast
};
/** Sets level of glyph outline adjustment.
Does not check for valid values of hintingLevel.
@ -198,6 +206,30 @@ public:
*/
void setHinting(SkFontHinting hintingLevel);
#ifdef SK_SUPPORT_LEGACY_NESTED_HINTINGENUM
/** Returns level of glyph outline adjustment.
@return one of: kNo_Hinting, kSlight_Hinting, kNormal_Hinting, kFull_Hinting
*/
Hinting getHinting() const { return (Hinting)fBitfields.fHinting; }
/** Sets level of glyph outline adjustment.
Does not check for valid values of h.
@param h one of: kNo_Hinting, kSlight_Hinting, kNormal_Hinting, kFull_Hinting
*/
void setHinting(Hinting h) {
this->setHinting((SkFontHinting)h);
}
#else
/** Returns level of glyph outline adjustment.
@return one of: SkFontHinting::kNone, SkFontHinting::kSlight, SkFontHinting::kNormal,
SkFontHinting::kFull
*/
SkFontHinting getHinting() const { return (SkFontHinting)fBitfields.fHinting; }
#endif
/** \enum SkPaint::Flags
The bit values stored in Flags.
The default value for Flags, normally zero, can be changed at compile time