Revert "Revert[2] "hide deprecated underline and strikethru""
This reverts commitaab68c56ef
. Reason for revert: android still broken RecordingCanvasTests.cpp Original change's description: > Revert[2] "hide deprecated underline and strikethru" > > android now updated. > > This reverts commite005edd3a5
. > > BUG=skia:6250 > > Change-Id: If08d344cdd863fde1d9955dc3fab671a83be0f73 > Reviewed-on: https://skia-review.googlesource.com/8815 > Commit-Queue: Mike Reed <reed@google.com> > Reviewed-by: Mike Reed <reed@google.com> > TBR=reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:6250 Change-Id: I954575a0e4b9aca8414e10901a7be03a2d7e6396 Reviewed-on: https://skia-review.googlesource.com/8900 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
b16e8ac7f3
commit
cfd3d9ff8f
@ -525,6 +525,8 @@ static SkPaint make_paint() {
|
|||||||
paint.setEmbeddedBitmapText(make_bool());
|
paint.setEmbeddedBitmapText(make_bool());
|
||||||
paint.setAutohinted(make_bool());
|
paint.setAutohinted(make_bool());
|
||||||
paint.setVerticalText(make_bool());
|
paint.setVerticalText(make_bool());
|
||||||
|
paint.setUnderlineText(make_bool());
|
||||||
|
paint.setStrikeThruText(make_bool());
|
||||||
paint.setFakeBoldText(make_bool());
|
paint.setFakeBoldText(make_bool());
|
||||||
paint.setDevKernText(make_bool());
|
paint.setDevKernText(make_bool());
|
||||||
paint.setFilterQuality(make_filter_quality());
|
paint.setFilterQuality(make_filter_quality());
|
||||||
|
@ -141,6 +141,8 @@ static void fuzz_drawText(Fuzz* fuzz, sk_sp<SkTypeface> font) {
|
|||||||
fuzz->next(&b);
|
fuzz->next(&b);
|
||||||
p.setLinearText(b);
|
p.setLinearText(b);
|
||||||
fuzz->next(&b);
|
fuzz->next(&b);
|
||||||
|
p.setStrikeThruText(b);
|
||||||
|
fuzz->next(&b);
|
||||||
p.setSubpixelText(b);
|
p.setSubpixelText(b);
|
||||||
fuzz->next(&x);
|
fuzz->next(&x);
|
||||||
p.setTextScaleX(x);
|
p.setTextScaleX(x);
|
||||||
@ -149,6 +151,8 @@ static void fuzz_drawText(Fuzz* fuzz, sk_sp<SkTypeface> font) {
|
|||||||
fuzz->next(&x);
|
fuzz->next(&x);
|
||||||
p.setTextSize(x);
|
p.setTextSize(x);
|
||||||
fuzz->next(&b);
|
fuzz->next(&b);
|
||||||
|
p.setUnderlineText(b);
|
||||||
|
fuzz->next(&b);
|
||||||
p.setVerticalText(b);
|
p.setVerticalText(b);
|
||||||
|
|
||||||
SkCanvas* cnv = surface->getCanvas();
|
SkCanvas* cnv = surface->getCanvas();
|
||||||
|
@ -195,6 +195,38 @@ DEF_SIMPLE_GM(texteffects, canvas, 460, 680) {
|
|||||||
canvas->restore();
|
canvas->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_SIMPLE_GM(textunderstrike, canvas, 460, 680) {
|
||||||
|
canvas->clear(SK_ColorYELLOW);
|
||||||
|
SkPaint paint;
|
||||||
|
sk_tool_utils::set_portable_typeface(&paint);
|
||||||
|
paint.setTextSize(50);
|
||||||
|
paint.setStrokeWidth(5);
|
||||||
|
paint.setAntiAlias(true);
|
||||||
|
|
||||||
|
auto drawText = [&]() {
|
||||||
|
paint.setStyle(SkPaint::kFill_Style);
|
||||||
|
canvas->drawText("Hello", 5, 100, 50, paint);
|
||||||
|
paint.setStyle(SkPaint::kStroke_Style);
|
||||||
|
canvas->drawText("Hello", 5, 100, 100, paint);
|
||||||
|
canvas->translate(0, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
drawText();
|
||||||
|
paint.setUnderlineText(true);
|
||||||
|
drawText();
|
||||||
|
paint.setUnderlineText(false);
|
||||||
|
paint.setStrikeThruText(true);
|
||||||
|
drawText();
|
||||||
|
paint.setUnderlineText(true);
|
||||||
|
drawText();
|
||||||
|
paint.setColor(SK_ColorWHITE);
|
||||||
|
paint.setStyle(SkPaint::kStroke_Style);
|
||||||
|
canvas->drawText("Hello", 5, 100, 50, paint);
|
||||||
|
paint.setColor(SK_ColorBLUE);
|
||||||
|
paint.setStyle(SkPaint::kFill_Style);
|
||||||
|
canvas->drawText("Hello", 5, 100, 50, paint);
|
||||||
|
}
|
||||||
|
|
||||||
static SkPath create_underline(const SkTDArray<SkScalar>& intersections,
|
static SkPath create_underline(const SkTDArray<SkScalar>& intersections,
|
||||||
SkScalar last, SkScalar finalPos,
|
SkScalar last, SkScalar finalPos,
|
||||||
SkScalar uPos, SkScalar uWidth, SkScalar textSize) {
|
SkScalar uPos, SkScalar uWidth, SkScalar textSize) {
|
||||||
|
@ -17,5 +17,4 @@ android_framework_defines = [
|
|||||||
"SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
|
"SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
|
||||||
"SK_SUPPORT_EXOTIC_CLIPOPS",
|
"SK_SUPPORT_EXOTIC_CLIPOPS",
|
||||||
"SK_SUPPORT_LEGACY_CANVAS_HELPERS",
|
"SK_SUPPORT_LEGACY_CANVAS_HELPERS",
|
||||||
"SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION",
|
|
||||||
]
|
]
|
||||||
|
@ -101,6 +101,8 @@ public:
|
|||||||
enum Flags {
|
enum Flags {
|
||||||
kAntiAlias_Flag = 0x01, //!< mask to enable antialiasing
|
kAntiAlias_Flag = 0x01, //!< mask to enable antialiasing
|
||||||
kDither_Flag = 0x04, //!< mask to enable dithering
|
kDither_Flag = 0x04, //!< mask to enable dithering
|
||||||
|
kUnderlineText_Flag = 0x08, //!< mask to enable underline text
|
||||||
|
kStrikeThruText_Flag = 0x10, //!< mask to enable strike-thru text
|
||||||
kFakeBoldText_Flag = 0x20, //!< mask to enable fake-bold text
|
kFakeBoldText_Flag = 0x20, //!< mask to enable fake-bold text
|
||||||
kLinearText_Flag = 0x40, //!< mask to enable linear-text
|
kLinearText_Flag = 0x40, //!< mask to enable linear-text
|
||||||
kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positioning
|
kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positioning
|
||||||
@ -113,12 +115,7 @@ public:
|
|||||||
// when adding extra flags, note that the fFlags member is specified
|
// when adding extra flags, note that the fFlags member is specified
|
||||||
// with a bit-width and you'll have to expand it.
|
// with a bit-width and you'll have to expand it.
|
||||||
|
|
||||||
kAllFlags = 0xFFFF,
|
kAllFlags = 0xFFFF
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION
|
|
||||||
kUnderlineText_Flag = 0x08,
|
|
||||||
kStrikeThruText_Flag = 0x10,
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||||
@ -241,16 +238,28 @@ public:
|
|||||||
/** Helper for getFlags(), returning true if kUnderlineText_Flag bit is set
|
/** Helper for getFlags(), returning true if kUnderlineText_Flag bit is set
|
||||||
@return true if the underlineText bit is set in the paint's flags.
|
@return true if the underlineText bit is set in the paint's flags.
|
||||||
*/
|
*/
|
||||||
#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION
|
bool isUnderlineText() const {
|
||||||
bool isUnderlineText() const { return false; }
|
return SkToBool(this->getFlags() & kUnderlineText_Flag);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
/** Helper for setFlags(), setting or clearing the kUnderlineText_Flag bit
|
||||||
|
@param underlineText true to set the underlineText bit in the paint's
|
||||||
|
flags, false to clear it.
|
||||||
|
*/
|
||||||
|
void setUnderlineText(bool underlineText);
|
||||||
|
|
||||||
/** Helper for getFlags(), returns true if kStrikeThruText_Flag bit is set
|
/** Helper for getFlags(), returns true if kStrikeThruText_Flag bit is set
|
||||||
@return true if the strikeThruText bit is set in the paint's flags.
|
@return true if the strikeThruText bit is set in the paint's flags.
|
||||||
*/
|
*/
|
||||||
#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION
|
bool isStrikeThruText() const {
|
||||||
bool isStrikeThruText() const { return false; }
|
return SkToBool(this->getFlags() & kStrikeThruText_Flag);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
/** Helper for setFlags(), setting or clearing the kStrikeThruText_Flag bit
|
||||||
|
@param strikeThruText true to set the strikeThruText bit in the
|
||||||
|
paint's flags, false to clear it.
|
||||||
|
*/
|
||||||
|
void setStrikeThruText(bool strikeThruText);
|
||||||
|
|
||||||
/** Helper for getFlags(), returns true if kFakeBoldText_Flag bit is set
|
/** Helper for getFlags(), returns true if kFakeBoldText_Flag bit is set
|
||||||
@return true if the kFakeBoldText_Flag bit is set in the paint's flags.
|
@return true if the kFakeBoldText_Flag bit is set in the paint's flags.
|
||||||
|
@ -600,7 +600,6 @@ DEFINES_ALL = [
|
|||||||
"SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF",
|
"SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF",
|
||||||
"SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES",
|
"SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES",
|
||||||
"SK_SUPPORT_LEGACY_CANVAS_HELPERS",
|
"SK_SUPPORT_LEGACY_CANVAS_HELPERS",
|
||||||
"SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -495,6 +495,8 @@ static SkPaint make_paint() {
|
|||||||
paint.setEmbeddedBitmapText(make_bool());
|
paint.setEmbeddedBitmapText(make_bool());
|
||||||
paint.setAutohinted(make_bool());
|
paint.setAutohinted(make_bool());
|
||||||
paint.setVerticalText(make_bool());
|
paint.setVerticalText(make_bool());
|
||||||
|
paint.setUnderlineText(make_bool());
|
||||||
|
paint.setStrikeThruText(make_bool());
|
||||||
paint.setFakeBoldText(make_bool());
|
paint.setFakeBoldText(make_bool());
|
||||||
paint.setDevKernText(make_bool());
|
paint.setDevKernText(make_bool());
|
||||||
paint.setFilterQuality(make_filter_quality());
|
paint.setFilterQuality(make_filter_quality());
|
||||||
|
@ -245,6 +245,14 @@ void SkPaint::setVerticalText(bool doVertical) {
|
|||||||
this->setFlags(set_clear_mask(fBitfields.fFlags, doVertical, kVerticalText_Flag));
|
this->setFlags(set_clear_mask(fBitfields.fFlags, doVertical, kVerticalText_Flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkPaint::setUnderlineText(bool doUnderline) {
|
||||||
|
this->setFlags(set_clear_mask(fBitfields.fFlags, doUnderline, kUnderlineText_Flag));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkPaint::setStrikeThruText(bool doStrikeThru) {
|
||||||
|
this->setFlags(set_clear_mask(fBitfields.fFlags, doStrikeThru, kStrikeThruText_Flag));
|
||||||
|
}
|
||||||
|
|
||||||
void SkPaint::setFakeBoldText(bool doFakeBold) {
|
void SkPaint::setFakeBoldText(bool doFakeBold) {
|
||||||
this->setFlags(set_clear_mask(fBitfields.fFlags, doFakeBold, kFakeBoldText_Flag));
|
this->setFlags(set_clear_mask(fBitfields.fFlags, doFakeBold, kFakeBoldText_Flag));
|
||||||
}
|
}
|
||||||
@ -2134,6 +2142,8 @@ void SkPaint::toString(SkString* str) const {
|
|||||||
bool needSeparator = false;
|
bool needSeparator = false;
|
||||||
SkAddFlagToString(str, this->isAntiAlias(), "AntiAlias", &needSeparator);
|
SkAddFlagToString(str, this->isAntiAlias(), "AntiAlias", &needSeparator);
|
||||||
SkAddFlagToString(str, this->isDither(), "Dither", &needSeparator);
|
SkAddFlagToString(str, this->isDither(), "Dither", &needSeparator);
|
||||||
|
SkAddFlagToString(str, this->isUnderlineText(), "UnderlineText", &needSeparator);
|
||||||
|
SkAddFlagToString(str, this->isStrikeThruText(), "StrikeThruText", &needSeparator);
|
||||||
SkAddFlagToString(str, this->isFakeBoldText(), "FakeBoldText", &needSeparator);
|
SkAddFlagToString(str, this->isFakeBoldText(), "FakeBoldText", &needSeparator);
|
||||||
SkAddFlagToString(str, this->isLinearText(), "LinearText", &needSeparator);
|
SkAddFlagToString(str, this->isLinearText(), "LinearText", &needSeparator);
|
||||||
SkAddFlagToString(str, this->isSubpixelText(), "SubpixelText", &needSeparator);
|
SkAddFlagToString(str, this->isSubpixelText(), "SubpixelText", &needSeparator);
|
||||||
|
@ -56,6 +56,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
const static uint32_t kFlagsMask =
|
const static uint32_t kFlagsMask =
|
||||||
SkPaint::kAntiAlias_Flag |
|
SkPaint::kAntiAlias_Flag |
|
||||||
|
SkPaint::kUnderlineText_Flag |
|
||||||
|
SkPaint::kStrikeThruText_Flag |
|
||||||
SkPaint::kFakeBoldText_Flag |
|
SkPaint::kFakeBoldText_Flag |
|
||||||
SkPaint::kLinearText_Flag |
|
SkPaint::kLinearText_Flag |
|
||||||
SkPaint::kSubpixelText_Flag |
|
SkPaint::kSubpixelText_Flag |
|
||||||
|
@ -186,6 +186,8 @@ public:
|
|||||||
font.setTextAlign(SkPaint::kCenter_Align);
|
font.setTextAlign(SkPaint::kCenter_Align);
|
||||||
font.setHinting(SkPaint::kFull_Hinting);
|
font.setHinting(SkPaint::kFull_Hinting);
|
||||||
font.setAntiAlias(true);
|
font.setAntiAlias(true);
|
||||||
|
font.setUnderlineText(true);
|
||||||
|
font.setStrikeThruText(true);
|
||||||
font.setFakeBoldText(true);
|
font.setFakeBoldText(true);
|
||||||
font.setLinearText(true);
|
font.setLinearText(true);
|
||||||
font.setSubpixelText(true);
|
font.setSubpixelText(true);
|
||||||
@ -205,6 +207,8 @@ public:
|
|||||||
REPORTER_ASSERT(reporter, defaultPaint.getTextAlign() != font.getTextAlign());
|
REPORTER_ASSERT(reporter, defaultPaint.getTextAlign() != font.getTextAlign());
|
||||||
REPORTER_ASSERT(reporter, defaultPaint.getHinting() != font.getHinting());
|
REPORTER_ASSERT(reporter, defaultPaint.getHinting() != font.getHinting());
|
||||||
REPORTER_ASSERT(reporter, defaultPaint.isAntiAlias() != font.isAntiAlias());
|
REPORTER_ASSERT(reporter, defaultPaint.isAntiAlias() != font.isAntiAlias());
|
||||||
|
REPORTER_ASSERT(reporter, defaultPaint.isUnderlineText() != font.isUnderlineText());
|
||||||
|
REPORTER_ASSERT(reporter, defaultPaint.isStrikeThruText() != font.isStrikeThruText());
|
||||||
REPORTER_ASSERT(reporter, defaultPaint.isFakeBoldText() != font.isFakeBoldText());
|
REPORTER_ASSERT(reporter, defaultPaint.isFakeBoldText() != font.isFakeBoldText());
|
||||||
REPORTER_ASSERT(reporter, defaultPaint.isLinearText() != font.isLinearText());
|
REPORTER_ASSERT(reporter, defaultPaint.isLinearText() != font.isLinearText());
|
||||||
REPORTER_ASSERT(reporter, defaultPaint.isSubpixelText() != font.isSubpixelText());
|
REPORTER_ASSERT(reporter, defaultPaint.isSubpixelText() != font.isSubpixelText());
|
||||||
@ -234,6 +238,8 @@ public:
|
|||||||
REPORTER_ASSERT(reporter, paint.getTextAlign() == font.getTextAlign());
|
REPORTER_ASSERT(reporter, paint.getTextAlign() == font.getTextAlign());
|
||||||
REPORTER_ASSERT(reporter, paint.getHinting() == font.getHinting());
|
REPORTER_ASSERT(reporter, paint.getHinting() == font.getHinting());
|
||||||
REPORTER_ASSERT(reporter, paint.isAntiAlias() == font.isAntiAlias());
|
REPORTER_ASSERT(reporter, paint.isAntiAlias() == font.isAntiAlias());
|
||||||
|
REPORTER_ASSERT(reporter, paint.isUnderlineText() == font.isUnderlineText());
|
||||||
|
REPORTER_ASSERT(reporter, paint.isStrikeThruText() == font.isStrikeThruText());
|
||||||
REPORTER_ASSERT(reporter, paint.isFakeBoldText() == font.isFakeBoldText());
|
REPORTER_ASSERT(reporter, paint.isFakeBoldText() == font.isFakeBoldText());
|
||||||
REPORTER_ASSERT(reporter, paint.isLinearText() == font.isLinearText());
|
REPORTER_ASSERT(reporter, paint.isLinearText() == font.isLinearText());
|
||||||
REPORTER_ASSERT(reporter, paint.isSubpixelText() == font.isSubpixelText());
|
REPORTER_ASSERT(reporter, paint.isSubpixelText() == font.isSubpixelText());
|
||||||
|
@ -112,6 +112,7 @@ void CommandSet::drawHelp(SkCanvas* canvas) {
|
|||||||
|
|
||||||
SkPaint groupPaint;
|
SkPaint groupPaint;
|
||||||
groupPaint.setTextSize(18);
|
groupPaint.setTextSize(18);
|
||||||
|
groupPaint.setUnderlineText(true);
|
||||||
groupPaint.setAntiAlias(true);
|
groupPaint.setAntiAlias(true);
|
||||||
groupPaint.setColor(0xFFFFFFFF);
|
groupPaint.setColor(0xFFFFFFFF);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user