aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-10-04 10:06:20 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-04 20:09:34 +0000
commit1834242ec6e3cd62669227d394bc79e1cd66dcfb (patch)
treec956e75f272619b5901ca0beab31dbf4a50d9974 /src/pdf
parent6942442ef7cc018ac136dd379ad6a30902a060e5 (diff)
Revert[4] "replace SkXfermode obj with SkBlendMode enum in paints"
This reverts commit 2cbcd12281ee807214df094964c584c78932e10b. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2924 Change-Id: I0fa5c58af428f3da8565465d1219a34ef8417d9a Reviewed-on: https://skia-review.googlesource.com/2924 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFDevice.cpp164
-rw-r--r--src/pdf/SkPDFDevice.h6
-rw-r--r--src/pdf/SkPDFGraphicState.cpp105
-rw-r--r--src/pdf/SkPDFGraphicState.h2
4 files changed, 132 insertions, 145 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index f13b4bc1f6..217dd3f2b6 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -47,12 +47,11 @@
// Utility functions
-// If the paint will definitely draw opaquely, replace kSrc_Mode with
-// kSrcOver_Mode. http://crbug.com/473572
+// If the paint will definitely draw opaquely, replace kSrc with
+// kSrcOver. http://crbug.com/473572
static void replace_srcmode_on_opaque_paint(SkPaint* paint) {
- if (kSrcOver_SkXfermodeInterpretation
- == SkInterpretXfermode(*paint, false)) {
- paint->setXfermode(nullptr);
+ if (kSrcOver_SkXfermodeInterpretation == SkInterpretXfermode(*paint, false)) {
+ paint->setBlendMode(SkBlendMode::kSrcOver);
}
}
@@ -392,7 +391,7 @@ public:
const SkPaint& paint, bool hasText = false)
: fDevice(device),
fContentEntry(nullptr),
- fXfermode(SkXfermode::kSrcOver_Mode),
+ fBlendMode(SkBlendMode::kSrcOver),
fDstFormXObject(nullptr) {
init(draw.fClipStack, draw.fRC->bwRgn(), *draw.fMatrix, paint, hasText);
}
@@ -401,7 +400,7 @@ public:
const SkPaint& paint, bool hasText = false)
: fDevice(device),
fContentEntry(nullptr),
- fXfermode(SkXfermode::kSrcOver_Mode),
+ fBlendMode(SkBlendMode::kSrcOver),
fDstFormXObject(nullptr) {
init(clipStack, clipRegion, matrix, paint, hasText);
}
@@ -412,7 +411,7 @@ public:
if (shape->isEmpty()) {
shape = nullptr;
}
- fDevice->finishContentEntry(fXfermode, std::move(fDstFormXObject), shape);
+ fDevice->finishContentEntry(fBlendMode, std::move(fDstFormXObject), shape);
}
}
@@ -420,16 +419,16 @@ public:
/* Returns true when we explicitly need the shape of the drawing. */
bool needShape() {
- switch (fXfermode) {
- case SkXfermode::kClear_Mode:
- case SkXfermode::kSrc_Mode:
- case SkXfermode::kSrcIn_Mode:
- case SkXfermode::kSrcOut_Mode:
- case SkXfermode::kDstIn_Mode:
- case SkXfermode::kDstOut_Mode:
- case SkXfermode::kSrcATop_Mode:
- case SkXfermode::kDstATop_Mode:
- case SkXfermode::kModulate_Mode:
+ switch (fBlendMode) {
+ case SkBlendMode::kClear:
+ case SkBlendMode::kSrc:
+ case SkBlendMode::kSrcIn:
+ case SkBlendMode::kSrcOut:
+ case SkBlendMode::kDstIn:
+ case SkBlendMode::kDstOut:
+ case SkBlendMode::kSrcATop:
+ case SkBlendMode::kDstATop:
+ case SkBlendMode::kModulate:
return true;
default:
return false;
@@ -438,7 +437,7 @@ public:
/* Returns true unless we only need the shape of the drawing. */
bool needSource() {
- if (fXfermode == SkXfermode::kClear_Mode) {
+ if (fBlendMode == SkBlendMode::kClear) {
return false;
}
return true;
@@ -455,7 +454,7 @@ public:
private:
SkPDFDevice* fDevice;
SkPDFDevice::ContentEntry* fContentEntry;
- SkXfermode::Mode fXfermode;
+ SkBlendMode fBlendMode;
sk_sp<SkPDFObject> fDstFormXObject;
SkPath fShape;
@@ -466,9 +465,7 @@ private:
NOT_IMPLEMENTED(!matrix.hasPerspective(), false);
return;
}
- if (paint.getXfermode()) {
- paint.getXfermode()->asMode(&fXfermode);
- }
+ fBlendMode = paint.getBlendMode();
fContentEntry = fDevice->setUpContentEntry(clipStack, clipRegion,
matrix, paint, hasText,
&fDstFormXObject);
@@ -1707,7 +1704,7 @@ void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex,
sk_sp<SkPDFObject> mask,
const SkClipStack* clipStack,
const SkRegion& clipRegion,
- SkXfermode::Mode mode,
+ SkBlendMode mode,
bool invertClip) {
if (clipRegion.isEmpty() && !invertClip) {
return;
@@ -1720,7 +1717,7 @@ void SkPDFDevice::drawFormXObjectWithMask(int xObjectIndex,
SkMatrix identity;
identity.reset();
SkPaint paint;
- paint.setXfermodeMode(mode);
+ paint.setBlendMode(mode);
ScopedContentEntry content(this, clipStack, clipRegion, identity, paint);
if (!content.entry()) {
return;
@@ -1765,27 +1762,24 @@ SkPDFDevice::ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* cli
}
}
- SkXfermode::Mode xfermode = SkXfermode::kSrcOver_Mode;
- if (paint.getXfermode()) {
- paint.getXfermode()->asMode(&xfermode);
- }
+ SkBlendMode blendMode = paint.getBlendMode();
// For the following modes, we want to handle source and destination
// separately, so make an object of what's already there.
- if (xfermode == SkXfermode::kClear_Mode ||
- xfermode == SkXfermode::kSrc_Mode ||
- xfermode == SkXfermode::kSrcIn_Mode ||
- xfermode == SkXfermode::kDstIn_Mode ||
- xfermode == SkXfermode::kSrcOut_Mode ||
- xfermode == SkXfermode::kDstOut_Mode ||
- xfermode == SkXfermode::kSrcATop_Mode ||
- xfermode == SkXfermode::kDstATop_Mode ||
- xfermode == SkXfermode::kModulate_Mode) {
+ if (blendMode == SkBlendMode::kClear ||
+ blendMode == SkBlendMode::kSrc ||
+ blendMode == SkBlendMode::kSrcIn ||
+ blendMode == SkBlendMode::kDstIn ||
+ blendMode == SkBlendMode::kSrcOut ||
+ blendMode == SkBlendMode::kDstOut ||
+ blendMode == SkBlendMode::kSrcATop ||
+ blendMode == SkBlendMode::kDstATop ||
+ blendMode == SkBlendMode::kModulate) {
if (!isContentEmpty()) {
*dst = this->makeFormXObjectFromDevice();
SkASSERT(isContentEmpty());
- } else if (xfermode != SkXfermode::kSrc_Mode &&
- xfermode != SkXfermode::kSrcOut_Mode) {
+ } else if (blendMode != SkBlendMode::kSrc &&
+ blendMode != SkBlendMode::kSrcOut) {
// Except for Src and SrcOut, if there isn't anything already there,
// then we're done.
return nullptr;
@@ -1795,14 +1789,14 @@ SkPDFDevice::ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* cli
// Xor, Plus.
// Dst xfer mode doesn't draw source at all.
- if (xfermode == SkXfermode::kDst_Mode) {
+ if (blendMode == SkBlendMode::kDst) {
return nullptr;
}
SkPDFDevice::ContentEntry* entry;
if (fContentEntries.back() && fContentEntries.back()->fContent.getOffset() == 0) {
entry = fContentEntries.back();
- } else if (xfermode != SkXfermode::kDstOver_Mode) {
+ } else if (blendMode != SkBlendMode::kDstOver) {
entry = fContentEntries.emplace_back();
} else {
entry = fContentEntries.emplace_front();
@@ -1812,23 +1806,23 @@ SkPDFDevice::ContentEntry* SkPDFDevice::setUpContentEntry(const SkClipStack* cli
return entry;
}
-void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
+void SkPDFDevice::finishContentEntry(SkBlendMode blendMode,
sk_sp<SkPDFObject> dst,
SkPath* shape) {
- if (xfermode != SkXfermode::kClear_Mode &&
- xfermode != SkXfermode::kSrc_Mode &&
- xfermode != SkXfermode::kDstOver_Mode &&
- xfermode != SkXfermode::kSrcIn_Mode &&
- xfermode != SkXfermode::kDstIn_Mode &&
- xfermode != SkXfermode::kSrcOut_Mode &&
- xfermode != SkXfermode::kDstOut_Mode &&
- xfermode != SkXfermode::kSrcATop_Mode &&
- xfermode != SkXfermode::kDstATop_Mode &&
- xfermode != SkXfermode::kModulate_Mode) {
+ if (blendMode != SkBlendMode::kClear &&
+ blendMode != SkBlendMode::kSrc &&
+ blendMode != SkBlendMode::kDstOver &&
+ blendMode != SkBlendMode::kSrcIn &&
+ blendMode != SkBlendMode::kDstIn &&
+ blendMode != SkBlendMode::kSrcOut &&
+ blendMode != SkBlendMode::kDstOut &&
+ blendMode != SkBlendMode::kSrcATop &&
+ blendMode != SkBlendMode::kDstATop &&
+ blendMode != SkBlendMode::kModulate) {
SkASSERT(!dst);
return;
}
- if (xfermode == SkXfermode::kDstOver_Mode) {
+ if (blendMode == SkBlendMode::kDstOver) {
SkASSERT(!dst);
if (fContentEntries.front()->fContent.getOffset() == 0) {
// For DstOver, an empty content entry was inserted before the rest
@@ -1839,8 +1833,8 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
return;
}
if (!dst) {
- SkASSERT(xfermode == SkXfermode::kSrc_Mode ||
- xfermode == SkXfermode::kSrcOut_Mode);
+ SkASSERT(blendMode == SkBlendMode::kSrc ||
+ blendMode == SkBlendMode::kSrcOut);
return;
}
@@ -1865,8 +1859,8 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
// If there is shape, then an empty source with Src, SrcIn, SrcOut,
// DstIn, DstAtop or Modulate reduces to Clear and DstOut or SrcAtop
// reduces to Dst.
- if (shape == nullptr || xfermode == SkXfermode::kDstOut_Mode ||
- xfermode == SkXfermode::kSrcATop_Mode) {
+ if (shape == nullptr || blendMode == SkBlendMode::kDstOut ||
+ blendMode == SkBlendMode::kSrcATop) {
ScopedContentEntry content(this, &fExistingClipStack,
fExistingClipRegion, identity,
stockPaint);
@@ -1875,7 +1869,7 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
&content.entry()->fContent);
return;
} else {
- xfermode = SkXfermode::kClear_Mode;
+ blendMode = SkBlendMode::kClear;
}
} else {
SkASSERT(fContentEntries.count() == 1);
@@ -1884,14 +1878,14 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
// TODO(vandebo) srcFormXObject may contain alpha, but here we want it
// without alpha.
- if (xfermode == SkXfermode::kSrcATop_Mode) {
+ if (blendMode == SkBlendMode::kSrcATop) {
// TODO(vandebo): In order to properly support SrcATop we have to track
// the shape of what's been drawn at all times. It's the intersection of
// the non-transparent parts of the device and the outlines (shape) of
// all images and devices drawn.
drawFormXObjectWithMask(addXObjectResource(srcFormXObject.get()), dst,
&fExistingClipStack, fExistingClipRegion,
- SkXfermode::kSrcOver_Mode, true);
+ SkBlendMode::kSrcOver, true);
} else {
if (shape != nullptr) {
// Draw shape into a form-xobject.
@@ -1907,19 +1901,19 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
drawFormXObjectWithMask(addXObjectResource(dst.get()),
this->makeFormXObjectFromDevice(),
&fExistingClipStack, fExistingClipRegion,
- SkXfermode::kSrcOver_Mode, true);
+ SkBlendMode::kSrcOver, true);
} else {
drawFormXObjectWithMask(addXObjectResource(dst.get()), srcFormXObject,
&fExistingClipStack, fExistingClipRegion,
- SkXfermode::kSrcOver_Mode, true);
+ SkBlendMode::kSrcOver, true);
}
}
- if (xfermode == SkXfermode::kClear_Mode) {
+ if (blendMode == SkBlendMode::kClear) {
return;
- } else if (xfermode == SkXfermode::kSrc_Mode ||
- xfermode == SkXfermode::kDstATop_Mode) {
+ } else if (blendMode == SkBlendMode::kSrc ||
+ blendMode == SkBlendMode::kDstATop) {
ScopedContentEntry content(this, &fExistingClipStack,
fExistingClipRegion, identity, stockPaint);
if (content.entry()) {
@@ -1927,10 +1921,10 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
this->addXObjectResource(srcFormXObject.get()),
&content.entry()->fContent);
}
- if (xfermode == SkXfermode::kSrc_Mode) {
+ if (blendMode == SkBlendMode::kSrc) {
return;
}
- } else if (xfermode == SkXfermode::kSrcATop_Mode) {
+ } else if (blendMode == SkBlendMode::kSrcATop) {
ScopedContentEntry content(this, &fExistingClipStack,
fExistingClipRegion, identity, stockPaint);
if (content.entry()) {
@@ -1939,36 +1933,36 @@ void SkPDFDevice::finishContentEntry(SkXfermode::Mode xfermode,
}
}
- SkASSERT(xfermode == SkXfermode::kSrcIn_Mode ||
- xfermode == SkXfermode::kDstIn_Mode ||
- xfermode == SkXfermode::kSrcOut_Mode ||
- xfermode == SkXfermode::kDstOut_Mode ||
- xfermode == SkXfermode::kSrcATop_Mode ||
- xfermode == SkXfermode::kDstATop_Mode ||
- xfermode == SkXfermode::kModulate_Mode);
+ SkASSERT(blendMode == SkBlendMode::kSrcIn ||
+ blendMode == SkBlendMode::kDstIn ||
+ blendMode == SkBlendMode::kSrcOut ||
+ blendMode == SkBlendMode::kDstOut ||
+ blendMode == SkBlendMode::kSrcATop ||
+ blendMode == SkBlendMode::kDstATop ||
+ blendMode == SkBlendMode::kModulate);
- if (xfermode == SkXfermode::kSrcIn_Mode ||
- xfermode == SkXfermode::kSrcOut_Mode ||
- xfermode == SkXfermode::kSrcATop_Mode) {
+ if (blendMode == SkBlendMode::kSrcIn ||
+ blendMode == SkBlendMode::kSrcOut ||
+ blendMode == SkBlendMode::kSrcATop) {
drawFormXObjectWithMask(addXObjectResource(srcFormXObject.get()),
std::move(dst),
&fExistingClipStack, fExistingClipRegion,
- SkXfermode::kSrcOver_Mode,
- xfermode == SkXfermode::kSrcOut_Mode);
+ SkBlendMode::kSrcOver,
+ blendMode == SkBlendMode::kSrcOut);
return;
} else {
- SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode;
+ SkBlendMode mode = SkBlendMode::kSrcOver;
int resourceID = addXObjectResource(dst.get());
- if (xfermode == SkXfermode::kModulate_Mode) {
+ if (blendMode == SkBlendMode::kModulate) {
drawFormXObjectWithMask(addXObjectResource(srcFormXObject.get()),
std::move(dst), &fExistingClipStack,
fExistingClipRegion,
- SkXfermode::kSrcOver_Mode, false);
- mode = SkXfermode::kMultiply_Mode;
+ SkBlendMode::kSrcOver, false);
+ mode = SkBlendMode::kMultiply;
}
drawFormXObjectWithMask(resourceID, std::move(srcFormXObject),
&fExistingClipStack, fExistingClipRegion, mode,
- xfermode == SkXfermode::kDstOut_Mode);
+ blendMode == SkBlendMode::kDstOut);
return;
}
}
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index be0a277ff5..7d207e7cf9 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -246,7 +246,7 @@ private:
sk_sp<SkPDFObject> mask,
const SkClipStack* clipStack,
const SkRegion& clipRegion,
- SkXfermode::Mode mode,
+ SkBlendMode,
bool invertClip);
// If the paint or clip is such that we shouldn't draw anything, this
@@ -259,9 +259,7 @@ private:
const SkPaint& paint,
bool hasText,
sk_sp<SkPDFObject>* dst);
- void finishContentEntry(SkXfermode::Mode xfermode,
- sk_sp<SkPDFObject> dst,
- SkPath* shape);
+ void finishContentEntry(SkBlendMode, sk_sp<SkPDFObject> dst, SkPath* shape);
bool isContentEmpty();
void populateGraphicStateEntryFromPaint(const SkMatrix& matrix,
diff --git a/src/pdf/SkPDFGraphicState.cpp b/src/pdf/SkPDFGraphicState.cpp
index a78c4c51b5..d60526c11a 100644
--- a/src/pdf/SkPDFGraphicState.cpp
+++ b/src/pdf/SkPDFGraphicState.cpp
@@ -12,58 +12,58 @@
#include "SkPDFGraphicState.h"
#include "SkPDFUtils.h"
-static const char* as_blend_mode(SkXfermode::Mode mode) {
+static const char* as_blend_mode(SkBlendMode mode) {
switch (mode) {
- case SkXfermode::kSrcOver_Mode:
+ case SkBlendMode::kSrcOver:
return "Normal";
- case SkXfermode::kMultiply_Mode:
+ case SkBlendMode::kMultiply:
return "Multiply";
- case SkXfermode::kScreen_Mode:
+ case SkBlendMode::kScreen:
return "Screen";
- case SkXfermode::kOverlay_Mode:
+ case SkBlendMode::kOverlay:
return "Overlay";
- case SkXfermode::kDarken_Mode:
+ case SkBlendMode::kDarken:
return "Darken";
- case SkXfermode::kLighten_Mode:
+ case SkBlendMode::kLighten:
return "Lighten";
- case SkXfermode::kColorDodge_Mode:
+ case SkBlendMode::kColorDodge:
return "ColorDodge";
- case SkXfermode::kColorBurn_Mode:
+ case SkBlendMode::kColorBurn:
return "ColorBurn";
- case SkXfermode::kHardLight_Mode:
+ case SkBlendMode::kHardLight:
return "HardLight";
- case SkXfermode::kSoftLight_Mode:
+ case SkBlendMode::kSoftLight:
return "SoftLight";
- case SkXfermode::kDifference_Mode:
+ case SkBlendMode::kDifference:
return "Difference";
- case SkXfermode::kExclusion_Mode:
+ case SkBlendMode::kExclusion:
return "Exclusion";
- case SkXfermode::kHue_Mode:
+ case SkBlendMode::kHue:
return "Hue";
- case SkXfermode::kSaturation_Mode:
+ case SkBlendMode::kSaturation:
return "Saturation";
- case SkXfermode::kColor_Mode:
+ case SkBlendMode::kColor:
return "Color";
- case SkXfermode::kLuminosity_Mode:
+ case SkBlendMode::kLuminosity:
return "Luminosity";
// These are handled in SkPDFDevice::setUpContentEntry.
- case SkXfermode::kClear_Mode:
- case SkXfermode::kSrc_Mode:
- case SkXfermode::kDst_Mode:
- case SkXfermode::kDstOver_Mode:
- case SkXfermode::kSrcIn_Mode:
- case SkXfermode::kDstIn_Mode:
- case SkXfermode::kSrcOut_Mode:
- case SkXfermode::kDstOut_Mode:
- case SkXfermode::kSrcATop_Mode:
- case SkXfermode::kDstATop_Mode:
- case SkXfermode::kModulate_Mode:
+ case SkBlendMode::kClear:
+ case SkBlendMode::kSrc:
+ case SkBlendMode::kDst:
+ case SkBlendMode::kDstOver:
+ case SkBlendMode::kSrcIn:
+ case SkBlendMode::kDstIn:
+ case SkBlendMode::kSrcOut:
+ case SkBlendMode::kDstOut:
+ case SkBlendMode::kSrcATop:
+ case SkBlendMode::kDstATop:
+ case SkBlendMode::kModulate:
return "Normal";
// TODO(vandebo): Figure out if we can support more of these modes.
- case SkXfermode::kXor_Mode:
- case SkXfermode::kPlus_Mode:
+ case SkBlendMode::kXor:
+ case SkBlendMode::kPlus:
return nullptr;
}
return nullptr;
@@ -71,32 +71,28 @@ static const char* as_blend_mode(SkXfermode::Mode mode) {
// If a SkXfermode is unsupported in PDF, this function returns
// SrcOver, otherwise, it returns that Xfermode as a Mode.
-static SkXfermode::Mode mode_for_pdf(const SkXfermode* xfermode) {
- SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode;
- if (xfermode) {
- xfermode->asMode(&mode);
- }
+static SkBlendMode mode_for_pdf(SkBlendMode mode) {
switch (mode) {
- case SkXfermode::kSrcOver_Mode:
- case SkXfermode::kMultiply_Mode:
- case SkXfermode::kScreen_Mode:
- case SkXfermode::kOverlay_Mode:
- case SkXfermode::kDarken_Mode:
- case SkXfermode::kLighten_Mode:
- case SkXfermode::kColorDodge_Mode:
- case SkXfermode::kColorBurn_Mode:
- case SkXfermode::kHardLight_Mode:
- case SkXfermode::kSoftLight_Mode:
- case SkXfermode::kDifference_Mode:
- case SkXfermode::kExclusion_Mode:
- case SkXfermode::kHue_Mode:
- case SkXfermode::kSaturation_Mode:
- case SkXfermode::kColor_Mode:
- case SkXfermode::kLuminosity_Mode:
+ case SkBlendMode::kSrcOver:
+ case SkBlendMode::kMultiply:
+ case SkBlendMode::kScreen:
+ case SkBlendMode::kOverlay:
+ case SkBlendMode::kDarken:
+ case SkBlendMode::kLighten:
+ case SkBlendMode::kColorDodge:
+ case SkBlendMode::kColorBurn:
+ case SkBlendMode::kHardLight:
+ case SkBlendMode::kSoftLight:
+ case SkBlendMode::kDifference:
+ case SkBlendMode::kExclusion:
+ case SkBlendMode::kHue:
+ case SkBlendMode::kSaturation:
+ case SkBlendMode::kColor:
+ case SkBlendMode::kLuminosity:
// Mode is suppported and handled by pdf graphics state.
return mode;
default:
- return SkXfermode::kSrcOver_Mode; // Default mode.
+ return SkBlendMode::kSrcOver; // Default mode.
}
}
@@ -106,7 +102,7 @@ SkPDFGraphicState::SkPDFGraphicState(const SkPaint& p)
, fAlpha(p.getAlpha())
, fStrokeCap(SkToU8(p.getStrokeCap()))
, fStrokeJoin(SkToU8(p.getStrokeJoin()))
- , fMode(SkToU8(mode_for_pdf(p.getXfermode()))) {}
+ , fMode(SkToU8((unsigned)mode_for_pdf(p.getBlendMode()))) {}
// static
SkPDFGraphicState* SkPDFGraphicState::GetGraphicStateForPaint(
@@ -186,7 +182,6 @@ void SkPDFGraphicState::emitObject(
SkPaint::Cap strokeCap = (SkPaint::Cap)fStrokeCap;
SkPaint::Join strokeJoin = (SkPaint::Join)fStrokeJoin;
- SkXfermode::Mode xferMode = (SkXfermode::Mode)fMode;
static_assert(SkPaint::kButt_Cap == 0, "paint_cap_mismatch");
static_assert(SkPaint::kRound_Cap == 1, "paint_cap_mismatch");
@@ -205,6 +200,6 @@ void SkPDFGraphicState::emitObject(
dict->insertScalar("LW", fStrokeWidth);
dict->insertScalar("ML", fStrokeMiter);
dict->insertBool("SA", true); // SA = Auto stroke adjustment.
- dict->insertName("BM", as_blend_mode(xferMode));
+ dict->insertName("BM", as_blend_mode((SkBlendMode)fMode));
dict->emitObject(stream, objNumMap);
}
diff --git a/src/pdf/SkPDFGraphicState.h b/src/pdf/SkPDFGraphicState.h
index 0c2e4a0f49..8ee6728f56 100644
--- a/src/pdf/SkPDFGraphicState.h
+++ b/src/pdf/SkPDFGraphicState.h
@@ -70,7 +70,7 @@ private:
const uint8_t fAlpha;
const uint8_t fStrokeCap; // SkPaint::Cap
const uint8_t fStrokeJoin; // SkPaint::Join
- const uint8_t fMode; // SkXfermode::Mode
+ const uint8_t fMode; // SkBlendMode
SkPDFGraphicState(const SkPaint&);