aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pipe/SkPipeCanvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipe/SkPipeCanvas.cpp')
-rw-r--r--src/pipe/SkPipeCanvas.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pipe/SkPipeCanvas.cpp b/src/pipe/SkPipeCanvas.cpp
index 3b636a23c0..a01237fbbb 100644
--- a/src/pipe/SkPipeCanvas.cpp
+++ b/src/pipe/SkPipeCanvas.cpp
@@ -81,6 +81,7 @@ static uint16_t compute_nondef(const SkPaint& paint, PaintUsage usage) {
bits |= (paint.getMaskFilter() ? kMaskFilter_NonDef : 0);
}
+ bits |= (paint.getXfermode() ? kXfermode_NonDef : 0);
bits |= (paint.getColorFilter() ? kColorFilter_NonDef : 0);
bits |= (paint.getImageFilter() ? kImageFilter_NonDef : 0);
bits |= (paint.getDrawLooper() ? kDrawLooper_NonDef : 0);
@@ -149,8 +150,15 @@ static void write_paint(SkWriteBuffer& writer, const SkPaint& paint, unsigned us
writer.write32(packedFlags);
unsigned nondef = compute_nondef(paint, (PaintUsage)usage);
+ SkXfermode::Mode mode;
+ if (SkXfermode::AsMode(paint.getXfermode(), &mode)) {
+ nondef &= ~kXfermode_NonDef; // don't need to store a pointer since we have an enum
+ } else {
+ SkASSERT(nondef & kXfermode_NonDef);
+ mode = (SkXfermode::Mode)0;
+ }
const uint8_t pad = 0;
- writer.write32((nondef << 16) | ((unsigned)paint.getBlendMode() << 8) | pad);
+ writer.write32((nondef << 16) | ((unsigned)mode << 8) | pad);
CHECK_WRITE_SCALAR(writer, nondef, paint, TextSize);
CHECK_WRITE_SCALAR(writer, nondef, paint, TextScaleX);
@@ -171,6 +179,7 @@ static void write_paint(SkWriteBuffer& writer, const SkPaint& paint, unsigned us
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, PathEffect);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, Shader);
+ CHECK_WRITE_FLATTENABLE(writer, nondef, paint, Xfermode);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, MaskFilter);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, ColorFilter);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, Rasterizer);