hide deprecated underline and strikethru
authorMike Reed <reed@google.com>
Fri, 17 Feb 2017 14:28:22 +0000 (09:28 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 17 Feb 2017 17:31:33 +0000 (17:31 +0000)
BUG=skia:6250

Change-Id: I85395e4960b16ab91237a74ff35e5b7588965512
Reviewed-on: https://skia-review.googlesource.com/8600
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>

fuzz/FilterFuzz.cpp
fuzz/FuzzDrawFunctions.cpp
gm/texteffects.cpp
gn/android_framework_defines.gni
include/core/SkPaint.h
public.bzl
samplecode/SampleFilterFuzz.cpp
src/core/SkPaint.cpp
src/core/SkTextBlob.cpp
tests/TextBlobTest.cpp
tools/viewer/sk_app/CommandSet.cpp

index e3d30b5..bd9e5fd 100644 (file)
@@ -525,8 +525,6 @@ static SkPaint make_paint() {
     paint.setEmbeddedBitmapText(make_bool());
     paint.setAutohinted(make_bool());
     paint.setVerticalText(make_bool());
-    paint.setUnderlineText(make_bool());
-    paint.setStrikeThruText(make_bool());
     paint.setFakeBoldText(make_bool());
     paint.setDevKernText(make_bool());
     paint.setFilterQuality(make_filter_quality());
index af4d09b..8c40bce 100644 (file)
@@ -137,8 +137,6 @@ static void fuzz_drawText(Fuzz* fuzz, sk_sp<SkTypeface> font) {
     fuzz->next(&b);
     p.setLinearText(b);
     fuzz->next(&b);
-    p.setStrikeThruText(b);
-    fuzz->next(&b);
     p.setSubpixelText(b);
     fuzz->next(&x);
     p.setTextScaleX(x);
@@ -147,8 +145,6 @@ static void fuzz_drawText(Fuzz* fuzz, sk_sp<SkTypeface> font) {
     fuzz->next(&x);
     p.setTextSize(x);
     fuzz->next(&b);
-    p.setUnderlineText(b);
-    fuzz->next(&b);
     p.setVerticalText(b);
 
     SkCanvas* cnv = surface->getCanvas();
index c4c389a..e74d7a9 100644 (file)
@@ -195,38 +195,6 @@ DEF_SIMPLE_GM(texteffects, canvas, 460, 680) {
         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,
         SkScalar last, SkScalar finalPos,
         SkScalar uPos, SkScalar uWidth, SkScalar textSize) {
index b693d28..43a309e 100644 (file)
@@ -16,4 +16,5 @@ android_framework_defines = [
   "SK_SUPPORT_LEGACY_SHADER_ISABITMAP",
   "SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
   "SK_SUPPORT_EXOTIC_CLIPOPS",
+  "SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION",
 ]
index 7a42238..f4b6db9 100644 (file)
@@ -101,8 +101,6 @@ public:
     enum Flags {
         kAntiAlias_Flag       = 0x01,   //!< mask to enable antialiasing
         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
         kLinearText_Flag      = 0x40,   //!< mask to enable linear-text
         kSubpixelText_Flag    = 0x80,   //!< mask to enable subpixel text positioning
@@ -115,7 +113,12 @@ public:
         // when adding extra flags, note that the fFlags member is specified
         // 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
     };
 
     /** Return the paint's flags. Use the Flag enum to test flag values.
@@ -229,28 +232,16 @@ public:
     /** Helper for getFlags(), returning true if kUnderlineText_Flag bit is set
         @return true if the underlineText bit is set in the paint's flags.
     */
-    bool isUnderlineText() const {
-        return SkToBool(this->getFlags() & kUnderlineText_Flag);
-    }
-
-    /** 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);
+#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION
+    bool isUnderlineText() const { return false; }
+#endif
 
     /** Helper for getFlags(), returns true if kStrikeThruText_Flag bit is set
         @return true if the strikeThruText bit is set in the paint's flags.
     */
-    bool isStrikeThruText() const {
-        return SkToBool(this->getFlags() & kStrikeThruText_Flag);
-    }
-
-    /** 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);
+#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION
+    bool isStrikeThruText() const { return false; }
+#endif
 
     /** 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.
index a69b760..7975875 100644 (file)
@@ -596,6 +596,7 @@ DEFINES_ALL = [
     "SK_NO_ANALYTIC_AA",
     "SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF",
     "SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES",
+    "SK_SUPPORT_LEGACY_PAINT_TEXTDECORATION",
 ]
 
 ################################################################################
index ef4eee8..d90476a 100644 (file)
@@ -495,8 +495,6 @@ static SkPaint make_paint() {
     paint.setEmbeddedBitmapText(make_bool());
     paint.setAutohinted(make_bool());
     paint.setVerticalText(make_bool());
-    paint.setUnderlineText(make_bool());
-    paint.setStrikeThruText(make_bool());
     paint.setFakeBoldText(make_bool());
     paint.setDevKernText(make_bool());
     paint.setFilterQuality(make_filter_quality());
index a2dfa73..568ba6a 100644 (file)
@@ -245,14 +245,6 @@ void SkPaint::setVerticalText(bool doVertical) {
     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) {
     this->setFlags(set_clear_mask(fBitfields.fFlags, doFakeBold, kFakeBoldText_Flag));
 }
@@ -2142,8 +2134,6 @@ void SkPaint::toString(SkString* str) const {
         bool needSeparator = false;
         SkAddFlagToString(str, this->isAntiAlias(), "AntiAlias", &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->isLinearText(), "LinearText", &needSeparator);
         SkAddFlagToString(str, this->isSubpixelText(), "SubpixelText", &needSeparator);
index 4065771..817fc62 100644 (file)
@@ -56,8 +56,6 @@ public:
 private:
     const static uint32_t kFlagsMask =
         SkPaint::kAntiAlias_Flag          |
-        SkPaint::kUnderlineText_Flag      |
-        SkPaint::kStrikeThruText_Flag     |
         SkPaint::kFakeBoldText_Flag       |
         SkPaint::kLinearText_Flag         |
         SkPaint::kSubpixelText_Flag       |
index dafbe74..09389a4 100644 (file)
@@ -186,8 +186,6 @@ public:
         font.setTextAlign(SkPaint::kCenter_Align);
         font.setHinting(SkPaint::kFull_Hinting);
         font.setAntiAlias(true);
-        font.setUnderlineText(true);
-        font.setStrikeThruText(true);
         font.setFakeBoldText(true);
         font.setLinearText(true);
         font.setSubpixelText(true);
@@ -207,8 +205,6 @@ public:
         REPORTER_ASSERT(reporter, defaultPaint.getTextAlign() != font.getTextAlign());
         REPORTER_ASSERT(reporter, defaultPaint.getHinting() != font.getHinting());
         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.isLinearText() != font.isLinearText());
         REPORTER_ASSERT(reporter, defaultPaint.isSubpixelText() != font.isSubpixelText());
@@ -238,8 +234,6 @@ public:
             REPORTER_ASSERT(reporter, paint.getTextAlign() == font.getTextAlign());
             REPORTER_ASSERT(reporter, paint.getHinting() == font.getHinting());
             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.isLinearText() == font.isLinearText());
             REPORTER_ASSERT(reporter, paint.isSubpixelText() == font.isSubpixelText());
index f6568ec..689b97f 100644 (file)
@@ -112,7 +112,6 @@ void CommandSet::drawHelp(SkCanvas* canvas) {
 
     SkPaint groupPaint;
     groupPaint.setTextSize(18);
-    groupPaint.setUnderlineText(true);
     groupPaint.setAntiAlias(true);
     groupPaint.setColor(0xFFFFFFFF);