blob: c6eb5ab9ed344f816b154eee8570e406a7f578d9 [file] [log] [blame]
joshualitt9ff64252015-08-10 09:03:51 -07001/*
2 * Copyright 2015 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 "GrAAFillRectBatch.h"
9
bsalomon75398562015-08-17 12:55:38 -070010#include "GrBatchFlushState.h"
joshualitt37eb1842015-08-12 06:36:57 -070011#include "GrColor.h"
joshualitt9ff64252015-08-10 09:03:51 -070012#include "GrDefaultGeoProcFactory.h"
13#include "GrResourceKey.h"
14#include "GrResourceProvider.h"
joshualitt37eb1842015-08-12 06:36:57 -070015#include "GrTypes.h"
bsalomon16b99132015-08-13 14:55:50 -070016#include "GrVertexBatch.h"
joshualitt37eb1842015-08-12 06:36:57 -070017#include "SkMatrix.h"
18#include "SkRect.h"
joshualitt9ff64252015-08-10 09:03:51 -070019
20GR_DECLARE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey);
21
22static void set_inset_fan(SkPoint* pts, size_t stride,
23 const SkRect& r, SkScalar dx, SkScalar dy) {
24 pts->setRectFan(r.fLeft + dx, r.fTop + dy,
25 r.fRight - dx, r.fBottom - dy, stride);
26}
27
joshualitt27801bf2015-08-12 12:52:47 -070028static const int kNumAAFillRectsInIndexBuffer = 256;
29static const int kVertsPerAAFillRect = 8;
30static const int kIndicesPerAAFillRect = 30;
31
32const GrIndexBuffer* get_index_buffer(GrResourceProvider* resourceProvider) {
33 GR_DEFINE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey);
34
35 static const uint16_t gFillAARectIdx[] = {
36 0, 1, 5, 5, 4, 0,
37 1, 2, 6, 6, 5, 1,
38 2, 3, 7, 7, 6, 2,
39 3, 0, 4, 4, 7, 3,
40 4, 5, 6, 6, 7, 4,
41 };
42 GR_STATIC_ASSERT(SK_ARRAY_COUNT(gFillAARectIdx) == kIndicesPerAAFillRect);
43 return resourceProvider->findOrCreateInstancedIndexBuffer(gFillAARectIdx,
44 kIndicesPerAAFillRect, kNumAAFillRectsInIndexBuffer, kVertsPerAAFillRect,
45 gAAFillRectIndexBufferKey);
46}
47
joshualitt147dc062015-08-12 11:51:46 -070048/*
49 * AAFillRectBatch is templated to optionally allow the insertion of an additional
50 * attribute for explicit local coordinates.
51 * To use this template, an implementation must define the following static functions:
52 * A Geometry struct
53 *
joshualittcd47b712015-08-18 07:25:38 -070054 * bool CanCombine(const Geometry& mine, const Geometry& theirs,
55 * const GrPipelineOptimizations&)
joshualitt147dc062015-08-12 11:51:46 -070056 *
joshualittcd47b712015-08-18 07:25:38 -070057 * const GrGeometryProcessor* CreateGP(const Geometry& seedGeometry,
58 * const GrPipelineOptimizations& opts)
joshualitt147dc062015-08-12 11:51:46 -070059 *
joshualittcd47b712015-08-18 07:25:38 -070060 * Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo,
61 * const GrPipelineOptimizations& opts)
joshualitt147dc062015-08-12 11:51:46 -070062 */
63template <typename Base>
bsalomonabd30f52015-08-13 13:34:48 -070064class AAFillRectBatch : public GrVertexBatch {
joshualitt37eb1842015-08-12 06:36:57 -070065public:
joshualitt147dc062015-08-12 11:51:46 -070066 typedef typename Base::Geometry Geometry;
joshualitt9ff64252015-08-10 09:03:51 -070067
joshualitt147dc062015-08-12 11:51:46 -070068 static AAFillRectBatch* Create() {
69 return SkNEW(AAFillRectBatch);
joshualitt9ff64252015-08-10 09:03:51 -070070 }
71
joshualitt37eb1842015-08-12 06:36:57 -070072 const char* name() const override { return "AAFillRectBatch"; }
joshualitt9ff64252015-08-10 09:03:51 -070073
joshualitt37eb1842015-08-12 06:36:57 -070074 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
75 // When this is called on a batch, there is only one geometry bundle
76 out->setKnownFourComponents(fGeoData[0].fColor);
joshualitt9ff64252015-08-10 09:03:51 -070077 }
78
joshualitt37eb1842015-08-12 06:36:57 -070079 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
80 out->setUnknownSingleComponent();
joshualitt9ff64252015-08-10 09:03:51 -070081 }
82
joshualitt37eb1842015-08-12 06:36:57 -070083 void initBatchTracker(const GrPipelineOptimizations& opt) override {
joshualitt37eb1842015-08-12 06:36:57 -070084 opt.getOverrideColorIfSet(&fGeoData[0].fColor);
joshualittcd47b712015-08-18 07:25:38 -070085 fOpts = opt;
joshualitt9ff64252015-08-10 09:03:51 -070086 }
87
bsalomone46f9fe2015-08-18 06:05:14 -070088 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
89
90 // to avoid even the initial copy of the struct, we have a getter for the first item which
91 // is used to seed the batch with its initial geometry. After seeding, the client should call
92 // init() so the Batch can initialize itself
93 Geometry* geometry() { return &fGeoData[0]; }
94 void init() {
95 const Geometry& geo = fGeoData[0];
96 this->setBounds(geo.fDevRect);
97 }
98
99private:
100 AAFillRectBatch() {
101 this->initClassID<AAFillRectBatch<Base>>();
102
103 // Push back an initial geometry
104 fGeoData.push_back();
105 }
106
bsalomon75398562015-08-17 12:55:38 -0700107 void onPrepareDraws(Target* target) override {
joshualittcd47b712015-08-18 07:25:38 -0700108 SkAutoTUnref<const GrGeometryProcessor> gp(Base::CreateGP(this->seedGeometry(), fOpts));
joshualitt37eb1842015-08-12 06:36:57 -0700109 if (!gp) {
110 SkDebugf("Couldn't create GrGeometryProcessor\n");
111 return;
112 }
joshualitt9ff64252015-08-10 09:03:51 -0700113
bsalomon75398562015-08-17 12:55:38 -0700114 target->initDraw(gp, this->pipeline());
joshualitt9ff64252015-08-10 09:03:51 -0700115
joshualitt37eb1842015-08-12 06:36:57 -0700116 size_t vertexStride = gp->getVertexStride();
joshualitt37eb1842015-08-12 06:36:57 -0700117 int instanceCount = fGeoData.count();
joshualitt9ff64252015-08-10 09:03:51 -0700118
bsalomon75398562015-08-17 12:55:38 -0700119 SkAutoTUnref<const GrIndexBuffer> indexBuffer(get_index_buffer(target->resourceProvider()));
joshualitt37eb1842015-08-12 06:36:57 -0700120 InstancedHelper helper;
bsalomon75398562015-08-17 12:55:38 -0700121 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexStride,
joshualitt37eb1842015-08-12 06:36:57 -0700122 indexBuffer, kVertsPerAAFillRect, kIndicesPerAAFillRect,
123 instanceCount);
124 if (!vertices || !indexBuffer) {
125 SkDebugf("Could not allocate vertices\n");
126 return;
127 }
128
129 for (int i = 0; i < instanceCount; i++) {
joshualittcd47b712015-08-18 07:25:38 -0700130 intptr_t verts = reinterpret_cast<intptr_t>(vertices) +
131 i * kVertsPerAAFillRect * vertexStride;
132 Base::Tesselate(verts, vertexStride, fGeoData[i], fOpts);
joshualitt37eb1842015-08-12 06:36:57 -0700133 }
bsalomon75398562015-08-17 12:55:38 -0700134 helper.recordDraw(target);
joshualitt37eb1842015-08-12 06:36:57 -0700135 }
136
joshualittcd47b712015-08-18 07:25:38 -0700137 const Geometry& seedGeometry() const { return fGeoData[0]; }
138
bsalomonc3021ed2015-08-12 11:28:11 -0700139 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
bsalomonabd30f52015-08-13 13:34:48 -0700140 AAFillRectBatch* that = t->cast<AAFillRectBatch>();
141 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
142 that->bounds(), caps)) {
joshualitt37eb1842015-08-12 06:36:57 -0700143 return false;
144 }
145
joshualittcd47b712015-08-18 07:25:38 -0700146 if (!Base::CanCombine(this->seedGeometry(), that->seedGeometry(), fOpts)) {
joshualitt37eb1842015-08-12 06:36:57 -0700147 return false;
148 }
149
joshualitt37eb1842015-08-12 06:36:57 -0700150 // In the event of two batches, one who can tweak, one who cannot, we just fall back to
151 // not tweaking
joshualittcd47b712015-08-18 07:25:38 -0700152 if (fOpts.canTweakAlphaForCoverage() && !that->fOpts.canTweakAlphaForCoverage()) {
153 fOpts = that->fOpts;
joshualitt37eb1842015-08-12 06:36:57 -0700154 }
155
156 fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin());
157 this->joinBounds(that->bounds());
158 return true;
159 }
160
joshualittcd47b712015-08-18 07:25:38 -0700161 GrPipelineOptimizations fOpts;
joshualitt37eb1842015-08-12 06:36:57 -0700162 SkSTArray<1, Geometry, true> fGeoData;
163};
joshualitt9ff64252015-08-10 09:03:51 -0700164
joshualittcd47b712015-08-18 07:25:38 -0700165static const GrGeometryProcessor* create_fill_rect_gp(
166 const SkMatrix& viewMatrix,
167 const GrPipelineOptimizations& opts,
168 GrDefaultGeoProcFactory::LocalCoords::Type localCoordsType) {
169 using namespace GrDefaultGeoProcFactory;
170
171 Color color(Color::kAttribute_Type);
172 Coverage::Type coverageType;
173 // TODO remove coverage if coverage is ignored
174 /*if (coverageIgnored) {
175 coverageType = Coverage::kNone_Type;
176 } else*/ if (opts.canTweakAlphaForCoverage()) {
177 coverageType = Coverage::kSolid_Type;
178 } else {
179 coverageType = Coverage::kAttribute_Type;
180 }
181 Coverage coverage(coverageType);
182
183 // We assume the caller has inverted the viewmatrix
184 if (LocalCoords::kHasExplicit_Type == localCoordsType) {
185 LocalCoords localCoords(localCoordsType);
186 return GrDefaultGeoProcFactory::Create(color, coverage, localCoords, SkMatrix::I());
187 } else {
188 LocalCoords localCoords(opts.readsLocalCoords() ? localCoordsType :
189 LocalCoords::kUnused_Type);
190 return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
191 }
192}
193
194static void generate_aa_fill_rect_geometry(intptr_t verts,
195 size_t vertexStride,
196 GrColor color,
197 const SkMatrix& viewMatrix,
198 const SkRect& rect,
199 const SkRect& devRect,
200 const GrPipelineOptimizations& opts,
201 const SkMatrix* localMatrix) {
202 SkPoint* fan0Pos = reinterpret_cast<SkPoint*>(verts);
203 SkPoint* fan1Pos = reinterpret_cast<SkPoint*>(verts + 4 * vertexStride);
204
205 SkScalar inset = SkMinScalar(devRect.width(), SK_Scalar1);
206 inset = SK_ScalarHalf * SkMinScalar(inset, devRect.height());
207
208 if (viewMatrix.rectStaysRect()) {
209 set_inset_fan(fan0Pos, vertexStride, devRect, -SK_ScalarHalf, -SK_ScalarHalf);
210 set_inset_fan(fan1Pos, vertexStride, devRect, inset, inset);
211 } else {
212 // compute transformed (1, 0) and (0, 1) vectors
213 SkVector vec[2] = {
214 { viewMatrix[SkMatrix::kMScaleX], viewMatrix[SkMatrix::kMSkewY] },
215 { viewMatrix[SkMatrix::kMSkewX], viewMatrix[SkMatrix::kMScaleY] }
216 };
217
218 vec[0].normalize();
219 vec[0].scale(SK_ScalarHalf);
220 vec[1].normalize();
221 vec[1].scale(SK_ScalarHalf);
222
223 // create the rotated rect
224 fan0Pos->setRectFan(rect.fLeft, rect.fTop,
225 rect.fRight, rect.fBottom, vertexStride);
226 viewMatrix.mapPointsWithStride(fan0Pos, vertexStride, 4);
227
228 // Now create the inset points and then outset the original
229 // rotated points
230
231 // TL
232 *((SkPoint*)((intptr_t)fan1Pos + 0 * vertexStride)) =
233 *((SkPoint*)((intptr_t)fan0Pos + 0 * vertexStride)) + vec[0] + vec[1];
234 *((SkPoint*)((intptr_t)fan0Pos + 0 * vertexStride)) -= vec[0] + vec[1];
235 // BL
236 *((SkPoint*)((intptr_t)fan1Pos + 1 * vertexStride)) =
237 *((SkPoint*)((intptr_t)fan0Pos + 1 * vertexStride)) + vec[0] - vec[1];
238 *((SkPoint*)((intptr_t)fan0Pos + 1 * vertexStride)) -= vec[0] - vec[1];
239 // BR
240 *((SkPoint*)((intptr_t)fan1Pos + 2 * vertexStride)) =
241 *((SkPoint*)((intptr_t)fan0Pos + 2 * vertexStride)) - vec[0] - vec[1];
242 *((SkPoint*)((intptr_t)fan0Pos + 2 * vertexStride)) += vec[0] + vec[1];
243 // TR
244 *((SkPoint*)((intptr_t)fan1Pos + 3 * vertexStride)) =
245 *((SkPoint*)((intptr_t)fan0Pos + 3 * vertexStride)) - vec[0] + vec[1];
246 *((SkPoint*)((intptr_t)fan0Pos + 3 * vertexStride)) += vec[0] - vec[1];
247 }
248
249 if (localMatrix) {
250 SkMatrix invViewMatrix;
251 if (!viewMatrix.invert(&invViewMatrix)) {
252 SkASSERT(false);
253 invViewMatrix = SkMatrix::I();
254 }
255 SkMatrix localCoordMatrix;
256 localCoordMatrix.setConcat(*localMatrix, invViewMatrix);
257 SkPoint* fan0Loc = reinterpret_cast<SkPoint*>(verts + sizeof(SkPoint) + sizeof(GrColor));
258 localCoordMatrix.mapPointsWithStride(fan0Loc, fan0Pos, vertexStride, 8);
259 }
260
261 bool tweakAlphaForCoverage = opts.canTweakAlphaForCoverage();
262
263 // Make verts point to vertex color and then set all the color and coverage vertex attrs
264 // values.
265 verts += sizeof(SkPoint);
266
267 // The coverage offset is always the last vertex attribute
268 intptr_t coverageOffset = vertexStride - sizeof(GrColor) - sizeof(SkPoint);
269 for (int i = 0; i < 4; ++i) {
270 if (tweakAlphaForCoverage) {
271 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = 0;
272 } else {
273 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color;
274 *reinterpret_cast<float*>(verts + i * vertexStride + coverageOffset) = 0;
275 }
276 }
277
278 int scale;
279 if (inset < SK_ScalarHalf) {
280 scale = SkScalarFloorToInt(512.0f * inset / (inset + SK_ScalarHalf));
281 SkASSERT(scale >= 0 && scale <= 255);
282 } else {
283 scale = 0xff;
284 }
285
286 verts += 4 * vertexStride;
287
288 float innerCoverage = GrNormalizeByteToFloat(scale);
289 GrColor scaledColor = (0xff == scale) ? color : SkAlphaMulQ(color, scale);
290
291 for (int i = 0; i < 4; ++i) {
292 if (tweakAlphaForCoverage) {
293 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor;
294 } else {
295 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color;
296 *reinterpret_cast<float*>(verts + i * vertexStride +
297 coverageOffset) = innerCoverage;
298 }
299 }
300}
301
joshualitt147dc062015-08-12 11:51:46 -0700302class AAFillRectBatchNoLocalMatrixImp {
303public:
304 struct Geometry {
305 SkMatrix fViewMatrix;
joshualitt40ac15a2015-08-14 08:45:39 -0700306 SkRect fRect;
joshualitt147dc062015-08-12 11:51:46 -0700307 SkRect fDevRect;
308 GrColor fColor;
309 };
310
joshualittcd47b712015-08-18 07:25:38 -0700311 inline static bool CanCombine(const Geometry& mine, const Geometry& theirs,
312 const GrPipelineOptimizations& opts) {
joshualitt147dc062015-08-12 11:51:46 -0700313 // We apply the viewmatrix to the rect points on the cpu. However, if the pipeline uses
314 // local coords then we won't be able to batch. We could actually upload the viewmatrix
315 // using vertex attributes in these cases, but haven't investigated that
joshualittcd47b712015-08-18 07:25:38 -0700316 return !opts.readsLocalCoords() || mine.fViewMatrix.cheapEqualTo(theirs.fViewMatrix);
joshualitt147dc062015-08-12 11:51:46 -0700317 }
318
joshualittcd47b712015-08-18 07:25:38 -0700319 inline static const GrGeometryProcessor* CreateGP(const Geometry& geo,
320 const GrPipelineOptimizations& opts) {
321 const GrGeometryProcessor* gp =
322 create_fill_rect_gp(geo.fViewMatrix, opts,
323 GrDefaultGeoProcFactory::LocalCoords::kUsePosition_Type);
324
325 SkASSERT(opts.canTweakAlphaForCoverage() ?
326 gp->getVertexStride() == sizeof(GrDefaultGeoProcFactory::PositionColorAttr) :
327 gp->getVertexStride() ==
328 sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAttr));
329 return gp;
joshualitt147dc062015-08-12 11:51:46 -0700330 }
331
joshualittcd47b712015-08-18 07:25:38 -0700332 inline static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo,
333 const GrPipelineOptimizations& opts) {
334 generate_aa_fill_rect_geometry(vertices, vertexStride,
335 geo.fColor, geo.fViewMatrix, geo.fRect, geo.fDevRect, opts,
336 NULL);
joshualitt147dc062015-08-12 11:51:46 -0700337 }
joshualitt147dc062015-08-12 11:51:46 -0700338};
339
340class AAFillRectBatchLocalMatrixImp {
341public:
342 struct Geometry {
343 SkMatrix fViewMatrix;
344 SkMatrix fLocalMatrix;
joshualitt40ac15a2015-08-14 08:45:39 -0700345 SkRect fRect;
joshualitt147dc062015-08-12 11:51:46 -0700346 SkRect fDevRect;
347 GrColor fColor;
348 };
349
joshualittcd47b712015-08-18 07:25:38 -0700350 inline static bool CanCombine(const Geometry& mine, const Geometry& theirs,
351 const GrPipelineOptimizations&) {
joshualitt147dc062015-08-12 11:51:46 -0700352 return true;
353 }
354
joshualittcd47b712015-08-18 07:25:38 -0700355 inline static const GrGeometryProcessor* CreateGP(const Geometry& geo,
356 const GrPipelineOptimizations& opts) {
357 const GrGeometryProcessor* gp =
358 create_fill_rect_gp(geo.fViewMatrix, opts,
359 GrDefaultGeoProcFactory::LocalCoords::kHasExplicit_Type);
360
361 SkASSERT(opts.canTweakAlphaForCoverage() ?
362 gp->getVertexStride() ==
363 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordAttr) :
364 gp->getVertexStride() ==
365 sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordCoverage));
366 return gp;
joshualitt147dc062015-08-12 11:51:46 -0700367 }
368
joshualittcd47b712015-08-18 07:25:38 -0700369 inline static void Tesselate(intptr_t vertices, size_t vertexStride, const Geometry& geo,
370 const GrPipelineOptimizations& opts) {
371 generate_aa_fill_rect_geometry(vertices, vertexStride,
372 geo.fColor, geo.fViewMatrix, geo.fRect, geo.fDevRect, opts,
373 &geo.fLocalMatrix);
joshualitt147dc062015-08-12 11:51:46 -0700374 }
375};
376
377typedef AAFillRectBatch<AAFillRectBatchNoLocalMatrixImp> AAFillRectBatchNoLocalMatrix;
378typedef AAFillRectBatch<AAFillRectBatchLocalMatrixImp> AAFillRectBatchLocalMatrix;
379
joshualitt37eb1842015-08-12 06:36:57 -0700380namespace GrAAFillRectBatch {
joshualitt9ff64252015-08-10 09:03:51 -0700381
bsalomonabd30f52015-08-13 13:34:48 -0700382GrDrawBatch* Create(GrColor color,
383 const SkMatrix& viewMatrix,
384 const SkRect& rect,
385 const SkRect& devRect) {
joshualitt147dc062015-08-12 11:51:46 -0700386 AAFillRectBatchNoLocalMatrix* batch = AAFillRectBatchNoLocalMatrix::Create();
387 AAFillRectBatchNoLocalMatrix::Geometry& geo = *batch->geometry();
388 geo.fColor = color;
389 geo.fViewMatrix = viewMatrix;
joshualitt40ac15a2015-08-14 08:45:39 -0700390 geo.fRect = rect;
joshualitt147dc062015-08-12 11:51:46 -0700391 geo.fDevRect = devRect;
392 batch->init();
393 return batch;
394}
395
bsalomonabd30f52015-08-13 13:34:48 -0700396GrDrawBatch* Create(GrColor color,
397 const SkMatrix& viewMatrix,
398 const SkMatrix& localMatrix,
399 const SkRect& rect,
400 const SkRect& devRect) {
joshualitt147dc062015-08-12 11:51:46 -0700401 AAFillRectBatchLocalMatrix* batch = AAFillRectBatchLocalMatrix::Create();
402 AAFillRectBatchLocalMatrix::Geometry& geo = *batch->geometry();
403 geo.fColor = color;
404 geo.fViewMatrix = viewMatrix;
405 geo.fLocalMatrix = localMatrix;
joshualitt40ac15a2015-08-14 08:45:39 -0700406 geo.fRect = rect;
joshualitt147dc062015-08-12 11:51:46 -0700407 geo.fDevRect = devRect;
408 batch->init();
409 return batch;
joshualitt9ff64252015-08-10 09:03:51 -0700410}
411
joshualitt37eb1842015-08-12 06:36:57 -0700412};
413
joshualitt9ff64252015-08-10 09:03:51 -0700414///////////////////////////////////////////////////////////////////////////////////////////////////
415
416#ifdef GR_TEST_UTILS
417
418#include "GrBatchTest.h"
419
bsalomonabd30f52015-08-13 13:34:48 -0700420DRAW_BATCH_TEST_DEFINE(AAFillRectBatch) {
joshualitt090ae8e2015-08-14 09:01:21 -0700421 GrColor color = GrRandomColor(random);
422 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
423 SkRect rect = GrTest::TestRect(random);
424 SkRect devRect = GrTest::TestRect(random);
425 return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
joshualitt147dc062015-08-12 11:51:46 -0700426}
427
bsalomonabd30f52015-08-13 13:34:48 -0700428DRAW_BATCH_TEST_DEFINE(AAFillRectBatchLocalMatrix) {
joshualitt090ae8e2015-08-14 09:01:21 -0700429 GrColor color = GrRandomColor(random);
430 SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
431 SkMatrix localMatrix = GrTest::TestMatrix(random);
432 SkRect rect = GrTest::TestRect(random);
433 SkRect devRect = GrTest::TestRect(random);
434 return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRect);
joshualitt9ff64252015-08-10 09:03:51 -0700435}
436
437#endif