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
SkLayerDrawLooper* looper = new SkLayerDrawLooper;
{
SkLayerDrawLooper::LayerInfo info;
- info.fFlagsMask = 0;
info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
| SkLayerDrawLooper::kColorFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
//-----------------------------------------------
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;
SkLayerDrawLooper* looper = new SkLayerDrawLooper;
{
SkLayerDrawLooper::LayerInfo info;
- info.fFlagsMask = 0;
info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
| SkLayerDrawLooper::kColorFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
this->init();
SkPaint paint;
+ paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(72));
paint.setLooper(fLooper);
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);
SkLayerDrawLooper* looper = new SkLayerDrawLooper;
SkLayerDrawLooper::LayerInfo info;
- info.fFlagsMask = 0;
info.fPaintBits = SkLayerDrawLooper::kColorFilter_Bit |
SkLayerDrawLooper::kMaskFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
SkLayerDrawLooper* looper = new SkLayerDrawLooper;
SkLayerDrawLooper::LayerInfo info;
- info.fFlagsMask = 0;
info.fPaintBits = SkLayerDrawLooper::kColorFilter_Bit |
SkLayerDrawLooper::kMaskFilter_Bit;
info.fColorMode = SkXfermode::kSrc_Mode;
* 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;
#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);
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;
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);
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);
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");
SkAddFlagToString(str, SkToBool(SkPaint::kGenA8FromLCD_Flag & rec->fInfo.fFlagsMask),
"GenA8FromLCD", &needSeparator);
}
+#endif
str->append(") ");
str->append("paintBits: (");