ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 "GrMSAAPathRenderer.h" |
| 9 | |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 10 | #include "GrAuditTrail.h" |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 11 | #include "GrBatchFlushState.h" |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 12 | #include "GrClip.h" |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 13 | #include "GrDefaultGeoProcFactory.h" |
| 14 | #include "GrPathStencilSettings.h" |
| 15 | #include "GrPathUtils.h" |
| 16 | #include "GrPipelineBuilder.h" |
| 17 | #include "GrMesh.h" |
| 18 | #include "SkGeometry.h" |
| 19 | #include "SkTraceEvent.h" |
| 20 | #include "glsl/GrGLSLGeometryProcessor.h" |
| 21 | #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 22 | #include "glsl/GrGLSLVertexShaderBuilder.h" |
| 23 | #include "glsl/GrGLSLProgramDataManager.h" |
| 24 | #include "glsl/GrGLSLUtil.h" |
| 25 | #include "gl/GrGLVaryingHandler.h" |
| 26 | #include "batches/GrRectBatchFactory.h" |
| 27 | #include "batches/GrVertexBatch.h" |
| 28 | |
| 29 | static const float kTolerance = 0.5f; |
| 30 | |
| 31 | //////////////////////////////////////////////////////////////////////////////// |
| 32 | // Helpers for drawPath |
| 33 | |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 34 | static inline bool single_pass_shape(const GrShape& shape) { |
| 35 | if (!shape.inverseFilled()) { |
| 36 | return shape.knownToBeConvex(); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 37 | } |
| 38 | return false; |
| 39 | } |
| 40 | |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 41 | GrPathRenderer::StencilSupport GrMSAAPathRenderer::onGetStencilSupport(const GrShape& shape) const { |
| 42 | if (single_pass_shape(shape)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 43 | return GrPathRenderer::kNoRestriction_StencilSupport; |
| 44 | } else { |
| 45 | return GrPathRenderer::kStencilOnly_StencilSupport; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | struct MSAALineVertices { |
| 50 | struct Vertex { |
| 51 | SkPoint fPosition; |
| 52 | SkColor fColor; |
| 53 | }; |
| 54 | Vertex* vertices; |
| 55 | Vertex* nextVertex; |
| 56 | #ifdef SK_DEBUG |
| 57 | Vertex* verticesEnd; |
| 58 | #endif |
| 59 | uint16_t* indices; |
| 60 | uint16_t* nextIndex; |
| 61 | }; |
| 62 | |
| 63 | struct MSAAQuadVertices { |
| 64 | struct Vertex { |
| 65 | SkPoint fPosition; |
| 66 | SkPoint fUV; |
| 67 | SkColor fColor; |
| 68 | }; |
| 69 | Vertex* vertices; |
| 70 | Vertex* nextVertex; |
| 71 | #ifdef SK_DEBUG |
| 72 | Vertex* verticesEnd; |
| 73 | #endif |
| 74 | uint16_t* indices; |
| 75 | uint16_t* nextIndex; |
| 76 | }; |
| 77 | |
| 78 | static inline void append_contour_edge_indices(uint16_t fanCenterIdx, |
| 79 | uint16_t edgeV0Idx, |
| 80 | MSAALineVertices& lines) { |
| 81 | *(lines.nextIndex++) = fanCenterIdx; |
| 82 | *(lines.nextIndex++) = edgeV0Idx; |
| 83 | *(lines.nextIndex++) = edgeV0Idx + 1; |
| 84 | } |
| 85 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 86 | static inline void add_quad(MSAALineVertices& lines, MSAAQuadVertices& quads, const SkPoint pts[], |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 87 | SkColor color, bool indexed, uint16_t subpathLineIdxStart) { |
| 88 | SkASSERT(lines.nextVertex < lines.verticesEnd); |
| 89 | *lines.nextVertex = { pts[2], color }; |
| 90 | if (indexed) { |
| 91 | int prevIdx = (uint16_t) (lines.nextVertex - lines.vertices - 1); |
| 92 | if (prevIdx > subpathLineIdxStart) { |
| 93 | append_contour_edge_indices(subpathLineIdxStart, prevIdx, lines); |
| 94 | } |
| 95 | } |
| 96 | lines.nextVertex++; |
| 97 | |
| 98 | SkASSERT(quads.nextVertex + 2 < quads.verticesEnd); |
| 99 | // the texture coordinates are drawn from the Loop-Blinn rendering algorithm |
| 100 | *(quads.nextVertex++) = { pts[0], SkPoint::Make(0.0, 0.0), color }; |
| 101 | *(quads.nextVertex++) = { pts[1], SkPoint::Make(0.5, 0.0), color }; |
| 102 | *(quads.nextVertex++) = { pts[2], SkPoint::Make(1.0, 1.0), color }; |
| 103 | if (indexed) { |
| 104 | uint16_t offset = (uint16_t) (quads.nextVertex - quads.vertices) - 3; |
| 105 | *(quads.nextIndex++) = offset++; |
| 106 | *(quads.nextIndex++) = offset++; |
| 107 | *(quads.nextIndex++) = offset++; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | class MSAAQuadProcessor : public GrGeometryProcessor { |
| 112 | public: |
| 113 | static GrGeometryProcessor* Create(const SkMatrix& viewMatrix) { |
| 114 | return new MSAAQuadProcessor(viewMatrix); |
| 115 | } |
| 116 | |
| 117 | virtual ~MSAAQuadProcessor() {} |
| 118 | |
| 119 | const char* name() const override { return "MSAAQuadProcessor"; } |
| 120 | |
| 121 | const Attribute* inPosition() const { return fInPosition; } |
| 122 | const Attribute* inUV() const { return fInUV; } |
| 123 | const Attribute* inColor() const { return fInColor; } |
| 124 | const SkMatrix& viewMatrix() const { return fViewMatrix; } |
| 125 | const SkMatrix& localMatrix() const { return SkMatrix::I(); } |
| 126 | |
| 127 | class GLSLProcessor : public GrGLSLGeometryProcessor { |
| 128 | public: |
| 129 | GLSLProcessor(const GrGeometryProcessor& qpr) {} |
| 130 | |
| 131 | void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
| 132 | const MSAAQuadProcessor& qp = args.fGP.cast<MSAAQuadProcessor>(); |
| 133 | GrGLSLVertexBuilder* vsBuilder = args.fVertBuilder; |
| 134 | GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; |
| 135 | GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
| 136 | |
| 137 | // emit attributes |
| 138 | varyingHandler->emitAttributes(qp); |
| 139 | varyingHandler->addPassThroughAttribute(qp.inColor(), args.fOutputColor); |
| 140 | |
| 141 | GrGLSLVertToFrag uv(kVec2f_GrSLType); |
| 142 | varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); |
| 143 | vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName); |
| 144 | |
| 145 | // Setup position |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 146 | this->setupPosition(vsBuilder, uniformHandler, gpArgs, qp.inPosition()->fName, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 147 | qp.viewMatrix(), &fViewMatrixUniform); |
| 148 | |
| 149 | // emit transforms |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 150 | this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpArgs->fPositionVar, |
| 151 | qp.inPosition()->fName, SkMatrix::I(), args.fTransformsIn, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 152 | args.fTransformsOut); |
| 153 | |
| 154 | GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 155 | fsBuilder->codeAppendf("if (%s.x * %s.x >= %s.y) discard;", uv.fsIn(), uv.fsIn(), |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 156 | uv.fsIn()); |
| 157 | fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputCoverage); |
| 158 | } |
| 159 | |
| 160 | static inline void GenKey(const GrGeometryProcessor& gp, |
| 161 | const GrGLSLCaps&, |
| 162 | GrProcessorKeyBuilder* b) { |
| 163 | const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); |
| 164 | uint32_t key = 0; |
| 165 | key |= qp.viewMatrix().hasPerspective() ? 0x1 : 0x0; |
| 166 | key |= qp.viewMatrix().isIdentity() ? 0x2: 0x0; |
| 167 | b->add32(key); |
| 168 | } |
| 169 | |
| 170 | virtual void setData(const GrGLSLProgramDataManager& pdman, |
| 171 | const GrPrimitiveProcessor& gp) override { |
| 172 | const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); |
| 173 | if (!qp.viewMatrix().isIdentity()) { |
| 174 | float viewMatrix[3 * 3]; |
| 175 | GrGLSLGetMatrix<3>(viewMatrix, qp.viewMatrix()); |
| 176 | pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void setTransformData(const GrPrimitiveProcessor& primProc, |
| 181 | const GrGLSLProgramDataManager& pdman, |
| 182 | int index, |
| 183 | const SkTArray<const GrCoordTransform*, true>& transforms) override { |
| 184 | this->setTransformDataHelper<MSAAQuadProcessor>(primProc, pdman, index, transforms); |
| 185 | } |
| 186 | |
| 187 | private: |
| 188 | typedef GrGLSLGeometryProcessor INHERITED; |
| 189 | |
| 190 | UniformHandle fViewMatrixUniform; |
| 191 | }; |
| 192 | |
| 193 | virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, |
| 194 | GrProcessorKeyBuilder* b) const override { |
| 195 | GLSLProcessor::GenKey(*this, caps, b); |
| 196 | } |
| 197 | |
| 198 | virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { |
| 199 | return new GLSLProcessor(*this); |
| 200 | } |
| 201 | |
| 202 | private: |
| 203 | MSAAQuadProcessor(const SkMatrix& viewMatrix) |
| 204 | : fViewMatrix(viewMatrix) { |
| 205 | this->initClassID<MSAAQuadProcessor>(); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 206 | fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 207 | kHigh_GrSLPrecision)); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 208 | fInUV = &this->addVertexAttrib(Attribute("inUV", kVec2f_GrVertexAttribType, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 209 | kHigh_GrSLPrecision)); |
| 210 | fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType)); |
| 211 | this->setSampleShading(1.0f); |
| 212 | } |
| 213 | |
| 214 | const Attribute* fInPosition; |
| 215 | const Attribute* fInUV; |
| 216 | const Attribute* fInColor; |
| 217 | SkMatrix fViewMatrix; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 218 | |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 219 | GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 220 | |
| 221 | typedef GrGeometryProcessor INHERITED; |
| 222 | }; |
| 223 | |
| 224 | class MSAAPathBatch : public GrVertexBatch { |
| 225 | public: |
| 226 | DEFINE_BATCH_CLASS_ID |
| 227 | |
bsalomon | 88cf17d | 2016-07-08 06:40:56 -0700 | [diff] [blame^] | 228 | MSAAPathBatch(GrColor color, const SkPath& path, const SkMatrix& viewMatrix) |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 229 | : INHERITED(ClassID()) |
| 230 | , fViewMatrix(viewMatrix) { |
| 231 | fPaths.emplace_back(PathInfo{color, path}); |
bsalomon | 88cf17d | 2016-07-08 06:40:56 -0700 | [diff] [blame^] | 232 | this->setTransformedBounds(path.getBounds(), viewMatrix, HasAABloat::kNo, IsZeroArea::kNo); |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 233 | int contourCount; |
| 234 | this->computeWorstCasePointCount(path, &contourCount, &fMaxLineVertices, &fMaxQuadVertices); |
| 235 | fMaxLineIndices = fMaxLineVertices * 3; |
| 236 | fMaxQuadIndices = fMaxQuadVertices * 3; |
| 237 | fIsIndexed = contourCount > 1; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | const char* name() const override { return "MSAAPathBatch"; } |
| 241 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 242 | void computePipelineOptimizations(GrInitInvariantOutput* color, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 243 | GrInitInvariantOutput* coverage, |
| 244 | GrBatchToXPOverrides* overrides) const override { |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 245 | // When this is called on a batch, there is only one path |
| 246 | color->setKnownFourComponents(fPaths[0].fColor); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 247 | coverage->setKnownSingleComponent(0xff); |
| 248 | } |
| 249 | |
| 250 | bool isValid() const { |
| 251 | return !fIsIndexed || fMaxLineIndices <= SK_MaxU16; |
| 252 | } |
| 253 | |
| 254 | private: |
| 255 | void initBatchTracker(const GrXPOverridesForBatch& overrides) override { |
| 256 | // Handle any color overrides |
| 257 | if (!overrides.readsColor()) { |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 258 | fPaths[0].fColor = GrColor_ILLEGAL; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 259 | } |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 260 | overrides.getOverrideColorIfSet(&fPaths[0].fColor); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 261 | } |
| 262 | |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 263 | void computeWorstCasePointCount(const SkPath& path, int* subpaths, int* outLinePointCount, |
| 264 | int* outQuadPointCount) const { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 265 | int linePointCount = 0; |
| 266 | int quadPointCount = 0; |
| 267 | *subpaths = 1; |
| 268 | |
| 269 | bool first = true; |
| 270 | |
| 271 | SkPath::Iter iter(path, false); |
| 272 | SkPath::Verb verb; |
| 273 | |
| 274 | SkPoint pts[4]; |
| 275 | while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { |
| 276 | switch (verb) { |
| 277 | case SkPath::kLine_Verb: |
| 278 | linePointCount += 1; |
| 279 | break; |
| 280 | case SkPath::kConic_Verb: { |
| 281 | SkScalar weight = iter.conicWeight(); |
| 282 | SkAutoConicToQuads converter; |
| 283 | converter.computeQuads(pts, weight, kTolerance); |
| 284 | int quadPts = converter.countQuads(); |
| 285 | linePointCount += quadPts; |
| 286 | quadPointCount += 3 * quadPts; |
| 287 | } |
| 288 | case SkPath::kQuad_Verb: |
| 289 | linePointCount += 1; |
| 290 | quadPointCount += 3; |
| 291 | break; |
| 292 | case SkPath::kCubic_Verb: { |
| 293 | SkSTArray<15, SkPoint, true> quadPts; |
| 294 | GrPathUtils::convertCubicToQuads(pts, kTolerance, &quadPts); |
| 295 | int count = quadPts.count(); |
| 296 | linePointCount += count / 3; |
| 297 | quadPointCount += count; |
| 298 | break; |
| 299 | } |
| 300 | case SkPath::kMove_Verb: |
| 301 | linePointCount += 1; |
| 302 | if (!first) { |
| 303 | ++(*subpaths); |
| 304 | } |
| 305 | break; |
| 306 | default: |
| 307 | break; |
| 308 | } |
| 309 | first = false; |
| 310 | } |
| 311 | *outLinePointCount = linePointCount; |
| 312 | *outQuadPointCount = quadPointCount; |
| 313 | } |
| 314 | |
| 315 | void onPrepareDraws(Target* target) const override { |
| 316 | SkASSERT(this->isValid()); |
| 317 | if (fMaxLineVertices == 0) { |
| 318 | SkASSERT(fMaxQuadVertices == 0); |
| 319 | return; |
| 320 | } |
| 321 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 322 | GrPrimitiveType primitiveType = fIsIndexed ? kTriangles_GrPrimitiveType |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 323 | : kTriangleFan_GrPrimitiveType; |
| 324 | |
| 325 | // allocate vertex / index buffers |
| 326 | const GrBuffer* lineVertexBuffer; |
| 327 | int firstLineVertex; |
| 328 | MSAALineVertices lines; |
| 329 | size_t lineVertexStride = sizeof(MSAALineVertices::Vertex); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 330 | lines.vertices = (MSAALineVertices::Vertex*) target->makeVertexSpace(lineVertexStride, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 331 | fMaxLineVertices, |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 332 | &lineVertexBuffer, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 333 | &firstLineVertex); |
| 334 | if (!lines.vertices) { |
| 335 | SkDebugf("Could not allocate vertices\n"); |
| 336 | return; |
| 337 | } |
| 338 | lines.nextVertex = lines.vertices; |
| 339 | SkDEBUGCODE(lines.verticesEnd = lines.vertices + fMaxLineVertices;) |
| 340 | |
| 341 | MSAAQuadVertices quads; |
| 342 | size_t quadVertexStride = sizeof(MSAAQuadVertices::Vertex); |
| 343 | SkAutoFree quadVertexPtr(sk_malloc_throw(fMaxQuadVertices * quadVertexStride)); |
| 344 | quads.vertices = (MSAAQuadVertices::Vertex*) quadVertexPtr.get(); |
| 345 | quads.nextVertex = quads.vertices; |
| 346 | SkDEBUGCODE(quads.verticesEnd = quads.vertices + fMaxQuadVertices;) |
| 347 | |
| 348 | const GrBuffer* lineIndexBuffer = nullptr; |
| 349 | int firstLineIndex; |
| 350 | if (fIsIndexed) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 351 | lines.indices = target->makeIndexSpace(fMaxLineIndices, &lineIndexBuffer, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 352 | &firstLineIndex); |
| 353 | if (!lines.indices) { |
| 354 | SkDebugf("Could not allocate indices\n"); |
| 355 | return; |
| 356 | } |
| 357 | lines.nextIndex = lines.indices; |
| 358 | } else { |
| 359 | lines.indices = nullptr; |
| 360 | lines.nextIndex = nullptr; |
| 361 | } |
| 362 | |
| 363 | SkAutoFree quadIndexPtr; |
| 364 | if (fIsIndexed) { |
| 365 | quads.indices = (uint16_t*) sk_malloc_throw(fMaxQuadIndices * sizeof(uint16_t)); |
| 366 | quadIndexPtr.set(quads.indices); |
| 367 | quads.nextIndex = quads.indices; |
| 368 | } else { |
| 369 | quads.indices = nullptr; |
| 370 | quads.nextIndex = nullptr; |
| 371 | } |
| 372 | |
| 373 | // fill buffers |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 374 | for (int i = 0; i < fPaths.count(); i++) { |
| 375 | const PathInfo& pathInfo = fPaths[i]; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 376 | |
| 377 | if (!this->createGeom(lines, |
| 378 | quads, |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 379 | pathInfo.fPath, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 380 | fViewMatrix, |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 381 | pathInfo.fColor, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 382 | fIsIndexed)) { |
| 383 | return; |
| 384 | } |
| 385 | } |
| 386 | int lineVertexOffset = (int) (lines.nextVertex - lines.vertices); |
| 387 | int lineIndexOffset = (int) (lines.nextIndex - lines.indices); |
| 388 | SkASSERT(lineVertexOffset <= fMaxLineVertices && lineIndexOffset <= fMaxLineIndices); |
| 389 | int quadVertexOffset = (int) (quads.nextVertex - quads.vertices); |
| 390 | int quadIndexOffset = (int) (quads.nextIndex - quads.indices); |
| 391 | SkASSERT(quadVertexOffset <= fMaxQuadVertices && quadIndexOffset <= fMaxQuadIndices); |
| 392 | |
| 393 | if (lineVertexOffset) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 394 | sk_sp<GrGeometryProcessor> lineGP; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 395 | { |
| 396 | using namespace GrDefaultGeoProcFactory; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 397 | lineGP = GrDefaultGeoProcFactory::Make(Color(Color::kAttribute_Type), |
| 398 | Coverage(255), |
| 399 | LocalCoords(LocalCoords::kUnused_Type), |
| 400 | fViewMatrix); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 401 | } |
| 402 | SkASSERT(lineVertexStride == lineGP->getVertexStride()); |
| 403 | |
| 404 | GrMesh lineMeshes; |
| 405 | if (fIsIndexed) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 406 | lineMeshes.initIndexed(primitiveType, lineVertexBuffer, lineIndexBuffer, |
| 407 | firstLineVertex, firstLineIndex, lineVertexOffset, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 408 | lineIndexOffset); |
| 409 | } else { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 410 | lineMeshes.init(primitiveType, lineVertexBuffer, firstLineVertex, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 411 | lineVertexOffset); |
| 412 | } |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 413 | target->draw(lineGP.get(), lineMeshes); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | if (quadVertexOffset) { |
| 417 | SkAutoTUnref<const GrGeometryProcessor> quadGP(MSAAQuadProcessor::Create(fViewMatrix)); |
| 418 | SkASSERT(quadVertexStride == quadGP->getVertexStride()); |
| 419 | |
| 420 | const GrBuffer* quadVertexBuffer; |
| 421 | int firstQuadVertex; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 422 | MSAAQuadVertices::Vertex* quadVertices = (MSAAQuadVertices::Vertex*) |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 423 | target->makeVertexSpace(quadVertexStride, quadVertexOffset, &quadVertexBuffer, |
| 424 | &firstQuadVertex); |
| 425 | memcpy(quadVertices, quads.vertices, quadVertexStride * quadVertexOffset); |
| 426 | GrMesh quadMeshes; |
| 427 | if (fIsIndexed) { |
| 428 | const GrBuffer* quadIndexBuffer; |
| 429 | int firstQuadIndex; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 430 | uint16_t* quadIndices = (uint16_t*) target->makeIndexSpace(quadIndexOffset, |
| 431 | &quadIndexBuffer, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 432 | &firstQuadIndex); |
| 433 | memcpy(quadIndices, quads.indices, sizeof(uint16_t) * quadIndexOffset); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 434 | quadMeshes.initIndexed(kTriangles_GrPrimitiveType, quadVertexBuffer, |
| 435 | quadIndexBuffer, firstQuadVertex, firstQuadIndex, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 436 | quadVertexOffset, quadIndexOffset); |
| 437 | } else { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 438 | quadMeshes.init(kTriangles_GrPrimitiveType, quadVertexBuffer, firstQuadVertex, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 439 | quadVertexOffset); |
| 440 | } |
| 441 | target->draw(quadGP, quadMeshes); |
| 442 | } |
| 443 | } |
| 444 | |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 445 | bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
| 446 | MSAAPathBatch* that = t->cast<MSAAPathBatch>(); |
| 447 | if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(), |
| 448 | that->bounds(), caps)) { |
| 449 | return false; |
| 450 | } |
| 451 | |
| 452 | if (!fViewMatrix.cheapEqualTo(that->fViewMatrix)) { |
| 453 | return false; |
| 454 | } |
| 455 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 456 | if ((fMaxLineIndices + that->fMaxLineIndices > SK_MaxU16) || |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 457 | (fMaxQuadIndices + that->fMaxQuadIndices > SK_MaxU16)) { |
| 458 | return false; |
| 459 | } |
| 460 | |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 461 | fPaths.push_back_n(that->fPaths.count(), that->fPaths.begin()); |
bsalomon | 88cf17d | 2016-07-08 06:40:56 -0700 | [diff] [blame^] | 462 | this->joinBounds(*that); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 463 | fIsIndexed = true; |
| 464 | fMaxLineVertices += that->fMaxLineVertices; |
| 465 | fMaxQuadVertices += that->fMaxQuadVertices; |
| 466 | fMaxLineIndices += that->fMaxLineIndices; |
| 467 | fMaxQuadIndices += that->fMaxQuadIndices; |
| 468 | return true; |
| 469 | } |
| 470 | |
| 471 | bool createGeom(MSAALineVertices& lines, |
| 472 | MSAAQuadVertices& quads, |
| 473 | const SkPath& path, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 474 | const SkMatrix& m, |
| 475 | SkColor color, |
| 476 | bool isIndexed) const { |
| 477 | { |
| 478 | uint16_t subpathIdxStart = (uint16_t) (lines.nextVertex - lines.vertices); |
| 479 | |
| 480 | SkPoint pts[4]; |
| 481 | |
| 482 | bool first = true; |
| 483 | SkPath::Iter iter(path, false); |
| 484 | |
| 485 | bool done = false; |
| 486 | while (!done) { |
| 487 | SkPath::Verb verb = iter.next(pts); |
| 488 | switch (verb) { |
| 489 | case SkPath::kMove_Verb: |
| 490 | if (!first) { |
| 491 | uint16_t currIdx = (uint16_t) (lines.nextVertex - lines.vertices); |
| 492 | subpathIdxStart = currIdx; |
| 493 | } |
| 494 | SkASSERT(lines.nextVertex < lines.verticesEnd); |
| 495 | *(lines.nextVertex++) = { pts[0], color }; |
| 496 | break; |
| 497 | case SkPath::kLine_Verb: |
| 498 | if (isIndexed) { |
| 499 | uint16_t prevIdx = (uint16_t) (lines.nextVertex - lines.vertices - 1); |
| 500 | if (prevIdx > subpathIdxStart) { |
| 501 | append_contour_edge_indices(subpathIdxStart, prevIdx, lines); |
| 502 | } |
| 503 | } |
| 504 | SkASSERT(lines.nextVertex < lines.verticesEnd); |
| 505 | *(lines.nextVertex++) = { pts[1], color }; |
| 506 | break; |
| 507 | case SkPath::kConic_Verb: { |
| 508 | SkScalar weight = iter.conicWeight(); |
| 509 | SkAutoConicToQuads converter; |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 510 | const SkPoint* quadPts = converter.computeQuads(pts, weight, kTolerance); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 511 | for (int i = 0; i < converter.countQuads(); ++i) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 512 | add_quad(lines, quads, quadPts + i * 2, color, isIndexed, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 513 | subpathIdxStart); |
| 514 | } |
| 515 | break; |
| 516 | } |
| 517 | case SkPath::kQuad_Verb: { |
| 518 | add_quad(lines, quads, pts, color, isIndexed, subpathIdxStart); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 519 | break; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 520 | } |
| 521 | case SkPath::kCubic_Verb: { |
| 522 | SkSTArray<15, SkPoint, true> quadPts; |
| 523 | GrPathUtils::convertCubicToQuads(pts, kTolerance, &quadPts); |
| 524 | int count = quadPts.count(); |
| 525 | for (int i = 0; i < count; i += 3) { |
| 526 | add_quad(lines, quads, &quadPts[i], color, isIndexed, subpathIdxStart); |
| 527 | } |
| 528 | break; |
| 529 | } |
| 530 | case SkPath::kClose_Verb: |
| 531 | break; |
| 532 | case SkPath::kDone_Verb: |
| 533 | done = true; |
| 534 | } |
| 535 | first = false; |
| 536 | } |
| 537 | } |
| 538 | return true; |
| 539 | } |
| 540 | |
bsalomon | 50c56a3 | 2016-06-30 12:05:32 -0700 | [diff] [blame] | 541 | struct PathInfo { |
| 542 | GrColor fColor; |
| 543 | SkPath fPath; |
| 544 | }; |
| 545 | |
| 546 | SkSTArray<1, PathInfo, true> fPaths; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 547 | |
| 548 | SkMatrix fViewMatrix; |
| 549 | int fMaxLineVertices; |
| 550 | int fMaxQuadVertices; |
| 551 | int fMaxLineIndices; |
| 552 | int fMaxQuadIndices; |
| 553 | bool fIsIndexed; |
| 554 | |
| 555 | typedef GrVertexBatch INHERITED; |
| 556 | }; |
| 557 | |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 558 | bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, |
| 559 | const GrPaint& paint, |
| 560 | const GrUserStencilSettings* userStencilSettings, |
cdalton | 862cff3 | 2016-05-12 15:09:48 -0700 | [diff] [blame] | 561 | const GrClip& clip, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 562 | const SkMatrix& viewMatrix, |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 563 | const GrShape& shape, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 564 | bool stencilOnly) { |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 565 | SkASSERT(shape.style().isSimpleFill()); |
| 566 | SkPath path; |
| 567 | shape.asPath(&path); |
| 568 | |
cdalton | 93a379b | 2016-05-11 13:58:08 -0700 | [diff] [blame] | 569 | int passCount = 0; |
| 570 | const GrUserStencilSettings* passes[3]; |
| 571 | GrPipelineBuilder::DrawFace drawFace[3]; |
| 572 | bool reverse = false; |
| 573 | bool lastPassIsBounds; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 574 | |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 575 | if (single_pass_shape(shape)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 576 | passCount = 1; |
| 577 | if (stencilOnly) { |
| 578 | passes[0] = &gDirectToStencil; |
| 579 | } else { |
| 580 | passes[0] = nullptr; |
| 581 | } |
| 582 | drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
| 583 | lastPassIsBounds = false; |
| 584 | } else { |
| 585 | switch (path.getFillType()) { |
| 586 | case SkPath::kInverseEvenOdd_FillType: |
| 587 | reverse = true; |
| 588 | // fallthrough |
| 589 | case SkPath::kEvenOdd_FillType: |
| 590 | passes[0] = &gEOStencilPass; |
| 591 | if (stencilOnly) { |
| 592 | passCount = 1; |
| 593 | lastPassIsBounds = false; |
| 594 | } else { |
| 595 | passCount = 2; |
| 596 | lastPassIsBounds = true; |
| 597 | if (reverse) { |
| 598 | passes[1] = &gInvEOColorPass; |
| 599 | } else { |
| 600 | passes[1] = &gEOColorPass; |
| 601 | } |
| 602 | } |
| 603 | drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace; |
| 604 | break; |
| 605 | |
| 606 | case SkPath::kInverseWinding_FillType: |
| 607 | reverse = true; |
| 608 | // fallthrough |
| 609 | case SkPath::kWinding_FillType: |
| 610 | passes[0] = &gWindStencilSeparateWithWrap; |
| 611 | passCount = 2; |
| 612 | drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
| 613 | if (stencilOnly) { |
| 614 | lastPassIsBounds = false; |
| 615 | --passCount; |
| 616 | } else { |
| 617 | lastPassIsBounds = true; |
| 618 | drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace; |
| 619 | if (reverse) { |
| 620 | passes[passCount-1] = &gInvWindColorPass; |
| 621 | } else { |
| 622 | passes[passCount-1] = &gWindColorPass; |
| 623 | } |
| 624 | } |
| 625 | break; |
| 626 | default: |
| 627 | SkDEBUGFAIL("Unknown path fFill!"); |
| 628 | return false; |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | SkRect devBounds; |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 633 | GetPathDevBounds(path, drawContext->width(), drawContext->height(), viewMatrix, &devBounds); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 634 | |
| 635 | for (int p = 0; p < passCount; ++p) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 636 | if (lastPassIsBounds && (p == passCount-1)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 637 | SkRect bounds; |
| 638 | SkMatrix localMatrix = SkMatrix::I(); |
| 639 | if (reverse) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 640 | // draw over the dev bounds (which will be the whole dst surface for inv fill). |
| 641 | bounds = devBounds; |
| 642 | SkMatrix vmi; |
| 643 | // mapRect through persp matrix may not be correct |
| 644 | if (!viewMatrix.hasPerspective() && viewMatrix.invert(&vmi)) { |
| 645 | vmi.mapRect(&bounds); |
| 646 | } else { |
| 647 | if (!viewMatrix.invert(&localMatrix)) { |
| 648 | return false; |
| 649 | } |
| 650 | } |
| 651 | } else { |
| 652 | bounds = path.getBounds(); |
| 653 | } |
| 654 | const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() : |
| 655 | viewMatrix; |
| 656 | SkAutoTUnref<GrDrawBatch> batch( |
robertphillips | 3950f0d | 2016-07-07 07:33:13 -0700 | [diff] [blame] | 657 | GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 658 | &localMatrix)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 659 | |
csmartdalton | ecbc12b | 2016-06-08 10:08:43 -0700 | [diff] [blame] | 660 | GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 661 | pipelineBuilder.setDrawFace(drawFace[p]); |
| 662 | if (passes[p]) { |
| 663 | pipelineBuilder.setUserStencil(passes[p]); |
| 664 | } else { |
| 665 | pipelineBuilder.setUserStencil(userStencilSettings); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 666 | } |
| 667 | |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 668 | drawContext->drawBatch(pipelineBuilder, clip, batch); |
| 669 | } else { |
bsalomon | 88cf17d | 2016-07-08 06:40:56 -0700 | [diff] [blame^] | 670 | SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor(), path, |
| 671 | viewMatrix)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 672 | if (!batch->isValid()) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 673 | return false; |
| 674 | } |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 675 | |
csmartdalton | ecbc12b | 2016-06-08 10:08:43 -0700 | [diff] [blame] | 676 | GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 677 | pipelineBuilder.setDrawFace(drawFace[p]); |
| 678 | if (passes[p]) { |
| 679 | pipelineBuilder.setUserStencil(passes[p]); |
| 680 | } else { |
| 681 | pipelineBuilder.setUserStencil(userStencilSettings); |
| 682 | } |
| 683 | if (passCount > 1) { |
| 684 | pipelineBuilder.setDisableColorXPFactory(); |
| 685 | } |
| 686 | |
| 687 | drawContext->drawBatch(pipelineBuilder, clip, batch); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 688 | } |
| 689 | } |
| 690 | return true; |
| 691 | } |
| 692 | |
| 693 | bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
bsalomon | ee43241 | 2016-06-27 07:18:18 -0700 | [diff] [blame] | 694 | // This path renderer only fills and relies on MSAA for antialiasing. Stroked shapes are |
| 695 | // handled by passing on the original shape and letting the caller compute the stroked shape |
| 696 | // which will have a fill style. |
| 697 | return args.fShape->style().isSimpleFill() && !args.fAntiAlias; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) { |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 701 | GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 702 | "GrMSAAPathRenderer::onDrawPath"); |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 703 | SkTLazy<GrShape> tmpShape; |
| 704 | const GrShape* shape = args.fShape; |
| 705 | if (shape->style().applies()) { |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 706 | SkScalar styleScale = GrStyle::MatrixToScaleFactor(*args.fViewMatrix); |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 707 | tmpShape.init(args.fShape->applyStyle(GrStyle::Apply::kPathEffectAndStrokeRec, styleScale)); |
| 708 | shape = tmpShape.get(); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 709 | } |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 710 | return this->internalDrawPath(args.fDrawContext, |
| 711 | *args.fPaint, |
| 712 | args.fUserStencilSettings, |
cdalton | 862cff3 | 2016-05-12 15:09:48 -0700 | [diff] [blame] | 713 | *args.fClip, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 714 | *args.fViewMatrix, |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 715 | *shape, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 716 | false); |
| 717 | } |
| 718 | |
| 719 | void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) { |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 720 | GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 721 | "GrMSAAPathRenderer::onStencilPath"); |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 722 | SkASSERT(args.fShape->style().isSimpleFill()); |
| 723 | SkASSERT(!args.fShape->mayBeInverseFilledAfterStyling()); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 724 | |
| 725 | GrPaint paint; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 726 | paint.setXPFactory(GrDisableColorXPFactory::Make()); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 727 | paint.setAntiAlias(args.fIsAA); |
| 728 | |
bsalomon | 8acedde | 2016-06-24 10:42:16 -0700 | [diff] [blame] | 729 | this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUnused, *args.fClip, |
robertphillips | 3950f0d | 2016-07-07 07:33:13 -0700 | [diff] [blame] | 730 | *args.fViewMatrix, *args.fShape, true); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 731 | } |
| 732 | |
| 733 | /////////////////////////////////////////////////////////////////////////////////////////////////// |