try to deprecate fFlagsMask from SkLayerDrawLooper
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 27 Feb 2014 14:27:44 +0000 (14:27 +0000)
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 27 Feb 2014 14:27:44 +0000 (14:27 +0000)
We think we want to move around how flags/fields like linearText and strikeThru
are specified. SkPaint has helpers for nearly all of these, but LayerInfo in
the draw looper just exposes the raw bitfield.

On survey of chrome/android, it appears that no one uses those, so it may be
safe to just remove the feature entirely from the looper.

R=bungeman@google.com, scroggo@google.com

Review URL: https://codereview.chromium.org/181433009

git-svn-id: http://skia.googlecode.com/svn/trunk@13607 2bbb7eff-a529-9590-31e7-b0007b416f81

bench/BlurRoundRectBench.cpp
bench/RectoriBench.cpp
gm/blurroundrect.cpp
gm/drawlooper.cpp
gm/megalooper.cpp
include/effects/SkLayerDrawLooper.h
src/effects/SkLayerDrawLooper.cpp

index 2c8ea95f178717b044251fd94c729d943bbd53aa..29c00805940262af617a4ce8d1e7fc2248cdb960 100644 (file)
@@ -43,7 +43,6 @@ public:
         SkLayerDrawLooper* looper = new SkLayerDrawLooper;
         {
             SkLayerDrawLooper::LayerInfo info;
-            info.fFlagsMask = 0;
             info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
                               | SkLayerDrawLooper::kColorFilter_Bit;
             info.fColorMode = SkXfermode::kSrc_Mode;
index e3bf41b78e8f06d85423493939353c32551543a7..ee79ca9964500135b187d8a11e9bbc3d0809ce8c 100644 (file)
@@ -76,7 +76,6 @@ private:
         //-----------------------------------------------
         SkLayerDrawLooper::LayerInfo info;
 
-        info.fFlagsMask = 0;
         // TODO: add a color filter to better match what is seen in the wild
         info.fPaintBits = /* SkLayerDrawLooper::kColorFilter_Bit |*/
                           SkLayerDrawLooper::kMaskFilter_Bit;
index 6a466c9c877ca5c0bc2c58bd9469e737595eb271..6c3903fd4070f03c2ae7fdbc4c89363bdc392e2e 100644 (file)
@@ -56,7 +56,6 @@ public:
         SkLayerDrawLooper* looper = new SkLayerDrawLooper;
         {
             SkLayerDrawLooper::LayerInfo info;
-            info.fFlagsMask = 0;
             info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
                               | SkLayerDrawLooper::kColorFilter_Bit;
             info.fColorMode = SkXfermode::kSrc_Mode;
index 4cc6e8e3693e021572775807573448ea89e74d6a..678d2ad35f2a8a226053af1d709b0a87829d893b 100644 (file)
@@ -39,6 +39,7 @@ protected:
         this->init();
 
         SkPaint  paint;
+        paint.setAntiAlias(true);
         paint.setTextSize(SkIntToScalar(72));
         paint.setLooper(fLooper);
 
@@ -74,14 +75,12 @@ private:
         fLooper = new SkLayerDrawLooper;
 
         SkLayerDrawLooper::LayerInfo info;
-        info.fFlagsMask = SkPaint::kAntiAlias_Flag;
         info.fPaintBits = SkLayerDrawLooper::kStyle_Bit | SkLayerDrawLooper::kMaskFilter_Bit;
         info.fColorMode = SkXfermode::kSrc_Mode;
 
         for (size_t i = 0; i < SK_ARRAY_COUNT(gParams); i++) {
             info.fOffset.set(gParams[i].fOffset, gParams[i].fOffset);
             SkPaint* paint = fLooper->addLayer(info);
-            paint->setAntiAlias(true);
             paint->setColor(gParams[i].fColor);
             paint->setStyle(gParams[i].fStyle);
             paint->setStrokeWidth(gParams[i].fWidth);
index 9a1de70dfa9c2e95dc19394064d26ba8a436ff31..12ccf2db5fd84e7c7b573b64580ddf298efd9a6d 100644 (file)
@@ -166,7 +166,6 @@ private:
         SkLayerDrawLooper* looper = new SkLayerDrawLooper;
         SkLayerDrawLooper::LayerInfo info;
 
-        info.fFlagsMask = 0;
         info.fPaintBits = SkLayerDrawLooper::kColorFilter_Bit |
                           SkLayerDrawLooper::kMaskFilter_Bit;
         info.fColorMode = SkXfermode::kSrc_Mode;
@@ -211,7 +210,6 @@ private:
         SkLayerDrawLooper* looper = new SkLayerDrawLooper;
         SkLayerDrawLooper::LayerInfo info;
 
-        info.fFlagsMask = 0;
         info.fPaintBits = SkLayerDrawLooper::kColorFilter_Bit |
                           SkLayerDrawLooper::kMaskFilter_Bit;
         info.fColorMode = SkXfermode::kSrc_Mode;
index e1fae57cb860650e584c159a0359a416b808f303..c3ab24160770418bc45b537833f4ac1587144ae6 100644 (file)
@@ -66,7 +66,9 @@ public:
      *      kDst_Mode: to just keep the draw's color, ignoring the layer's
      */
     struct SK_API LayerInfo {
+#ifdef SK_SUPPORT_LEGACY_LAYERDRAWLOOPER_PAINTFLAGS
         uint32_t            fFlagsMask; // SkPaint::Flags
+#endif
         BitFlags            fPaintBits;
         SkXfermode::Mode    fColorMode;
         SkVector            fOffset;
index 49263fbbb5d746c7ccca6b204998c3643e4d4b18..cb60ff1e974a641dfc59d1a0c67d99c5cf0161a7 100644 (file)
@@ -15,7 +15,9 @@
 #include "SkUnPreMultiply.h"
 
 SkLayerDrawLooper::LayerInfo::LayerInfo() {
-    fFlagsMask = 0;                     // ignore our paint flags
+#ifdef SK_SUPPORT_LEGACY_LAYERDRAWLOOPER_PAINTFLAGS
+    fFlagsMask = 0;                     // ignore layerinfo's paint flags
+#endif
     fPaintBits = 0;                     // ignore our paint fields
     fColorMode = SkXfermode::kDst_Mode; // ignore our color
     fOffset.set(0, 0);
@@ -102,8 +104,10 @@ static SkColor xferColor(SkColor src, SkColor dst, SkXfermode::Mode mode) {
 void SkLayerDrawLooper::ApplyInfo(SkPaint* dst, const SkPaint& src,
                                   const LayerInfo& info) {
 
+#ifdef SK_SUPPORT_LEGACY_LAYERDRAWLOOPER_PAINTFLAGS
     uint32_t mask = info.fFlagsMask;
     dst->setFlags((dst->getFlags() & ~mask) | (src.getFlags() & mask));
+#endif
     dst->setColor(xferColor(src.getColor(), dst->getColor(), info.fColorMode));
 
     BitFlags bits = info.fPaintBits;
@@ -211,7 +215,11 @@ void SkLayerDrawLooper::flatten(SkWriteBuffer& buffer) const {
 
     Rec* rec = fRecs;
     for (int i = 0; i < fCount; i++) {
+#ifdef SK_SUPPORT_LEGACY_LAYERDRAWLOOPER_PAINTFLAGS
         buffer.writeInt(rec->fInfo.fFlagsMask);
+#else
+        buffer.writeInt(0); // remove eventually, when we can bump the version
+#endif
         buffer.writeInt(rec->fInfo.fPaintBits);
         buffer.writeInt(rec->fInfo.fColorMode);
         buffer.writePoint(rec->fInfo.fOffset);
@@ -227,7 +235,11 @@ SkFlattenable* SkLayerDrawLooper::CreateProc(SkReadBuffer& buffer) {
     Builder builder;
     for (int i = 0; i < count; i++) {
         LayerInfo info;
+#ifdef SK_SUPPORT_LEGACY_LAYERDRAWLOOPER_PAINTFLAGS
         info.fFlagsMask = buffer.readInt();
+#else
+        (void)buffer.readInt();
+#endif
         info.fPaintBits = buffer.readInt();
         info.fColorMode = (SkXfermode::Mode)buffer.readInt();
         buffer.readPoint(&info.fOffset);
@@ -260,6 +272,7 @@ void SkLayerDrawLooper::toString(SkString* str) const {
     for (int i = 0; i < fCount; i++) {
         str->appendf("%d: ", i);
 
+#ifdef SK_SUPPORT_LEGACY_LAYERDRAWLOOPER_PAINTFLAGS
         str->append("flagsMask: (");
         if (0 == rec->fInfo.fFlagsMask) {
             str->append("None");
@@ -293,6 +306,7 @@ void SkLayerDrawLooper::toString(SkString* str) const {
             SkAddFlagToString(str, SkToBool(SkPaint::kGenA8FromLCD_Flag & rec->fInfo.fFlagsMask),
                               "GenA8FromLCD", &needSeparator);
         }
+#endif
         str->append(") ");
 
         str->append("paintBits: (");