blob: cc5fb0065341a151f570cf7a803ed46c84cfb56c [file] [log] [blame]
robertphillips@google.com58b20212012-06-27 20:44:52 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrSWMaskHelper.h"
krajcevski5c2fca02014-06-10 17:25:28 -07009
egdaniel8dd688b2015-01-22 10:16:09 -080010#include "GrPipelineBuilder.h"
bsalomoneb1cb5c2015-05-22 08:01:09 -070011#include "GrCaps.h"
robertphillips@google.com58b20212012-06-27 20:44:52 +000012#include "GrGpu.h"
13
krajcevski5c2fca02014-06-10 17:25:28 -070014#include "SkData.h"
jvanverthfa38a302014-10-06 05:59:05 -070015#include "SkDistanceFieldGen.h"
sugoi@google.com5f74cf82012-12-17 21:16:45 +000016#include "SkStrokeRec.h"
sugoi@google.com12b4e272012-12-06 20:13:11 +000017
robertphillips@google.com58b20212012-06-27 20:44:52 +000018// TODO: try to remove this #include
19#include "GrContext.h"
20
21namespace {
krajcevski5c2fca02014-06-10 17:25:28 -070022
robertphillips@google.com58b20212012-06-27 20:44:52 +000023/*
24 * Convert a boolean operation into a transfer mode code
25 */
26SkXfermode::Mode op_to_mode(SkRegion::Op op) {
27
28 static const SkXfermode::Mode modeMap[] = {
29 SkXfermode::kDstOut_Mode, // kDifference_Op
reed@google.com8d3cd7a2013-01-30 21:36:11 +000030 SkXfermode::kModulate_Mode, // kIntersect_Op
robertphillips@google.com58b20212012-06-27 20:44:52 +000031 SkXfermode::kSrcOver_Mode, // kUnion_Op
32 SkXfermode::kXor_Mode, // kXOR_Op
33 SkXfermode::kClear_Mode, // kReverseDifference_Op
34 SkXfermode::kSrc_Mode, // kReplace_Op
35 };
36
37 return modeMap[op];
38}
39
krajcevski25a67bc2014-07-29 11:44:26 -070040static inline GrPixelConfig fmt_to_config(SkTextureCompressor::Format fmt) {
krajcevski25a67bc2014-07-29 11:44:26 -070041
krajcevski95b1b3d2014-08-07 12:58:38 -070042 GrPixelConfig config;
43 switch (fmt) {
44 case SkTextureCompressor::kLATC_Format:
45 config = kLATC_GrPixelConfig;
46 break;
47
48 case SkTextureCompressor::kR11_EAC_Format:
49 config = kR11_EAC_GrPixelConfig;
50 break;
51
52 case SkTextureCompressor::kASTC_12x12_Format:
53 config = kASTC_12x12_GrPixelConfig;
54 break;
55
56 case SkTextureCompressor::kETC1_Format:
57 config = kETC1_GrPixelConfig;
58 break;
59
60 default:
61 SkDEBUGFAIL("No GrPixelConfig for compression format!");
62 // Best guess
63 config = kAlpha_8_GrPixelConfig;
64 break;
65 }
66
67 return config;
krajcevski25a67bc2014-07-29 11:44:26 -070068}
69
bsalomon4b91f762015-05-19 09:29:46 -070070static bool choose_compressed_fmt(const GrCaps* caps,
krajcevskib3abe902014-07-30 13:08:11 -070071 SkTextureCompressor::Format *fmt) {
72 if (NULL == fmt) {
73 return false;
74 }
75
76 // We can't use scratch textures without the ability to update
77 // compressed textures...
78 if (!(caps->compressedTexSubImageSupport())) {
79 return false;
80 }
81
82 // Figure out what our preferred texture type is. If ASTC is available, that always
83 // gives the biggest win. Otherwise, in terms of compression speed and accuracy,
84 // LATC has a slight edge over R11 EAC.
85 if (caps->isConfigTexturable(kASTC_12x12_GrPixelConfig)) {
86 *fmt = SkTextureCompressor::kASTC_12x12_Format;
87 return true;
88 } else if (caps->isConfigTexturable(kLATC_GrPixelConfig)) {
89 *fmt = SkTextureCompressor::kLATC_Format;
90 return true;
91 } else if (caps->isConfigTexturable(kR11_EAC_GrPixelConfig)) {
92 *fmt = SkTextureCompressor::kR11_EAC_Format;
93 return true;
94 }
95
96 return false;
97}
krajcevskib3abe902014-07-30 13:08:11 -070098
robertphillips@google.com58b20212012-06-27 20:44:52 +000099}
100
101/**
102 * Draw a single rect element of the clip stack into the accumulation bitmap
103 */
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +0000104void GrSWMaskHelper::draw(const SkRect& rect, SkRegion::Op op,
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000105 bool antiAlias, uint8_t alpha) {
robertphillips@google.com58b20212012-06-27 20:44:52 +0000106 SkPaint paint;
107
108 SkXfermode* mode = SkXfermode::Create(op_to_mode(op));
109
krajcevski71614ac2014-08-13 10:36:18 -0700110 SkASSERT(kNone_CompressionMode == fCompressionMode);
111
robertphillips@google.com58b20212012-06-27 20:44:52 +0000112 paint.setXfermode(mode);
113 paint.setAntiAlias(antiAlias);
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000114 paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha));
robertphillips@google.com58b20212012-06-27 20:44:52 +0000115
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000116 fDraw.drawRect(rect, paint);
robertphillips@google.com58b20212012-06-27 20:44:52 +0000117
118 SkSafeUnref(mode);
119}
120
121/**
122 * Draw a single path element of the clip stack into the accumulation bitmap
123 */
sugoi@google.com5f74cf82012-12-17 21:16:45 +0000124void GrSWMaskHelper::draw(const SkPath& path, const SkStrokeRec& stroke, SkRegion::Op op,
sugoi@google.com12b4e272012-12-06 20:13:11 +0000125 bool antiAlias, uint8_t alpha) {
robertphillips@google.com58b20212012-06-27 20:44:52 +0000126
127 SkPaint paint;
sugoi@google.com5f74cf82012-12-17 21:16:45 +0000128 if (stroke.isHairlineStyle()) {
robertphillips@google.com58b20212012-06-27 20:44:52 +0000129 paint.setStyle(SkPaint::kStroke_Style);
130 paint.setStrokeWidth(SK_Scalar1);
131 } else {
sugoi@google.com5f74cf82012-12-17 21:16:45 +0000132 if (stroke.isFillStyle()) {
sugoi@google.com12b4e272012-12-06 20:13:11 +0000133 paint.setStyle(SkPaint::kFill_Style);
134 } else {
135 paint.setStyle(SkPaint::kStroke_Style);
136 paint.setStrokeJoin(stroke.getJoin());
137 paint.setStrokeCap(stroke.getCap());
sugoi@google.com5f74cf82012-12-17 21:16:45 +0000138 paint.setStrokeWidth(stroke.getWidth());
robertphillips@google.com58b20212012-06-27 20:44:52 +0000139 }
140 }
reed@google.com84e922b2013-11-04 20:57:36 +0000141 paint.setAntiAlias(antiAlias);
reed@google.com84e922b2013-11-04 20:57:36 +0000142
krajcevskib8ccc2f2014-08-07 08:15:14 -0700143 SkTBlitterAllocator allocator;
144 SkBlitter* blitter = NULL;
145 if (kBlitter_CompressionMode == fCompressionMode) {
bsalomon49f085d2014-09-05 13:34:00 -0700146 SkASSERT(fCompressedBuffer.get());
krajcevskib8ccc2f2014-08-07 08:15:14 -0700147 blitter = SkTextureCompressor::CreateBlitterForFormat(
148 fBM.width(), fBM.height(), fCompressedBuffer.get(), &allocator, fCompressedFormat);
149 }
150
reed@google.com126f7f52013-11-07 16:06:53 +0000151 if (SkRegion::kReplace_Op == op && 0xFF == alpha) {
152 SkASSERT(0xFF == paint.getAlpha());
krajcevskib8ccc2f2014-08-07 08:15:14 -0700153 fDraw.drawPathCoverage(path, paint, blitter);
reed@google.com126f7f52013-11-07 16:06:53 +0000154 } else {
155 paint.setXfermodeMode(op_to_mode(op));
156 paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha));
krajcevskib8ccc2f2014-08-07 08:15:14 -0700157 fDraw.drawPath(path, paint, blitter);
reed@google.com126f7f52013-11-07 16:06:53 +0000158 }
robertphillips@google.com58b20212012-06-27 20:44:52 +0000159}
160
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +0000161bool GrSWMaskHelper::init(const SkIRect& resultBounds,
krajcevski71614ac2014-08-13 10:36:18 -0700162 const SkMatrix* matrix,
163 bool allowCompression) {
bsalomon49f085d2014-09-05 13:34:00 -0700164 if (matrix) {
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000165 fMatrix = *matrix;
robertphillips@google.com58b20212012-06-27 20:44:52 +0000166 } else {
167 fMatrix.setIdentity();
168 }
169
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000170 // Now translate so the bound's UL corner is at the origin
171 fMatrix.postTranslate(-resultBounds.fLeft * SK_Scalar1,
172 -resultBounds.fTop * SK_Scalar1);
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +0000173 SkIRect bounds = SkIRect::MakeWH(resultBounds.width(),
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000174 resultBounds.height());
krajcevski25a67bc2014-07-29 11:44:26 -0700175
krajcevski71614ac2014-08-13 10:36:18 -0700176 if (allowCompression &&
bsalomon76228632015-05-29 08:02:10 -0700177 fContext->caps()->drawPathMasksToCompressedTexturesSupport() &&
178 choose_compressed_fmt(fContext->caps(), &fCompressedFormat)) {
krajcevskib8ccc2f2014-08-07 08:15:14 -0700179 fCompressionMode = kCompress_CompressionMode;
180 }
krajcevski25a67bc2014-07-29 11:44:26 -0700181
krajcevskib8ccc2f2014-08-07 08:15:14 -0700182 // Make sure that the width is a multiple of the desired block dimensions
183 // to allow for specialized SIMD instructions that compress multiple blocks at a time.
184 int cmpWidth = bounds.fRight;
185 int cmpHeight = bounds.fBottom;
186 if (kCompress_CompressionMode == fCompressionMode) {
krajcevskib3abe902014-07-30 13:08:11 -0700187 int dimX, dimY;
188 SkTextureCompressor::GetBlockDimensions(fCompressedFormat, &dimX, &dimY);
krajcevskib8ccc2f2014-08-07 08:15:14 -0700189 cmpWidth = dimX * ((cmpWidth + (dimX - 1)) / dimX);
190 cmpHeight = dimY * ((cmpHeight + (dimY - 1)) / dimY);
191
192 // Can we create a blitter?
193 if (SkTextureCompressor::ExistsBlitterForFormat(fCompressedFormat)) {
194 int cmpSz = SkTextureCompressor::GetCompressedDataSize(
195 fCompressedFormat, cmpWidth, cmpHeight);
196
197 SkASSERT(cmpSz > 0);
198 SkASSERT(NULL == fCompressedBuffer.get());
199 fCompressedBuffer.reset(cmpSz);
200 fCompressionMode = kBlitter_CompressionMode;
201 }
202 }
203
204 // If we don't have a custom blitter, then we either need a bitmap to compress
205 // from or a bitmap that we're going to use as a texture. In any case, we should
206 // allocate the pixels for a bitmap
207 const SkImageInfo bmImageInfo = SkImageInfo::MakeA8(cmpWidth, cmpHeight);
208 if (kBlitter_CompressionMode != fCompressionMode) {
reed84825042014-09-02 12:50:45 -0700209 if (!fBM.tryAllocPixels(bmImageInfo)) {
krajcevskib8ccc2f2014-08-07 08:15:14 -0700210 return false;
211 }
212
213 sk_bzero(fBM.getPixels(), fBM.getSafeSize());
krajcevskib3abe902014-07-30 13:08:11 -0700214 } else {
krajcevskib8ccc2f2014-08-07 08:15:14 -0700215 // Otherwise, we just need to remember how big the buffer is...
216 fBM.setInfo(bmImageInfo);
krajcevskib3abe902014-07-30 13:08:11 -0700217 }
robertphillips@google.com58b20212012-06-27 20:44:52 +0000218
robertphillips@google.com58b20212012-06-27 20:44:52 +0000219 sk_bzero(&fDraw, sizeof(fDraw));
krajcevskib8ccc2f2014-08-07 08:15:14 -0700220
robertphillips@google.com58b20212012-06-27 20:44:52 +0000221 fRasterClip.setRect(bounds);
222 fDraw.fRC = &fRasterClip;
223 fDraw.fClip = &fRasterClip.bwRgn();
224 fDraw.fMatrix = &fMatrix;
225 fDraw.fBitmap = &fBM;
226 return true;
227}
228
229/**
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000230 * Get a texture (from the texture cache) of the correct size & format.
robertphillips@google.com58b20212012-06-27 20:44:52 +0000231 */
bsalomone3059732014-10-14 11:47:22 -0700232GrTexture* GrSWMaskHelper::createTexture() {
bsalomonf2703d82014-10-28 14:33:06 -0700233 GrSurfaceDesc desc;
robertphillips@google.com58b20212012-06-27 20:44:52 +0000234 desc.fWidth = fBM.width();
235 desc.fHeight = fBM.height();
krajcevskib3abe902014-07-30 13:08:11 -0700236 desc.fConfig = kAlpha_8_GrPixelConfig;
krajcevskifb4f5cb2014-06-12 09:20:38 -0700237
krajcevskib8ccc2f2014-08-07 08:15:14 -0700238 if (kNone_CompressionMode != fCompressionMode) {
krajcevskib577c552014-07-16 13:26:43 -0700239
krajcevski25a67bc2014-07-29 11:44:26 -0700240#ifdef SK_DEBUG
krajcevskib3abe902014-07-30 13:08:11 -0700241 int dimX, dimY;
242 SkTextureCompressor::GetBlockDimensions(fCompressedFormat, &dimX, &dimY);
243 SkASSERT((desc.fWidth % dimX) == 0);
244 SkASSERT((desc.fHeight % dimY) == 0);
krajcevski25a67bc2014-07-29 11:44:26 -0700245#endif
246
krajcevskib3abe902014-07-30 13:08:11 -0700247 desc.fConfig = fmt_to_config(fCompressedFormat);
bsalomon76228632015-05-29 08:02:10 -0700248 SkASSERT(fContext->caps()->isConfigTexturable(desc.fConfig));
krajcevskifb4f5cb2014-06-12 09:20:38 -0700249 }
robertphillips@google.com58b20212012-06-27 20:44:52 +0000250
bsalomond309e7a2015-04-30 14:18:54 -0700251 return fContext->textureProvider()->refScratchTexture(
252 desc, GrTextureProvider::kApprox_ScratchTexMatch);
robertphillips@google.com58b20212012-06-27 20:44:52 +0000253}
254
bsalomonf2703d82014-10-28 14:33:06 -0700255void GrSWMaskHelper::sendTextureData(GrTexture *texture, const GrSurfaceDesc& desc,
bsalomonef3fcd82014-12-12 08:51:38 -0800256 const void *data, size_t rowbytes) {
krajcevskifb4f5cb2014-06-12 09:20:38 -0700257 // If we aren't reusing scratch textures we don't need to flush before
258 // writing since no one else will be using 'texture'
bsalomon76228632015-05-29 08:02:10 -0700259 bool reuseScratch = fContext->caps()->reuseScratchTextures();
krajcevski5c2fca02014-06-10 17:25:28 -0700260
krajcevskifb4f5cb2014-06-12 09:20:38 -0700261 // Since we're uploading to it, and it's compressed, 'texture' shouldn't
262 // have a render target.
263 SkASSERT(NULL == texture->asRenderTarget());
264
265 texture->writePixels(0, 0, desc.fWidth, desc.fHeight,
266 desc.fConfig, data, rowbytes,
267 reuseScratch ? 0 : GrContext::kDontFlush_PixelOpsFlag);
krajcevski5c2fca02014-06-10 17:25:28 -0700268}
269
bsalomonf2703d82014-10-28 14:33:06 -0700270void GrSWMaskHelper::compressTextureData(GrTexture *texture, const GrSurfaceDesc& desc) {
krajcevskib577c552014-07-16 13:26:43 -0700271
272 SkASSERT(GrPixelConfigIsCompressed(desc.fConfig));
krajcevskib3abe902014-07-30 13:08:11 -0700273 SkASSERT(fmt_to_config(fCompressedFormat) == desc.fConfig);
krajcevskib577c552014-07-16 13:26:43 -0700274
krajcevskib3abe902014-07-30 13:08:11 -0700275 SkAutoDataUnref cmpData(SkTextureCompressor::CompressBitmapToFormat(fBM, fCompressedFormat));
bsalomon49f085d2014-09-05 13:34:00 -0700276 SkASSERT(cmpData);
krajcevskib577c552014-07-16 13:26:43 -0700277
278 this->sendTextureData(texture, desc, cmpData->data(), 0);
279}
280
robertphillips@google.com58b20212012-06-27 20:44:52 +0000281/**
282 * Move the result of the software mask generation back to the gpu
283 */
robertphillips@google.comd92cf2e2013-07-19 18:13:02 +0000284void GrSWMaskHelper::toTexture(GrTexture *texture) {
robertphillips@google.com58b20212012-06-27 20:44:52 +0000285 SkAutoLockPixels alp(fBM);
286
bsalomonf2703d82014-10-28 14:33:06 -0700287 GrSurfaceDesc desc;
krajcevskifb4f5cb2014-06-12 09:20:38 -0700288 desc.fWidth = fBM.width();
289 desc.fHeight = fBM.height();
290 desc.fConfig = texture->config();
291
292 // First see if we should compress this texture before uploading.
krajcevskib8ccc2f2014-08-07 08:15:14 -0700293 switch (fCompressionMode) {
294 case kNone_CompressionMode:
295 this->sendTextureData(texture, desc, fBM.getPixels(), fBM.rowBytes());
296 break;
297
298 case kCompress_CompressionMode:
299 this->compressTextureData(texture, desc);
300 break;
301
302 case kBlitter_CompressionMode:
bsalomon49f085d2014-09-05 13:34:00 -0700303 SkASSERT(fCompressedBuffer.get());
krajcevskib8ccc2f2014-08-07 08:15:14 -0700304 this->sendTextureData(texture, desc, fCompressedBuffer.get(), 0);
305 break;
krajcevskifb4f5cb2014-06-12 09:20:38 -0700306 }
robertphillips@google.com58b20212012-06-27 20:44:52 +0000307}
308
jvanverthfa38a302014-10-06 05:59:05 -0700309/**
310 * Convert mask generation results to a signed distance field
311 */
312void GrSWMaskHelper::toSDF(unsigned char* sdf) {
313 SkAutoLockPixels alp(fBM);
314
315 SkGenerateDistanceFieldFromA8Image(sdf, (const unsigned char*)fBM.getPixels(),
316 fBM.width(), fBM.height(), fBM.rowBytes());
317}
318
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000319////////////////////////////////////////////////////////////////////////////////
320/**
rmistry@google.comfbfcd562012-08-23 18:09:54 +0000321 * Software rasterizes path to A8 mask (possibly using the context's matrix)
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000322 * and uploads the result to a scratch texture. Returns the resulting
323 * texture on success; NULL on failure.
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000324 */
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000325GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
326 const SkPath& path,
sugoi@google.com5f74cf82012-12-17 21:16:45 +0000327 const SkStrokeRec& stroke,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +0000328 const SkIRect& resultBounds,
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000329 bool antiAlias,
joshualitt8059eb92014-12-29 15:10:07 -0800330 const SkMatrix* matrix) {
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000331 GrSWMaskHelper helper(context);
332
reed@google.com84e922b2013-11-04 20:57:36 +0000333 if (!helper.init(resultBounds, matrix)) {
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000334 return NULL;
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000335 }
336
sugoi@google.com12b4e272012-12-06 20:13:11 +0000337 helper.draw(path, stroke, SkRegion::kReplace_Op, antiAlias, 0xFF);
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000338
bsalomone3059732014-10-14 11:47:22 -0700339 GrTexture* texture(helper.createTexture());
340 if (!texture) {
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000341 return NULL;
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000342 }
343
bsalomone3059732014-10-14 11:47:22 -0700344 helper.toTexture(texture);
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000345
bsalomone3059732014-10-14 11:47:22 -0700346 return texture;
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000347}
348
349void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
350 GrDrawTarget* target,
egdaniel8dd688b2015-01-22 10:16:09 -0800351 GrPipelineBuilder* pipelineBuilder,
joshualitt2e3b3e32014-12-09 13:31:14 -0800352 GrColor color,
joshualitt8059eb92014-12-29 15:10:07 -0800353 const SkMatrix& viewMatrix,
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +0000354 const SkIRect& rect) {
joshualittd27f73e2014-12-29 07:43:36 -0800355 SkMatrix invert;
joshualitt8059eb92014-12-29 15:10:07 -0800356 if (!viewMatrix.invert(&invert)) {
bsalomon@google.come3d32162012-07-20 13:37:06 +0000357 return;
358 }
bsalomon6be6f7c2015-02-26 13:05:21 -0800359 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp(pipelineBuilder);
robertphillips@google.com5dfb6722012-07-09 16:32:28 +0000360
commit-bot@chromium.orgfd03d4a2013-07-17 21:39:42 +0000361 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
362 SK_Scalar1 * rect.fTop,
363 SK_Scalar1 * rect.fRight,
364 SK_Scalar1 * rect.fBottom);
bsalomon@google.comc7818882013-03-20 19:19:53 +0000365
bsalomon309d4d52014-12-18 10:17:44 -0800366 // We use device coords to compute the texture coordinates. We take the device coords and apply
367 // a translation so that the top-left of the device bounds maps to 0,0, and then a scaling
368 // matrix to normalized coords.
bsalomon@google.comc7818882013-03-20 19:19:53 +0000369 SkMatrix maskMatrix;
370 maskMatrix.setIDiv(texture->width(), texture->height());
371 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop));
bsalomon@google.comc7818882013-03-20 19:19:53 +0000372
egdaniel8dd688b2015-01-22 10:16:09 -0800373 pipelineBuilder->addCoverageProcessor(
bsalomon@google.comc7818882013-03-20 19:19:53 +0000374 GrSimpleTextureEffect::Create(texture,
375 maskMatrix,
humper@google.comb86add12013-07-25 18:49:07 +0000376 GrTextureParams::kNone_FilterMode,
bsalomon309d4d52014-12-18 10:17:44 -0800377 kDevice_GrCoordSet))->unref();
bsalomon@google.comc7818882013-03-20 19:19:53 +0000378
robertphillipsea461502015-05-26 11:38:03 -0700379 target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &invert);
robertphillips@google.com366f1c62012-06-29 21:38:47 +0000380}