Index: src/effects/SkLayerDrawLooper.cpp |
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp |
index 49263fbbb5d746c7ccca6b204998c3643e4d4b18..cb60ff1e974a641dfc59d1a0c67d99c5cf0161a7 100644 |
--- a/src/effects/SkLayerDrawLooper.cpp |
+++ b/src/effects/SkLayerDrawLooper.cpp |
@@ -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: ("); |