aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2016-10-03 15:44:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-03 20:02:20 +0000
commit70cdb396eb5ffbbed128b902532e9292b5ec0e9d (patch)
treed6a3bc707ac55d6823f7966adfacd88c6f23d903 /tests
parentafb48b62272e280d766f8e97c9cdd3417961a546 (diff)
Revert "Revert "replace SkXfermode obj with SkBlendMode enum in paints""
This reverts commit ce02e7175872abde3721df9e5d3ec0ab8384cd8e. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2878 Change-Id: I86875511a13497112827cbaed1dbd7639e9e3d10 Reviewed-on: https://skia-review.googlesource.com/2878 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ApplyGammaTest.cpp2
-rw-r--r--tests/ImageFilterTest.cpp10
-rw-r--r--tests/ImageTest.cpp2
-rw-r--r--tests/LayerDrawLooperTest.cpp18
-rw-r--r--tests/PDFOpaqueSrcModeToSrcOverTest.cpp12
-rw-r--r--tests/PaintTest.cpp15
-rw-r--r--tests/ReadPixelsTest.cpp2
-rw-r--r--tests/RecordDrawTest.cpp2
-rw-r--r--tests/RecordOptsTest.cpp8
-rw-r--r--tests/RecordingXfermodeTest.cpp20
-rw-r--r--tests/SerializationTest.cpp2
-rw-r--r--tests/WritePixelsTest.cpp2
12 files changed, 46 insertions, 49 deletions
diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp
index 6e6e23a9ae..ec790f5280 100644
--- a/tests/ApplyGammaTest.cpp
+++ b/tests/ApplyGammaTest.cpp
@@ -112,7 +112,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) {
dstCanvas->flush();
SkPaint gammaPaint;
- gammaPaint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ gammaPaint.setBlendMode(SkBlendMode::kSrc);
gammaPaint.setColorFilter(SkGammaColorFilter::Make(gamma));
dstCanvas->drawImage(src, 0, 0, &gammaPaint);
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index fd83a6ca3f..668ae5a99f 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -261,8 +261,8 @@ public:
std::move(paintFilter),
cropRect));
}
- this->addFilter("xfermode", SkXfermodeImageFilter::Make(
- SkXfermode::Make(SkXfermode::kSrc_Mode), input, input, cropRect));
+ this->addFilter("xfermode", SkXfermodeImageFilter::Make(SkBlendMode::kSrc, input, input,
+ cropRect));
}
int count() const { return fFilters.count(); }
SkImageFilter* getFilter(int index) const { return fFilters[index].fFilter.get(); }
@@ -938,14 +938,14 @@ DEF_TEST(ImageFilterUnionBounds, reporter) {
// Regardless of which order they appear in, the image filter bounds should
// be combined correctly.
{
- sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, offset));
+ sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(SkBlendMode::kSrcOver, offset));
SkRect bounds = SkRect::MakeWH(100, 100);
// Intentionally aliasing here, as that's what the real callers do.
bounds = composite->computeFastBounds(bounds);
REPORTER_ASSERT(reporter, bounds == SkRect::MakeWH(150, 100));
}
{
- sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(nullptr, nullptr,
+ sk_sp<SkImageFilter> composite(SkXfermodeImageFilter::Make(SkBlendMode::kSrcOver, nullptr,
offset, nullptr));
SkRect bounds = SkRect::MakeWH(100, 100);
// Intentionally aliasing here, as that's what the real callers do.
@@ -1432,7 +1432,7 @@ static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re
// Check that an xfermode image filter whose input has been cropped out still draws the other
// input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning.
- sk_sp<SkXfermode> mode(SkXfermode::Make(SkXfermode::kSrcOver_Mode));
+ SkBlendMode mode = SkBlendMode::kSrcOver;
sk_sp<SkImageFilter> xfermodeNoFg(SkXfermodeImageFilter::Make(mode, greenFilter,
croppedOut, nullptr));
sk_sp<SkImageFilter> xfermodeNoBg(SkXfermodeImageFilter::Make(mode, croppedOut,
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 993c3fa0f2..74dd532d23 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -351,7 +351,7 @@ DEF_TEST(Image_RetainSnapshot, reporter) {
}
SkPaint paint;
- paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ paint.setBlendMode(SkBlendMode::kSrc);
paint.setColor(SK_ColorRED);
surface->getCanvas()->drawRect(SkRect::MakeXYWH(1, 1, 1, 1), paint);
diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp
index 8ba290fbdf..4897fd2884 100644
--- a/tests/LayerDrawLooperTest.cpp
+++ b/tests/LayerDrawLooperTest.cpp
@@ -53,7 +53,7 @@ static void test_frontToBack(skiatest::Reporter* reporter) {
layerInfo.fOffset.set(10.0f, 20.0f);
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
SkPaint* layerPaint = looperBuilder.addLayer(layerInfo);
- layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
+ layerPaint->setBlendMode(SkBlendMode::kSrc);
FakeDevice device;
SkCanvas canvas(&device);
@@ -65,7 +65,7 @@ static void test_frontToBack(skiatest::Reporter* reporter) {
// The back layer should come first.
REPORTER_ASSERT(reporter, context->next(&canvas, &paint));
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrc_Mode));
+ REPORTER_ASSERT(reporter, paint.getBlendMode() == SkBlendMode::kSrc);
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
REPORTER_ASSERT(reporter, 10.0f == device.fLastMatrix.getTranslateX());
REPORTER_ASSERT(reporter, 20.0f == device.fLastMatrix.getTranslateY());
@@ -73,7 +73,7 @@ static void test_frontToBack(skiatest::Reporter* reporter) {
// Then the front layer.
REPORTER_ASSERT(reporter, context->next(&canvas, &paint));
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode));
+ REPORTER_ASSERT(reporter, paint.getBlendMode() == SkBlendMode::kSrcOver);
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateX());
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateY());
@@ -93,7 +93,7 @@ static void test_backToFront(skiatest::Reporter* reporter) {
layerInfo.fOffset.set(10.0f, 20.0f);
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
SkPaint* layerPaint = looperBuilder.addLayerOnTop(layerInfo);
- layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
+ layerPaint->setBlendMode(SkBlendMode::kSrc);
FakeDevice device;
SkCanvas canvas(&device);
@@ -105,7 +105,7 @@ static void test_backToFront(skiatest::Reporter* reporter) {
// The back layer should come first.
REPORTER_ASSERT(reporter, context->next(&canvas, &paint));
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode));
+ REPORTER_ASSERT(reporter, paint.getBlendMode() == SkBlendMode::kSrcOver);
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateX());
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateY());
@@ -113,7 +113,7 @@ static void test_backToFront(skiatest::Reporter* reporter) {
// Then the front layer.
REPORTER_ASSERT(reporter, context->next(&canvas, &paint));
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrc_Mode));
+ REPORTER_ASSERT(reporter, paint.getBlendMode() == SkBlendMode::kSrc);
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
REPORTER_ASSERT(reporter, 10.0f == device.fLastMatrix.getTranslateX());
REPORTER_ASSERT(reporter, 20.0f == device.fLastMatrix.getTranslateY());
@@ -133,7 +133,7 @@ static void test_mixed(skiatest::Reporter* reporter) {
layerInfo.fOffset.set(10.0f, 20.0f);
layerInfo.fPaintBits |= SkLayerDrawLooper::kXfermode_Bit;
SkPaint* layerPaint = looperBuilder.addLayerOnTop(layerInfo);
- layerPaint->setXfermodeMode(SkXfermode::kSrc_Mode);
+ layerPaint->setBlendMode(SkBlendMode::kSrc);
FakeDevice device;
SkCanvas canvas(&device);
@@ -145,7 +145,7 @@ static void test_mixed(skiatest::Reporter* reporter) {
// The back layer should come first.
REPORTER_ASSERT(reporter, context->next(&canvas, &paint));
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrcOver_Mode));
+ REPORTER_ASSERT(reporter, paint.getBlendMode() == SkBlendMode::kSrcOver);
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateX());
REPORTER_ASSERT(reporter, 0.0f == device.fLastMatrix.getTranslateY());
@@ -153,7 +153,7 @@ static void test_mixed(skiatest::Reporter* reporter) {
// Then the front layer.
REPORTER_ASSERT(reporter, context->next(&canvas, &paint));
- REPORTER_ASSERT(reporter, SkXfermode::IsMode(paint.getXfermode(), SkXfermode::kSrc_Mode));
+ REPORTER_ASSERT(reporter, paint.getBlendMode() == SkBlendMode::kSrc);
canvas.drawRect(SkRect::MakeWH(50.0f, 50.0f), paint);
REPORTER_ASSERT(reporter, 10.0f == device.fLastMatrix.getTranslateX());
REPORTER_ASSERT(reporter, 20.0f == device.fLastMatrix.getTranslateY());
diff --git a/tests/PDFOpaqueSrcModeToSrcOverTest.cpp b/tests/PDFOpaqueSrcModeToSrcOverTest.cpp
index 76796f5500..e15234d090 100644
--- a/tests/PDFOpaqueSrcModeToSrcOverTest.cpp
+++ b/tests/PDFOpaqueSrcModeToSrcOverTest.cpp
@@ -9,14 +9,14 @@
#include "SkStream.h"
#include "Test.h"
-static void run_test(SkWStream* out, SkXfermode::Mode mode, U8CPU alpha) {
+static void run_test(SkWStream* out, SkBlendMode mode, U8CPU alpha) {
sk_sp<SkDocument> pdfDoc(SkDocument::MakePDF(out));
SkCanvas* c = pdfDoc->beginPage(612.0f, 792.0f);
SkPaint black;
SkPaint background;
background.setColor(SK_ColorWHITE);
background.setAlpha(alpha);
- background.setXfermodeMode(mode);
+ background.setBlendMode(mode);
c->drawRect(SkRect::MakeWH(612.0f, 792.0f), background);
c->drawRect(SkRect::MakeXYWH(36.0f, 36.0f, 9.0f, 9.0f), black);
c->drawRect(SkRect::MakeXYWH(72.0f, 72.0f, 468.0f, 648.0f), background);
@@ -31,8 +31,8 @@ DEF_TEST(SkPDF_OpaqueSrcModeToSrcOver, r) {
SkDynamicMemoryWStream srcOverMode;
U8CPU alpha = SK_AlphaOPAQUE;
- run_test(&srcMode, SkXfermode::kSrc_Mode, alpha);
- run_test(&srcOverMode, SkXfermode::kSrcOver_Mode, alpha);
+ run_test(&srcMode, SkBlendMode::kSrc, alpha);
+ run_test(&srcOverMode, SkBlendMode::kSrcOver, alpha);
REPORTER_ASSERT(r, srcMode.getOffset() == srcOverMode.getOffset());
// The two PDFs should be equal because they have an opaque alpha.
@@ -40,8 +40,8 @@ DEF_TEST(SkPDF_OpaqueSrcModeToSrcOver, r) {
srcOverMode.reset();
alpha = 0x80;
- run_test(&srcMode, SkXfermode::kSrc_Mode, alpha);
- run_test(&srcOverMode, SkXfermode::kSrcOver_Mode, alpha);
+ run_test(&srcMode, SkBlendMode::kSrc, alpha);
+ run_test(&srcOverMode, SkBlendMode::kSrcOver, alpha);
REPORTER_ASSERT(r, srcMode.getOffset() > srcOverMode.getOffset());
// The two PDFs should not be equal because they have a non-opaque alpha.
}
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index f507467771..c4a4fb7721 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -292,7 +292,7 @@ DEF_TEST(Paint_MoreFlattening, r) {
paint.setColor(0x00AABBCC);
paint.setTextScaleX(1.0f); // Default value, ignored.
paint.setTextSize(19);
- paint.setXfermode(SkXfermode::Make(SkXfermode::kModulate_Mode));
+ paint.setBlendMode(SkBlendMode::kModulate);
paint.setLooper(nullptr); // Default value, ignored.
SkBinaryWriteBuffer writer;
@@ -311,12 +311,11 @@ DEF_TEST(Paint_MoreFlattening, r) {
ASSERT(other.getTextScaleX() == paint.getTextScaleX());
ASSERT(other.getTextSize() == paint.getTextSize());
ASSERT(other.getLooper() == paint.getLooper());
+ ASSERT(other.getBlendMode() == paint.getBlendMode());
- // We have to be a little looser and compare just the modes. Pointers might not be the same.
- SkXfermode::Mode otherMode, paintMode;
- ASSERT(other.getXfermode()->asMode(&otherMode));
- ASSERT(paint.getXfermode()->asMode(&paintMode));
- ASSERT(otherMode == paintMode);
+#ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
+ other.setXfermode(nullptr);
+#endif
}
DEF_TEST(Paint_getHash, r) {
@@ -355,11 +354,11 @@ DEF_TEST(Paint_nothingToDraw, r) {
REPORTER_ASSERT(r, paint.nothingToDraw());
paint.setAlpha(0xFF);
- paint.setXfermodeMode(SkXfermode::kDst_Mode);
+ paint.setBlendMode(SkBlendMode::kDst);
REPORTER_ASSERT(r, paint.nothingToDraw());
paint.setAlpha(0);
- paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
+ paint.setBlendMode(SkBlendMode::kSrcOver);
SkColorMatrix cm;
cm.setIdentity(); // does not change alpha
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 5fbaf9bf94..008781ca06 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -113,7 +113,7 @@ static void fill_src_canvas(SkCanvas* canvas) {
canvas->setMatrix(SkMatrix::I());
canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op);
SkPaint paint;
- paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ paint.setBlendMode(SkBlendMode::kSrc);
canvas->drawBitmap(make_src_bitmap(), 0, 0, &paint);
canvas->restore();
}
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index cf8141a789..1dbd945c0e 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -240,7 +240,7 @@ DEF_TEST(RecordDraw_SaveLayerBoundsAffectsClipBounds, r) {
SkRecorder recorder(&record, 50, 50);
SkPaint p;
- p.setXfermodeMode(SkXfermode::kSrc_Mode);
+ p.setBlendMode(SkBlendMode::kSrc);
SkRect layerBounds = SkRect::MakeLTRB(10, 10, 40, 40);
recorder.saveLayer(&layerBounds, &p);
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index 4567a01409..b7c9ae96c6 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -140,7 +140,7 @@ DEF_TEST(RecordOpts_NoopSaveLayerDrawRestore, r) {
SkPaint alphaOnlyLayerPaint, translucentLayerPaint, xfermodeLayerPaint;
alphaOnlyLayerPaint.setColor(0x03000000); // Only alpha.
translucentLayerPaint.setColor(0x03040506); // Not only alpha.
- xfermodeLayerPaint.setXfermodeMode(SkXfermode::kDstIn_Mode); // Any effect will do.
+ xfermodeLayerPaint.setBlendMode(SkBlendMode::kDstIn); // Any effect will do.
SkPaint opaqueDrawPaint, translucentDrawPaint;
opaqueDrawPaint.setColor(0xFF020202); // Opaque.
@@ -222,10 +222,10 @@ DEF_TEST(RecordOpts_MergeSvgOpacityAndFilterLayers, r) {
SkPaint translucentLayerPaint;
translucentLayerPaint.setColor(0x03040506); // Not only alpha.
SkPaint xfermodePaint;
- xfermodePaint.setXfermodeMode(SkXfermode::kDstIn_Mode);
+ xfermodePaint.setBlendMode(SkBlendMode::kDstIn);
SkPaint colorFilterPaint;
colorFilterPaint.setColorFilter(
- SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, SkXfermode::kSrcIn_Mode));
+ SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, SkBlendMode::kSrcIn));
SkPaint opaqueFilterLayerPaint;
opaqueFilterLayerPaint.setColor(0xFF020202); // Opaque.
@@ -353,7 +353,7 @@ static void do_draw(SkCanvas* canvas, SkColor color, bool doLayer) {
if (doLayer) {
canvas->saveLayer(nullptr, nullptr);
- p.setXfermodeMode(SkXfermode::kSrc_Mode);
+ p.setBlendMode(SkBlendMode::kSrc);
canvas->drawPaint(p);
canvas->restore();
} else {
diff --git a/tests/RecordingXfermodeTest.cpp b/tests/RecordingXfermodeTest.cpp
index 0f91aea964..32aec36f9f 100644
--- a/tests/RecordingXfermodeTest.cpp
+++ b/tests/RecordingXfermodeTest.cpp
@@ -34,7 +34,7 @@ class Drawer {
const SkImageInfo& imageInfo() const { return fImageInfo; }
- void draw(SkCanvas* canvas, const SkRect& clipRect, SkXfermode::Mode mode) const {
+ void draw(SkCanvas* canvas, const SkRect& clipRect, SkBlendMode mode) const {
SkPaint greenPaint;
greenPaint.setColor(0xff008000);
SkPaint blackPaint;
@@ -43,7 +43,7 @@ class Drawer {
whitePaint.setColor(0xffffffff);
SkPaint layerPaint;
layerPaint.setColor(0xff000000);
- layerPaint.setXfermodeMode(mode);
+ layerPaint.setBlendMode(mode);
SkRect canvasRect(SkRect::MakeWH(SkIntToScalar(fImageInfo.width()),
SkIntToScalar(fImageInfo.height())));
@@ -68,7 +68,7 @@ class RecordingStrategy {
virtual ~RecordingStrategy() {}
virtual const SkBitmap& recordAndReplay(const Drawer& drawer,
const SkRect& intoClip,
- SkXfermode::Mode) = 0;
+ SkBlendMode) = 0;
};
class BitmapBackedCanvasStrategy : public RecordingStrategy {
@@ -78,9 +78,8 @@ class BitmapBackedCanvasStrategy : public RecordingStrategy {
fBitmap.allocPixels(imageInfo);
}
- virtual const SkBitmap& recordAndReplay(const Drawer& drawer,
- const SkRect& intoClip,
- SkXfermode::Mode mode) {
+ const SkBitmap& recordAndReplay(const Drawer& drawer, const SkRect& intoClip,
+ SkBlendMode mode) override {
SkCanvas canvas(fBitmap);
canvas.clear(0xffffffff);
// Note that the scene is drawn just into the clipped region!
@@ -104,9 +103,8 @@ class PictureStrategy : public RecordingStrategy {
fHeight = imageInfo.height();
}
- virtual const SkBitmap& recordAndReplay(const Drawer& drawer,
- const SkRect& intoClip,
- SkXfermode::Mode mode) {
+ const SkBitmap& recordAndReplay(const Drawer& drawer, const SkRect& intoClip,
+ SkBlendMode mode) override {
SkRTreeFactory factory;
SkPictureRecorder recorder;
SkRect canvasRect(SkRect::MakeWH(SkIntToScalar(fWidth),SkIntToScalar(fHeight)));
@@ -144,9 +142,9 @@ DEF_TEST(SkRecordingAccuracyXfermode, reporter) {
SkString errors;
#endif
- for (int iMode = 0; iMode < int(SkXfermode::kLastMode); iMode++) {
+ for (int iMode = 0; iMode < int(SkBlendMode::kLastMode); iMode++) {
const SkRect& clip = SkRect::MakeXYWH(100, 0, 100, 100);
- SkXfermode::Mode mode = SkXfermode::Mode(iMode);
+ SkBlendMode mode = SkBlendMode(iMode);
const SkBitmap& goldenBM = golden.recordAndReplay(drawer, clip, mode);
const SkBitmap& pictureBM = picture.recordAndReplay(drawer, clip, mode);
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 9e407015b9..26a2da46d8 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -260,7 +260,7 @@ static void TestBitmapSerialization(const SkBitmap& validBitmap,
sk_sp<SkImage> invalidImage(SkImage::MakeFromBitmap(invalidBitmap));
sk_sp<SkImageFilter> invalidBitmapSource(SkImageSource::Make(std::move(invalidImage)));
sk_sp<SkImageFilter> xfermodeImageFilter(
- SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode),
+ SkXfermodeImageFilter::Make(SkBlendMode::kSrcOver,
std::move(invalidBitmapSource),
std::move(validBitmapSource), nullptr));
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index c59aa2d254..77038d4c8e 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -122,7 +122,7 @@ static void fill_canvas(SkCanvas* canvas) {
canvas->setMatrix(SkMatrix::I());
canvas->clipRect(DEV_RECT_S, SkCanvas::kReplace_Op);
SkPaint paint;
- paint.setXfermodeMode(SkXfermode::kSrc_Mode);
+ paint.setBlendMode(SkBlendMode::kSrc);
canvas->drawBitmap(bmp, 0, 0, &paint);
canvas->restore();
}