ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2015 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #include "GrAALinearizingConvexPathRenderer.h" |
| 10 | |
| 11 | #include "GrAAConvexTessellator.h" |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 12 | #include "GrBatchTarget.h" |
| 13 | #include "GrBatchTest.h" |
| 14 | #include "GrContext.h" |
| 15 | #include "GrDefaultGeoProcFactory.h" |
| 16 | #include "GrGeometryProcessor.h" |
| 17 | #include "GrInvariantOutput.h" |
| 18 | #include "GrPathUtils.h" |
| 19 | #include "GrProcessor.h" |
| 20 | #include "GrPipelineBuilder.h" |
| 21 | #include "GrStrokeInfo.h" |
| 22 | #include "SkGeometry.h" |
| 23 | #include "SkString.h" |
| 24 | #include "SkTraceEvent.h" |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 25 | #include "SkPathPriv.h" |
joshualitt | 7441782 | 2015-08-07 11:42:16 -0700 | [diff] [blame] | 26 | #include "batches/GrBatch.h" |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 27 | #include "gl/GrGLProcessor.h" |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 28 | #include "gl/GrGLGeometryProcessor.h" |
| 29 | #include "gl/builders/GrGLProgramBuilder.h" |
| 30 | |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 31 | static const int DEFAULT_BUFFER_SIZE = 100; |
| 32 | |
| 33 | // The thicker the stroke, the harder it is to produce high-quality results using tessellation. For |
| 34 | // the time being, we simply drop back to software rendering above this stroke width. |
| 35 | static const SkScalar kMaxStrokeWidth = 20.0; |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 36 | |
| 37 | GrAALinearizingConvexPathRenderer::GrAALinearizingConvexPathRenderer() { |
| 38 | } |
| 39 | |
| 40 | /////////////////////////////////////////////////////////////////////////////// |
| 41 | |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 42 | bool GrAALinearizingConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
| 43 | if (!args.fAntiAlias) { |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 44 | return false; |
| 45 | } |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 46 | if (args.fPath->isInverseFillType()) { |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 47 | return false; |
| 48 | } |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 49 | if (!args.fPath->isConvex()) { |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 50 | return false; |
| 51 | } |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 52 | if (args.fStroke->getStyle() == SkStrokeRec::kStroke_Style) { |
| 53 | return args.fViewMatrix->isSimilarity() && args.fStroke->getWidth() >= 1.0f && |
| 54 | args.fStroke->getWidth() <= kMaxStrokeWidth && !args.fStroke->isDashed() && |
| 55 | SkPathPriv::LastVerbIsClose(*args.fPath) && |
| 56 | args.fStroke->getJoin() != SkPaint::Join::kRound_Join; |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 57 | } |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 58 | return args.fStroke->getStyle() == SkStrokeRec::kFill_Style; |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | // extract the result vertices and indices from the GrAAConvexTessellator |
| 62 | static void extract_verts(const GrAAConvexTessellator& tess, |
| 63 | void* vertices, |
| 64 | size_t vertexStride, |
| 65 | GrColor color, |
| 66 | uint16_t firstIndex, |
| 67 | uint16_t* idxs, |
| 68 | bool tweakAlphaForCoverage) { |
| 69 | intptr_t verts = reinterpret_cast<intptr_t>(vertices); |
| 70 | |
| 71 | for (int i = 0; i < tess.numPts(); ++i) { |
| 72 | *((SkPoint*)((intptr_t)verts + i * vertexStride)) = tess.point(i); |
| 73 | } |
| 74 | |
| 75 | // Make 'verts' point to the colors |
| 76 | verts += sizeof(SkPoint); |
| 77 | for (int i = 0; i < tess.numPts(); ++i) { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 78 | if (tweakAlphaForCoverage) { |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 79 | SkASSERT(SkScalarRoundToInt(255.0f * tess.coverage(i)) <= 255); |
| 80 | unsigned scale = SkScalarRoundToInt(255.0f * tess.coverage(i)); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 81 | GrColor scaledColor = (0xff == scale) ? color : SkAlphaMulQ(color, scale); |
| 82 | *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor; |
| 83 | } else { |
| 84 | *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color; |
| 85 | *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor)) = |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 86 | tess.coverage(i); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 87 | } |
| 88 | } |
| 89 | |
| 90 | for (int i = 0; i < tess.numIndices(); ++i) { |
| 91 | idxs[i] = tess.index(i) + firstIndex; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage, |
joshualitt | df0c557 | 2015-08-03 11:35:28 -0700 | [diff] [blame] | 96 | const SkMatrix& viewMatrix, |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 97 | bool usesLocalCoords, |
| 98 | bool coverageIgnored) { |
joshualitt | df0c557 | 2015-08-03 11:35:28 -0700 | [diff] [blame] | 99 | using namespace GrDefaultGeoProcFactory; |
joshualitt | e494a58 | 2015-08-03 09:32:36 -0700 | [diff] [blame] | 100 | |
joshualitt | df0c557 | 2015-08-03 11:35:28 -0700 | [diff] [blame] | 101 | Color color(Color::kAttribute_Type); |
| 102 | Coverage::Type coverageType; |
| 103 | // TODO remove coverage if coverage is ignored |
| 104 | /*if (coverageIgnored) { |
| 105 | coverageType = Coverage::kNone_Type; |
| 106 | } else*/ if (tweakAlphaForCoverage) { |
| 107 | coverageType = Coverage::kSolid_Type; |
| 108 | } else { |
| 109 | coverageType = Coverage::kAttribute_Type; |
| 110 | } |
| 111 | Coverage coverage(coverageType); |
| 112 | LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type : |
| 113 | LocalCoords::kUnused_Type); |
| 114 | return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 115 | } |
| 116 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame^] | 117 | class AAFlatteningConvexPathBatch : public GrVertexBatch { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 118 | public: |
| 119 | struct Geometry { |
| 120 | GrColor fColor; |
| 121 | SkMatrix fViewMatrix; |
| 122 | SkPath fPath; |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 123 | SkScalar fStrokeWidth; |
| 124 | SkPaint::Join fJoin; |
| 125 | SkScalar fMiterLimit; |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 126 | }; |
| 127 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame^] | 128 | static GrDrawBatch* Create(const Geometry& geometry) { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 129 | return SkNEW_ARGS(AAFlatteningConvexPathBatch, (geometry)); |
| 130 | } |
| 131 | |
| 132 | const char* name() const override { return "AAConvexBatch"; } |
| 133 | |
| 134 | void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 135 | // When this is called on a batch, there is only one geometry bundle |
| 136 | out->setKnownFourComponents(fGeoData[0].fColor); |
| 137 | } |
| 138 | void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 139 | out->setUnknownSingleComponent(); |
| 140 | } |
| 141 | |
bsalomon | 91d844d | 2015-08-10 10:47:29 -0700 | [diff] [blame] | 142 | void initBatchTracker(const GrPipelineOptimizations& opt) override { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 143 | // Handle any color overrides |
bsalomon | 91d844d | 2015-08-10 10:47:29 -0700 | [diff] [blame] | 144 | if (!opt.readsColor()) { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 145 | fGeoData[0].fColor = GrColor_ILLEGAL; |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 146 | } |
bsalomon | 91d844d | 2015-08-10 10:47:29 -0700 | [diff] [blame] | 147 | opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 148 | |
| 149 | // setup batch properties |
bsalomon | 91d844d | 2015-08-10 10:47:29 -0700 | [diff] [blame] | 150 | fBatch.fColorIgnored = !opt.readsColor(); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 151 | fBatch.fColor = fGeoData[0].fColor; |
bsalomon | 91d844d | 2015-08-10 10:47:29 -0700 | [diff] [blame] | 152 | fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 153 | fBatch.fCoverageIgnored = !opt.readsCoverage(); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 154 | fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSegmentMasks(); |
bsalomon | 91d844d | 2015-08-10 10:47:29 -0700 | [diff] [blame] | 155 | fBatch.fCanTweakAlphaForCoverage = opt.canTweakAlphaForCoverage(); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | void draw(GrBatchTarget* batchTarget, const GrPipeline* pipeline, int vertexCount, |
| 159 | size_t vertexStride, void* vertices, int indexCount, uint16_t* indices) { |
| 160 | if (vertexCount == 0 || indexCount == 0) { |
| 161 | return; |
| 162 | } |
| 163 | const GrVertexBuffer* vertexBuffer; |
| 164 | GrVertices info; |
| 165 | int firstVertex; |
| 166 | void* verts = batchTarget->makeVertSpace(vertexStride, vertexCount, &vertexBuffer, |
| 167 | &firstVertex); |
| 168 | if (!verts) { |
| 169 | SkDebugf("Could not allocate vertices\n"); |
| 170 | return; |
| 171 | } |
| 172 | memcpy(verts, vertices, vertexCount * vertexStride); |
| 173 | |
| 174 | const GrIndexBuffer* indexBuffer; |
| 175 | int firstIndex; |
| 176 | uint16_t* idxs = batchTarget->makeIndexSpace(indexCount, &indexBuffer, &firstIndex); |
| 177 | if (!idxs) { |
| 178 | SkDebugf("Could not allocate indices\n"); |
| 179 | return; |
| 180 | } |
| 181 | memcpy(idxs, indices, indexCount * sizeof(uint16_t)); |
| 182 | info.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex, |
| 183 | firstIndex, vertexCount, indexCount); |
| 184 | batchTarget->draw(info); |
| 185 | } |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 186 | |
bsalomon | fb1141a | 2015-08-06 08:52:49 -0700 | [diff] [blame] | 187 | void generateGeometry(GrBatchTarget* batchTarget) override { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 188 | bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
| 189 | |
joshualitt | df0c557 | 2015-08-03 11:35:28 -0700 | [diff] [blame] | 190 | // Setup GrGeometryProcessor |
| 191 | SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaForCoverage, |
| 192 | this->viewMatrix(), |
| 193 | this->usesLocalCoords(), |
| 194 | this->coverageIgnored())); |
| 195 | if (!gp) { |
| 196 | SkDebugf("Couldn't create a GrGeometryProcessor\n"); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 197 | return; |
| 198 | } |
| 199 | |
bsalomon | fb1141a | 2015-08-06 08:52:49 -0700 | [diff] [blame] | 200 | batchTarget->initDraw(gp, this->pipeline()); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 201 | |
| 202 | size_t vertexStride = gp->getVertexStride(); |
| 203 | |
| 204 | SkASSERT(canTweakAlphaForCoverage ? |
| 205 | vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAttr) : |
| 206 | vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCoverageAttr)); |
| 207 | |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 208 | int instanceCount = fGeoData.count(); |
| 209 | |
| 210 | int vertexCount = 0; |
| 211 | int indexCount = 0; |
| 212 | int maxVertices = DEFAULT_BUFFER_SIZE; |
| 213 | int maxIndices = DEFAULT_BUFFER_SIZE; |
| 214 | uint8_t* vertices = (uint8_t*) malloc(maxVertices * vertexStride); |
| 215 | uint16_t* indices = (uint16_t*) malloc(maxIndices * sizeof(uint16_t)); |
| 216 | for (int i = 0; i < instanceCount; i++) { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 217 | Geometry& args = fGeoData[i]; |
fmalita | bd5d7e7 | 2015-06-26 07:18:24 -0700 | [diff] [blame] | 218 | GrAAConvexTessellator tess(args.fStrokeWidth, args.fJoin, args.fMiterLimit); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 219 | |
| 220 | if (!tess.tessellate(args.fViewMatrix, args.fPath)) { |
| 221 | continue; |
| 222 | } |
| 223 | |
| 224 | int currentIndices = tess.numIndices(); |
| 225 | SkASSERT(currentIndices <= UINT16_MAX); |
| 226 | if (indexCount + currentIndices > UINT16_MAX) { |
| 227 | // if we added the current instance, we would overflow the indices we can store in a |
| 228 | // uint16_t. Draw what we've got so far and reset. |
bsalomon | fb1141a | 2015-08-06 08:52:49 -0700 | [diff] [blame] | 229 | draw(batchTarget, this->pipeline(), vertexCount, vertexStride, vertices, indexCount, |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 230 | indices); |
| 231 | vertexCount = 0; |
| 232 | indexCount = 0; |
| 233 | } |
| 234 | int currentVertices = tess.numPts(); |
| 235 | if (vertexCount + currentVertices > maxVertices) { |
| 236 | maxVertices = SkTMax(vertexCount + currentVertices, maxVertices * 2); |
| 237 | vertices = (uint8_t*) realloc(vertices, maxVertices * vertexStride); |
| 238 | } |
| 239 | if (indexCount + currentIndices > maxIndices) { |
| 240 | maxIndices = SkTMax(indexCount + currentIndices, maxIndices * 2); |
| 241 | indices = (uint16_t*) realloc(indices, maxIndices * sizeof(uint16_t)); |
| 242 | } |
| 243 | |
| 244 | extract_verts(tess, vertices + vertexStride * vertexCount, vertexStride, args.fColor, |
| 245 | vertexCount, indices + indexCount, canTweakAlphaForCoverage); |
| 246 | vertexCount += currentVertices; |
| 247 | indexCount += currentIndices; |
| 248 | } |
bsalomon | fb1141a | 2015-08-06 08:52:49 -0700 | [diff] [blame] | 249 | draw(batchTarget, this->pipeline(), vertexCount, vertexStride, vertices, indexCount, |
| 250 | indices); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 251 | free(vertices); |
| 252 | free(indices); |
| 253 | } |
| 254 | |
| 255 | SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 256 | |
| 257 | private: |
| 258 | AAFlatteningConvexPathBatch(const Geometry& geometry) { |
| 259 | this->initClassID<AAFlatteningConvexPathBatch>(); |
| 260 | fGeoData.push_back(geometry); |
| 261 | |
| 262 | // compute bounds |
| 263 | fBounds = geometry.fPath.getBounds(); |
| 264 | geometry.fViewMatrix.mapRect(&fBounds); |
| 265 | } |
| 266 | |
bsalomon | cb02b38 | 2015-08-12 11:14:50 -0700 | [diff] [blame] | 267 | bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame^] | 268 | AAFlatteningConvexPathBatch* that = t->cast<AAFlatteningConvexPathBatch>(); |
| 269 | if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(), |
| 270 | that->bounds(), caps)) { |
joshualitt | 8cab9a7 | 2015-07-16 09:13:50 -0700 | [diff] [blame] | 271 | return false; |
| 272 | } |
| 273 | |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 274 | SkASSERT(this->usesLocalCoords() == that->usesLocalCoords()); |
| 275 | if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->viewMatrix())) { |
| 276 | return false; |
| 277 | } |
| 278 | |
| 279 | // In the event of two batches, one who can tweak, one who cannot, we just fall back to |
| 280 | // not tweaking |
| 281 | if (this->canTweakAlphaForCoverage() != that->canTweakAlphaForCoverage()) { |
| 282 | fBatch.fCanTweakAlphaForCoverage = false; |
| 283 | } |
| 284 | |
| 285 | fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()); |
| 286 | this->joinBounds(that->bounds()); |
| 287 | return true; |
| 288 | } |
| 289 | |
| 290 | GrColor color() const { return fBatch.fColor; } |
| 291 | bool linesOnly() const { return fBatch.fLinesOnly; } |
| 292 | bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
| 293 | bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCoverage; } |
| 294 | const SkMatrix& viewMatrix() const { return fGeoData[0].fViewMatrix; } |
| 295 | bool coverageIgnored() const { return fBatch.fCoverageIgnored; } |
| 296 | |
| 297 | struct BatchTracker { |
| 298 | GrColor fColor; |
| 299 | bool fUsesLocalCoords; |
| 300 | bool fColorIgnored; |
| 301 | bool fCoverageIgnored; |
| 302 | bool fLinesOnly; |
| 303 | bool fCanTweakAlphaForCoverage; |
| 304 | }; |
| 305 | |
| 306 | BatchTracker fBatch; |
| 307 | SkSTArray<1, Geometry, true> fGeoData; |
| 308 | }; |
| 309 | |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 310 | bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { |
| 311 | if (args.fPath->isEmpty()) { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 312 | return true; |
| 313 | } |
| 314 | AAFlatteningConvexPathBatch::Geometry geometry; |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 315 | geometry.fColor = args.fColor; |
| 316 | geometry.fViewMatrix = *args.fViewMatrix; |
| 317 | geometry.fPath = *args.fPath; |
| 318 | geometry.fStrokeWidth = args.fStroke->isFillStyle() ? -1.0f : args.fStroke->getWidth(); |
| 319 | geometry.fJoin = args.fStroke->isFillStyle() ? SkPaint::Join::kMiter_Join : |
| 320 | args.fStroke->getJoin(); |
| 321 | geometry.fMiterLimit = args.fStroke->getMiter(); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 322 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame^] | 323 | SkAutoTUnref<GrDrawBatch> batch(AAFlatteningConvexPathBatch::Create(geometry)); |
bsalomon | 0aff2fa | 2015-07-31 06:48:27 -0700 | [diff] [blame] | 324 | args.fTarget->drawBatch(*args.fPipelineBuilder, batch); |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 325 | |
| 326 | return true; |
| 327 | } |
| 328 | |
| 329 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 330 | |
| 331 | #ifdef GR_TEST_UTILS |
| 332 | |
bsalomon | abd30f5 | 2015-08-13 13:34:48 -0700 | [diff] [blame^] | 333 | DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { |
ethannicholas | 1a1b3ac | 2015-06-10 12:11:17 -0700 | [diff] [blame] | 334 | AAFlatteningConvexPathBatch::Geometry geometry; |
| 335 | geometry.fColor = GrRandomColor(random); |
| 336 | geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); |
| 337 | geometry.fPath = GrTest::TestPathConvex(random); |
| 338 | |
| 339 | return AAFlatteningConvexPathBatch::Create(geometry); |
| 340 | } |
| 341 | |
| 342 | #endif |