diff options
Diffstat (limited to 'src/pipe')
-rw-r--r-- | src/pipe/SkPipeCanvas.cpp | 11 | ||||
-rw-r--r-- | src/pipe/SkPipeFormat.h | 11 | ||||
-rw-r--r-- | src/pipe/SkPipeReader.cpp | 13 |
3 files changed, 10 insertions, 25 deletions
diff --git a/src/pipe/SkPipeCanvas.cpp b/src/pipe/SkPipeCanvas.cpp index a01237fbbb..3b636a23c0 100644 --- a/src/pipe/SkPipeCanvas.cpp +++ b/src/pipe/SkPipeCanvas.cpp @@ -81,7 +81,6 @@ 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); @@ -150,15 +149,8 @@ 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)mode << 8) | pad); + writer.write32((nondef << 16) | ((unsigned)paint.getBlendMode() << 8) | pad); CHECK_WRITE_SCALAR(writer, nondef, paint, TextSize); CHECK_WRITE_SCALAR(writer, nondef, paint, TextScaleX); @@ -179,7 +171,6 @@ 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); diff --git a/src/pipe/SkPipeFormat.h b/src/pipe/SkPipeFormat.h index 8f5c8282e4..9a1d30c7be 100644 --- a/src/pipe/SkPipeFormat.h +++ b/src/pipe/SkPipeFormat.h @@ -94,12 +94,11 @@ enum { kTypeface_NonDef = 1 << 6, kPathEffect_NonDef = 1 << 7, kShader_NonDef = 1 << 8, - kXfermode_NonDef = 1 << 9, - kMaskFilter_NonDef = 1 << 10, - kColorFilter_NonDef = 1 << 11, - kRasterizer_NonDef = 1 << 12, - kImageFilter_NonDef = 1 << 13, - kDrawLooper_NonDef = 1 << 14, + kMaskFilter_NonDef = 1 << 9, + kColorFilter_NonDef = 1 << 10, + kRasterizer_NonDef = 1 << 11, + kImageFilter_NonDef = 1 << 12, + kDrawLooper_NonDef = 1 << 13, }; enum { diff --git a/src/pipe/SkPipeReader.cpp b/src/pipe/SkPipeReader.cpp index 8840da1c83..47d4072d06 100644 --- a/src/pipe/SkPipeReader.cpp +++ b/src/pipe/SkPipeReader.cpp @@ -149,13 +149,13 @@ static SkMatrix read_sparse_matrix(SkReadBuffer& reader, SkMatrix::TypeMask tm) * pad zeros : 8 */ static SkPaint read_paint(SkReadBuffer& reader) { + SkPaint paint; + uint32_t packedFlags = reader.read32(); uint32_t extra = reader.read32(); unsigned nondef = extra >> 16; - SkXfermode::Mode mode = (SkXfermode::Mode)((extra >> 8) & 0xFF); - SkASSERT((extra & 0xFF) == 0); - - SkPaint paint; + paint.setBlendMode(SkBlendMode((extra >> 8) & 0xFF)); + SkASSERT((extra & 0xFF) == 0); // zero pad byte packedFlags >>= 2; // currently unused paint.setTextEncoding((SkPaint::TextEncoding)(packedFlags & 3)); packedFlags >>= 2; @@ -180,17 +180,12 @@ static SkPaint read_paint(SkReadBuffer& reader) { CHECK_SET_FLATTENABLE(Typeface); CHECK_SET_FLATTENABLE(PathEffect); CHECK_SET_FLATTENABLE(Shader); - CHECK_SET_FLATTENABLE(Xfermode); CHECK_SET_FLATTENABLE(MaskFilter); CHECK_SET_FLATTENABLE(ColorFilter); CHECK_SET_FLATTENABLE(Rasterizer); CHECK_SET_FLATTENABLE(ImageFilter); CHECK_SET_FLATTENABLE(DrawLooper); - if (!(nondef & kXfermode_NonDef)) { - paint.setXfermodeMode(mode); - } - return paint; } |