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 | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 34 | static inline bool single_pass_path(const SkPath& path) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 35 | if (!path.isInverseFillType()) { |
| 36 | return path.isConvex(); |
| 37 | } |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | GrPathRenderer::StencilSupport |
bsalomon | d6f25bf | 2016-05-05 09:26:21 -0700 | [diff] [blame] | 42 | GrMSAAPathRenderer::onGetStencilSupport(const SkPath& path) const { |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 43 | if (single_pass_path(path)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 44 | return GrPathRenderer::kNoRestriction_StencilSupport; |
| 45 | } else { |
| 46 | return GrPathRenderer::kStencilOnly_StencilSupport; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | struct MSAALineVertices { |
| 51 | struct Vertex { |
| 52 | SkPoint fPosition; |
| 53 | SkColor fColor; |
| 54 | }; |
| 55 | Vertex* vertices; |
| 56 | Vertex* nextVertex; |
| 57 | #ifdef SK_DEBUG |
| 58 | Vertex* verticesEnd; |
| 59 | #endif |
| 60 | uint16_t* indices; |
| 61 | uint16_t* nextIndex; |
| 62 | }; |
| 63 | |
| 64 | struct MSAAQuadVertices { |
| 65 | struct Vertex { |
| 66 | SkPoint fPosition; |
| 67 | SkPoint fUV; |
| 68 | SkColor fColor; |
| 69 | }; |
| 70 | Vertex* vertices; |
| 71 | Vertex* nextVertex; |
| 72 | #ifdef SK_DEBUG |
| 73 | Vertex* verticesEnd; |
| 74 | #endif |
| 75 | uint16_t* indices; |
| 76 | uint16_t* nextIndex; |
| 77 | }; |
| 78 | |
| 79 | static inline void append_contour_edge_indices(uint16_t fanCenterIdx, |
| 80 | uint16_t edgeV0Idx, |
| 81 | MSAALineVertices& lines) { |
| 82 | *(lines.nextIndex++) = fanCenterIdx; |
| 83 | *(lines.nextIndex++) = edgeV0Idx; |
| 84 | *(lines.nextIndex++) = edgeV0Idx + 1; |
| 85 | } |
| 86 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 87 | static inline void add_quad(MSAALineVertices& lines, MSAAQuadVertices& quads, const SkPoint pts[], |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 88 | SkColor color, bool indexed, uint16_t subpathLineIdxStart) { |
| 89 | SkASSERT(lines.nextVertex < lines.verticesEnd); |
| 90 | *lines.nextVertex = { pts[2], color }; |
| 91 | if (indexed) { |
| 92 | int prevIdx = (uint16_t) (lines.nextVertex - lines.vertices - 1); |
| 93 | if (prevIdx > subpathLineIdxStart) { |
| 94 | append_contour_edge_indices(subpathLineIdxStart, prevIdx, lines); |
| 95 | } |
| 96 | } |
| 97 | lines.nextVertex++; |
| 98 | |
| 99 | SkASSERT(quads.nextVertex + 2 < quads.verticesEnd); |
| 100 | // the texture coordinates are drawn from the Loop-Blinn rendering algorithm |
| 101 | *(quads.nextVertex++) = { pts[0], SkPoint::Make(0.0, 0.0), color }; |
| 102 | *(quads.nextVertex++) = { pts[1], SkPoint::Make(0.5, 0.0), color }; |
| 103 | *(quads.nextVertex++) = { pts[2], SkPoint::Make(1.0, 1.0), color }; |
| 104 | if (indexed) { |
| 105 | uint16_t offset = (uint16_t) (quads.nextVertex - quads.vertices) - 3; |
| 106 | *(quads.nextIndex++) = offset++; |
| 107 | *(quads.nextIndex++) = offset++; |
| 108 | *(quads.nextIndex++) = offset++; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | class MSAAQuadProcessor : public GrGeometryProcessor { |
| 113 | public: |
| 114 | static GrGeometryProcessor* Create(const SkMatrix& viewMatrix) { |
| 115 | return new MSAAQuadProcessor(viewMatrix); |
| 116 | } |
| 117 | |
| 118 | virtual ~MSAAQuadProcessor() {} |
| 119 | |
| 120 | const char* name() const override { return "MSAAQuadProcessor"; } |
| 121 | |
| 122 | const Attribute* inPosition() const { return fInPosition; } |
| 123 | const Attribute* inUV() const { return fInUV; } |
| 124 | const Attribute* inColor() const { return fInColor; } |
| 125 | const SkMatrix& viewMatrix() const { return fViewMatrix; } |
| 126 | const SkMatrix& localMatrix() const { return SkMatrix::I(); } |
| 127 | |
| 128 | class GLSLProcessor : public GrGLSLGeometryProcessor { |
| 129 | public: |
| 130 | GLSLProcessor(const GrGeometryProcessor& qpr) {} |
| 131 | |
| 132 | void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { |
| 133 | const MSAAQuadProcessor& qp = args.fGP.cast<MSAAQuadProcessor>(); |
| 134 | GrGLSLVertexBuilder* vsBuilder = args.fVertBuilder; |
| 135 | GrGLSLVaryingHandler* varyingHandler = args.fVaryingHandler; |
| 136 | GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
| 137 | |
| 138 | // emit attributes |
| 139 | varyingHandler->emitAttributes(qp); |
| 140 | varyingHandler->addPassThroughAttribute(qp.inColor(), args.fOutputColor); |
| 141 | |
| 142 | GrGLSLVertToFrag uv(kVec2f_GrSLType); |
| 143 | varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); |
| 144 | vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName); |
| 145 | |
| 146 | // Setup position |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 147 | this->setupPosition(vsBuilder, uniformHandler, gpArgs, qp.inPosition()->fName, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 148 | qp.viewMatrix(), &fViewMatrixUniform); |
| 149 | |
| 150 | // emit transforms |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 151 | this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpArgs->fPositionVar, |
| 152 | qp.inPosition()->fName, SkMatrix::I(), args.fTransformsIn, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 153 | args.fTransformsOut); |
| 154 | |
| 155 | GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 156 | 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] | 157 | uv.fsIn()); |
| 158 | fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputCoverage); |
| 159 | } |
| 160 | |
| 161 | static inline void GenKey(const GrGeometryProcessor& gp, |
| 162 | const GrGLSLCaps&, |
| 163 | GrProcessorKeyBuilder* b) { |
| 164 | const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); |
| 165 | uint32_t key = 0; |
| 166 | key |= qp.viewMatrix().hasPerspective() ? 0x1 : 0x0; |
| 167 | key |= qp.viewMatrix().isIdentity() ? 0x2: 0x0; |
| 168 | b->add32(key); |
| 169 | } |
| 170 | |
| 171 | virtual void setData(const GrGLSLProgramDataManager& pdman, |
| 172 | const GrPrimitiveProcessor& gp) override { |
| 173 | const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); |
| 174 | if (!qp.viewMatrix().isIdentity()) { |
| 175 | float viewMatrix[3 * 3]; |
| 176 | GrGLSLGetMatrix<3>(viewMatrix, qp.viewMatrix()); |
| 177 | pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | void setTransformData(const GrPrimitiveProcessor& primProc, |
| 182 | const GrGLSLProgramDataManager& pdman, |
| 183 | int index, |
| 184 | const SkTArray<const GrCoordTransform*, true>& transforms) override { |
| 185 | this->setTransformDataHelper<MSAAQuadProcessor>(primProc, pdman, index, transforms); |
| 186 | } |
| 187 | |
| 188 | private: |
| 189 | typedef GrGLSLGeometryProcessor INHERITED; |
| 190 | |
| 191 | UniformHandle fViewMatrixUniform; |
| 192 | }; |
| 193 | |
| 194 | virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, |
| 195 | GrProcessorKeyBuilder* b) const override { |
| 196 | GLSLProcessor::GenKey(*this, caps, b); |
| 197 | } |
| 198 | |
| 199 | virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { |
| 200 | return new GLSLProcessor(*this); |
| 201 | } |
| 202 | |
| 203 | private: |
| 204 | MSAAQuadProcessor(const SkMatrix& viewMatrix) |
| 205 | : fViewMatrix(viewMatrix) { |
| 206 | this->initClassID<MSAAQuadProcessor>(); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 207 | fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertexAttribType, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 208 | kHigh_GrSLPrecision)); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 209 | fInUV = &this->addVertexAttrib(Attribute("inUV", kVec2f_GrVertexAttribType, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 210 | kHigh_GrSLPrecision)); |
| 211 | fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType)); |
| 212 | this->setSampleShading(1.0f); |
| 213 | } |
| 214 | |
| 215 | const Attribute* fInPosition; |
| 216 | const Attribute* fInUV; |
| 217 | const Attribute* fInColor; |
| 218 | SkMatrix fViewMatrix; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 219 | |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 220 | GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
| 221 | |
| 222 | typedef GrGeometryProcessor INHERITED; |
| 223 | }; |
| 224 | |
| 225 | class MSAAPathBatch : public GrVertexBatch { |
| 226 | public: |
| 227 | DEFINE_BATCH_CLASS_ID |
| 228 | |
| 229 | struct Geometry { |
| 230 | GrColor fColor; |
| 231 | SkPath fPath; |
| 232 | SkScalar fTolerance; |
| 233 | }; |
| 234 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 235 | static MSAAPathBatch* Create(const Geometry& geometry, const SkMatrix& viewMatrix, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 236 | const SkRect& devBounds) { |
| 237 | return new MSAAPathBatch(geometry, viewMatrix, devBounds); |
| 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 { |
| 245 | // When this is called on a batch, there is only one geometry bundle |
| 246 | color->setKnownFourComponents(fGeoData[0].fColor); |
| 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()) { |
| 258 | fGeoData[0].fColor = GrColor_ILLEGAL; |
| 259 | } |
| 260 | overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 261 | } |
| 262 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 263 | void computeWorstCasePointCount(const SkPath& path, int* subpaths, SkScalar tol, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 264 | int* outLinePointCount, int* outQuadPointCount) const { |
| 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 |
| 374 | for (int i = 0; i < fGeoData.count(); i++) { |
| 375 | const Geometry& args = fGeoData[i]; |
| 376 | |
| 377 | if (!this->createGeom(lines, |
| 378 | quads, |
| 379 | args.fPath, |
| 380 | args.fTolerance, |
| 381 | fViewMatrix, |
| 382 | args.fColor, |
| 383 | fIsIndexed)) { |
| 384 | return; |
| 385 | } |
| 386 | } |
| 387 | int lineVertexOffset = (int) (lines.nextVertex - lines.vertices); |
| 388 | int lineIndexOffset = (int) (lines.nextIndex - lines.indices); |
| 389 | SkASSERT(lineVertexOffset <= fMaxLineVertices && lineIndexOffset <= fMaxLineIndices); |
| 390 | int quadVertexOffset = (int) (quads.nextVertex - quads.vertices); |
| 391 | int quadIndexOffset = (int) (quads.nextIndex - quads.indices); |
| 392 | SkASSERT(quadVertexOffset <= fMaxQuadVertices && quadIndexOffset <= fMaxQuadIndices); |
| 393 | |
| 394 | if (lineVertexOffset) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 395 | sk_sp<GrGeometryProcessor> lineGP; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 396 | { |
| 397 | using namespace GrDefaultGeoProcFactory; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 398 | lineGP = GrDefaultGeoProcFactory::Make(Color(Color::kAttribute_Type), |
| 399 | Coverage(255), |
| 400 | LocalCoords(LocalCoords::kUnused_Type), |
| 401 | fViewMatrix); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 402 | } |
| 403 | SkASSERT(lineVertexStride == lineGP->getVertexStride()); |
| 404 | |
| 405 | GrMesh lineMeshes; |
| 406 | if (fIsIndexed) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 407 | lineMeshes.initIndexed(primitiveType, lineVertexBuffer, lineIndexBuffer, |
| 408 | firstLineVertex, firstLineIndex, lineVertexOffset, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 409 | lineIndexOffset); |
| 410 | } else { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 411 | lineMeshes.init(primitiveType, lineVertexBuffer, firstLineVertex, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 412 | lineVertexOffset); |
| 413 | } |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 414 | target->draw(lineGP.get(), lineMeshes); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | if (quadVertexOffset) { |
| 418 | SkAutoTUnref<const GrGeometryProcessor> quadGP(MSAAQuadProcessor::Create(fViewMatrix)); |
| 419 | SkASSERT(quadVertexStride == quadGP->getVertexStride()); |
| 420 | |
| 421 | const GrBuffer* quadVertexBuffer; |
| 422 | int firstQuadVertex; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 423 | MSAAQuadVertices::Vertex* quadVertices = (MSAAQuadVertices::Vertex*) |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 424 | target->makeVertexSpace(quadVertexStride, quadVertexOffset, &quadVertexBuffer, |
| 425 | &firstQuadVertex); |
| 426 | memcpy(quadVertices, quads.vertices, quadVertexStride * quadVertexOffset); |
| 427 | GrMesh quadMeshes; |
| 428 | if (fIsIndexed) { |
| 429 | const GrBuffer* quadIndexBuffer; |
| 430 | int firstQuadIndex; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 431 | uint16_t* quadIndices = (uint16_t*) target->makeIndexSpace(quadIndexOffset, |
| 432 | &quadIndexBuffer, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 433 | &firstQuadIndex); |
| 434 | memcpy(quadIndices, quads.indices, sizeof(uint16_t) * quadIndexOffset); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 435 | quadMeshes.initIndexed(kTriangles_GrPrimitiveType, quadVertexBuffer, |
| 436 | quadIndexBuffer, firstQuadVertex, firstQuadIndex, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 437 | quadVertexOffset, quadIndexOffset); |
| 438 | } else { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 439 | quadMeshes.init(kTriangles_GrPrimitiveType, quadVertexBuffer, firstQuadVertex, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 440 | quadVertexOffset); |
| 441 | } |
| 442 | target->draw(quadGP, quadMeshes); |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |
| 447 | |
| 448 | MSAAPathBatch(const Geometry& geometry, const SkMatrix& viewMatrix, const SkRect& devBounds) |
| 449 | : INHERITED(ClassID()) |
| 450 | , fViewMatrix(viewMatrix) { |
| 451 | fGeoData.push_back(geometry); |
| 452 | this->setBounds(devBounds); |
| 453 | int contourCount; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 454 | this->computeWorstCasePointCount(geometry.fPath, &contourCount, kTolerance, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 455 | &fMaxLineVertices, &fMaxQuadVertices); |
| 456 | fMaxLineIndices = fMaxLineVertices * 3; |
| 457 | fMaxQuadIndices = fMaxQuadVertices * 3; |
| 458 | fIsIndexed = contourCount > 1; |
| 459 | } |
| 460 | |
| 461 | bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
| 462 | MSAAPathBatch* that = t->cast<MSAAPathBatch>(); |
| 463 | if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(), |
| 464 | that->bounds(), caps)) { |
| 465 | return false; |
| 466 | } |
| 467 | |
| 468 | if (!fViewMatrix.cheapEqualTo(that->fViewMatrix)) { |
| 469 | return false; |
| 470 | } |
| 471 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 472 | if ((fMaxLineIndices + that->fMaxLineIndices > SK_MaxU16) || |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 473 | (fMaxQuadIndices + that->fMaxQuadIndices > SK_MaxU16)) { |
| 474 | return false; |
| 475 | } |
| 476 | |
| 477 | fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin()); |
| 478 | this->joinBounds(that->bounds()); |
| 479 | fIsIndexed = true; |
| 480 | fMaxLineVertices += that->fMaxLineVertices; |
| 481 | fMaxQuadVertices += that->fMaxQuadVertices; |
| 482 | fMaxLineIndices += that->fMaxLineIndices; |
| 483 | fMaxQuadIndices += that->fMaxQuadIndices; |
| 484 | return true; |
| 485 | } |
| 486 | |
| 487 | bool createGeom(MSAALineVertices& lines, |
| 488 | MSAAQuadVertices& quads, |
| 489 | const SkPath& path, |
| 490 | SkScalar srcSpaceTol, |
| 491 | const SkMatrix& m, |
| 492 | SkColor color, |
| 493 | bool isIndexed) const { |
| 494 | { |
| 495 | uint16_t subpathIdxStart = (uint16_t) (lines.nextVertex - lines.vertices); |
| 496 | |
| 497 | SkPoint pts[4]; |
| 498 | |
| 499 | bool first = true; |
| 500 | SkPath::Iter iter(path, false); |
| 501 | |
| 502 | bool done = false; |
| 503 | while (!done) { |
| 504 | SkPath::Verb verb = iter.next(pts); |
| 505 | switch (verb) { |
| 506 | case SkPath::kMove_Verb: |
| 507 | if (!first) { |
| 508 | uint16_t currIdx = (uint16_t) (lines.nextVertex - lines.vertices); |
| 509 | subpathIdxStart = currIdx; |
| 510 | } |
| 511 | SkASSERT(lines.nextVertex < lines.verticesEnd); |
| 512 | *(lines.nextVertex++) = { pts[0], color }; |
| 513 | break; |
| 514 | case SkPath::kLine_Verb: |
| 515 | if (isIndexed) { |
| 516 | uint16_t prevIdx = (uint16_t) (lines.nextVertex - lines.vertices - 1); |
| 517 | if (prevIdx > subpathIdxStart) { |
| 518 | append_contour_edge_indices(subpathIdxStart, prevIdx, lines); |
| 519 | } |
| 520 | } |
| 521 | SkASSERT(lines.nextVertex < lines.verticesEnd); |
| 522 | *(lines.nextVertex++) = { pts[1], color }; |
| 523 | break; |
| 524 | case SkPath::kConic_Verb: { |
| 525 | SkScalar weight = iter.conicWeight(); |
| 526 | SkAutoConicToQuads converter; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 527 | const SkPoint* quadPts = converter.computeQuads(pts, weight, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 528 | kTolerance); |
| 529 | for (int i = 0; i < converter.countQuads(); ++i) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 530 | add_quad(lines, quads, quadPts + i * 2, color, isIndexed, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 531 | subpathIdxStart); |
| 532 | } |
| 533 | break; |
| 534 | } |
| 535 | case SkPath::kQuad_Verb: { |
| 536 | add_quad(lines, quads, pts, color, isIndexed, subpathIdxStart); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 537 | break; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 538 | } |
| 539 | case SkPath::kCubic_Verb: { |
| 540 | SkSTArray<15, SkPoint, true> quadPts; |
| 541 | GrPathUtils::convertCubicToQuads(pts, kTolerance, &quadPts); |
| 542 | int count = quadPts.count(); |
| 543 | for (int i = 0; i < count; i += 3) { |
| 544 | add_quad(lines, quads, &quadPts[i], color, isIndexed, subpathIdxStart); |
| 545 | } |
| 546 | break; |
| 547 | } |
| 548 | case SkPath::kClose_Verb: |
| 549 | break; |
| 550 | case SkPath::kDone_Verb: |
| 551 | done = true; |
| 552 | } |
| 553 | first = false; |
| 554 | } |
| 555 | } |
| 556 | return true; |
| 557 | } |
| 558 | |
| 559 | SkSTArray<1, Geometry, true> fGeoData; |
| 560 | |
| 561 | SkMatrix fViewMatrix; |
| 562 | int fMaxLineVertices; |
| 563 | int fMaxQuadVertices; |
| 564 | int fMaxLineIndices; |
| 565 | int fMaxQuadIndices; |
| 566 | bool fIsIndexed; |
| 567 | |
| 568 | typedef GrVertexBatch INHERITED; |
| 569 | }; |
| 570 | |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 571 | bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext, |
| 572 | const GrPaint& paint, |
| 573 | const GrUserStencilSettings* userStencilSettings, |
cdalton | 862cff3 | 2016-05-12 15:09:48 -0700 | [diff] [blame] | 574 | const GrClip& clip, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 575 | GrColor color, |
| 576 | const SkMatrix& viewMatrix, |
| 577 | const SkPath& path, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 578 | bool stencilOnly) { |
cdalton | 93a379b | 2016-05-11 13:58:08 -0700 | [diff] [blame] | 579 | int passCount = 0; |
| 580 | const GrUserStencilSettings* passes[3]; |
| 581 | GrPipelineBuilder::DrawFace drawFace[3]; |
| 582 | bool reverse = false; |
| 583 | bool lastPassIsBounds; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 584 | |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 585 | if (single_pass_path(path)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 586 | passCount = 1; |
| 587 | if (stencilOnly) { |
| 588 | passes[0] = &gDirectToStencil; |
| 589 | } else { |
| 590 | passes[0] = nullptr; |
| 591 | } |
| 592 | drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
| 593 | lastPassIsBounds = false; |
| 594 | } else { |
| 595 | switch (path.getFillType()) { |
| 596 | case SkPath::kInverseEvenOdd_FillType: |
| 597 | reverse = true; |
| 598 | // fallthrough |
| 599 | case SkPath::kEvenOdd_FillType: |
| 600 | passes[0] = &gEOStencilPass; |
| 601 | if (stencilOnly) { |
| 602 | passCount = 1; |
| 603 | lastPassIsBounds = false; |
| 604 | } else { |
| 605 | passCount = 2; |
| 606 | lastPassIsBounds = true; |
| 607 | if (reverse) { |
| 608 | passes[1] = &gInvEOColorPass; |
| 609 | } else { |
| 610 | passes[1] = &gEOColorPass; |
| 611 | } |
| 612 | } |
| 613 | drawFace[0] = drawFace[1] = GrPipelineBuilder::kBoth_DrawFace; |
| 614 | break; |
| 615 | |
| 616 | case SkPath::kInverseWinding_FillType: |
| 617 | reverse = true; |
| 618 | // fallthrough |
| 619 | case SkPath::kWinding_FillType: |
| 620 | passes[0] = &gWindStencilSeparateWithWrap; |
| 621 | passCount = 2; |
| 622 | drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
| 623 | if (stencilOnly) { |
| 624 | lastPassIsBounds = false; |
| 625 | --passCount; |
| 626 | } else { |
| 627 | lastPassIsBounds = true; |
| 628 | drawFace[passCount-1] = GrPipelineBuilder::kBoth_DrawFace; |
| 629 | if (reverse) { |
| 630 | passes[passCount-1] = &gInvWindColorPass; |
| 631 | } else { |
| 632 | passes[passCount-1] = &gWindColorPass; |
| 633 | } |
| 634 | } |
| 635 | break; |
| 636 | default: |
| 637 | SkDEBUGFAIL("Unknown path fFill!"); |
| 638 | return false; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | SkRect devBounds; |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 643 | GetPathDevBounds(path, drawContext->width(), drawContext->height(), viewMatrix, &devBounds); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 644 | |
| 645 | for (int p = 0; p < passCount; ++p) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 646 | if (lastPassIsBounds && (p == passCount-1)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 647 | SkRect bounds; |
| 648 | SkMatrix localMatrix = SkMatrix::I(); |
| 649 | if (reverse) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 650 | // draw over the dev bounds (which will be the whole dst surface for inv fill). |
| 651 | bounds = devBounds; |
| 652 | SkMatrix vmi; |
| 653 | // mapRect through persp matrix may not be correct |
| 654 | if (!viewMatrix.hasPerspective() && viewMatrix.invert(&vmi)) { |
| 655 | vmi.mapRect(&bounds); |
| 656 | } else { |
| 657 | if (!viewMatrix.invert(&localMatrix)) { |
| 658 | return false; |
| 659 | } |
| 660 | } |
| 661 | } else { |
| 662 | bounds = path.getBounds(); |
| 663 | } |
| 664 | const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() : |
| 665 | viewMatrix; |
| 666 | SkAutoTUnref<GrDrawBatch> batch( |
| 667 | GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr, |
| 668 | &localMatrix)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 669 | |
csmartdalton | ecbc12b | 2016-06-08 10:08:43 -0700 | [diff] [blame] | 670 | GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 671 | pipelineBuilder.setDrawFace(drawFace[p]); |
| 672 | if (passes[p]) { |
| 673 | pipelineBuilder.setUserStencil(passes[p]); |
| 674 | } else { |
| 675 | pipelineBuilder.setUserStencil(userStencilSettings); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 676 | } |
| 677 | |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 678 | drawContext->drawBatch(pipelineBuilder, clip, batch); |
| 679 | } else { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 680 | MSAAPathBatch::Geometry geometry; |
| 681 | geometry.fColor = color; |
| 682 | geometry.fPath = path; |
| 683 | geometry.fTolerance = kTolerance; |
| 684 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 685 | SkAutoTUnref<MSAAPathBatch> batch(MSAAPathBatch::Create(geometry, viewMatrix, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 686 | devBounds)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 687 | if (!batch->isValid()) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 688 | return false; |
| 689 | } |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 690 | |
csmartdalton | ecbc12b | 2016-06-08 10:08:43 -0700 | [diff] [blame] | 691 | GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint)); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 692 | pipelineBuilder.setDrawFace(drawFace[p]); |
| 693 | if (passes[p]) { |
| 694 | pipelineBuilder.setUserStencil(passes[p]); |
| 695 | } else { |
| 696 | pipelineBuilder.setUserStencil(userStencilSettings); |
| 697 | } |
| 698 | if (passCount > 1) { |
| 699 | pipelineBuilder.setDisableColorXPFactory(); |
| 700 | } |
| 701 | |
| 702 | drawContext->drawBatch(pipelineBuilder, clip, batch); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 703 | } |
| 704 | } |
| 705 | return true; |
| 706 | } |
| 707 | |
| 708 | bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 709 | // This path renderer does not support hairlines. We defer on anything that could be handled |
| 710 | // as a hairline by another path renderer. Also, arbitrary path effects could produce |
| 711 | // a hairline result. |
| 712 | return !IsStrokeHairlineOrEquivalent(*args.fStyle, *args.fViewMatrix, nullptr) && |
| 713 | !args.fStyle->strokeRec().isHairlineStyle() && |
| 714 | !args.fStyle->hasNonDashPathEffect() && !args.fAntiAlias; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 715 | } |
| 716 | |
| 717 | bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) { |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 718 | GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 719 | "GrMSAAPathRenderer::onDrawPath"); |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 720 | SkPath tmpPath; |
| 721 | const SkPath* path; |
| 722 | if (args.fStyle->applies()) { |
| 723 | SkStrokeRec::InitStyle fill; |
| 724 | SkScalar styleScale = GrStyle::MatrixToScaleFactor(*args.fViewMatrix); |
| 725 | if (!args.fStyle->applyToPath(&tmpPath, &fill, *args.fPath, styleScale)) { |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 726 | return false; |
| 727 | } |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 728 | // We don't accept styles that are hairlines or have path effects that could produce |
| 729 | // hairlines. |
| 730 | SkASSERT(SkStrokeRec::kFill_InitStyle == fill); |
| 731 | path = &tmpPath; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 732 | } else { |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 733 | path = args.fPath; |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 734 | } |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 735 | return this->internalDrawPath(args.fDrawContext, |
| 736 | *args.fPaint, |
| 737 | args.fUserStencilSettings, |
cdalton | 862cff3 | 2016-05-12 15:09:48 -0700 | [diff] [blame] | 738 | *args.fClip, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 739 | args.fColor, |
| 740 | *args.fViewMatrix, |
bsalomon | 6663acf | 2016-05-10 09:14:17 -0700 | [diff] [blame] | 741 | *path, |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 742 | false); |
| 743 | } |
| 744 | |
| 745 | void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) { |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 746 | GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 747 | "GrMSAAPathRenderer::onStencilPath"); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 748 | SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); |
| 749 | SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 750 | |
| 751 | GrPaint paint; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame^] | 752 | paint.setXPFactory(GrDisableColorXPFactory::Make()); |
robertphillips | 976f5f0 | 2016-06-03 10:59:20 -0700 | [diff] [blame] | 753 | paint.setAntiAlias(args.fIsAA); |
| 754 | |
| 755 | this->internalDrawPath(args.fDrawContext, |
| 756 | paint, |
| 757 | &GrUserStencilSettings::kUnused, |
| 758 | *args.fClip, |
| 759 | GrColor_WHITE, |
| 760 | *args.fViewMatrix, |
| 761 | *args.fPath, |
| 762 | true); |
ethannicholas | 6536ae5 | 2016-05-02 12:16:49 -0700 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | /////////////////////////////////////////////////////////////////////////////////////////////////// |