diff options
author | Brian Osman <brianosman@google.com> | 2017-05-23 15:03:18 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-23 20:28:14 +0000 |
commit | 8a030557bd9cd66860d605578d4c54651ff02383 (patch) | |
tree | 32d7f20dd89e72a9643ef7d2d306e80ac35994e7 /src/gpu | |
parent | 92eaad6d508aafa670b8409ea697ff605ec4306a (diff) |
Fix flag collision in GrDrawVerticesOp
We were setting a flag meant for Mesh.fFlags on the Op's fFlags. Switch
the Mesh's flags to be a pair of bools, to avoid this in the future.
Bug: skia:
Change-Id: Ib660f3bc9c54874d088a85251f629758c365c8c6
Reviewed-on: https://skia-review.googlesource.com/17766
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/ops/GrDrawVerticesOp.cpp | 9 | ||||
-rw-r--r-- | src/gpu/ops/GrDrawVerticesOp.h | 15 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp index 557bb320cf..dafd4dc7c7 100644 --- a/src/gpu/ops/GrDrawVerticesOp.cpp +++ b/src/gpu/ops/GrDrawVerticesOp.cpp @@ -44,7 +44,7 @@ std::unique_ptr<GrLegacyMeshDrawOp> GrDrawVerticesOp::Make(GrColor color, GrDrawVerticesOp::GrDrawVerticesOp(sk_sp<SkVertices> vertices, GrPrimitiveType primitiveType, GrColor color, GrRenderTargetContext::ColorArrayType colorArrayType, - const SkMatrix& viewMatrix, uint32_t flags) + const SkMatrix& viewMatrix) : INHERITED(ClassID()), fColorArrayType(colorArrayType) { SkASSERT(vertices); @@ -56,7 +56,8 @@ GrDrawVerticesOp::GrDrawVerticesOp(sk_sp<SkVertices> vertices, GrPrimitiveType p mesh.fColor = color; mesh.fViewMatrix = viewMatrix; mesh.fVertices = std::move(vertices); - mesh.fFlags = flags; + mesh.fIgnoreTexCoords = false; + mesh.fIgnoreColors = false; fFlags = 0; if (mesh.hasPerVertexColors()) { @@ -90,14 +91,14 @@ void GrDrawVerticesOp::applyPipelineOptimizations(const PipelineOptimizations& o GrColor overrideColor; if (optimizations.getOverrideColorIfSet(&overrideColor)) { fMeshes[0].fColor = overrideColor; - fMeshes[0].fFlags |= kIgnoreColors_VerticesFlag; + fMeshes[0].fIgnoreColors = true; fFlags &= ~kRequiresPerVertexColors_Flag; fColorArrayType = GrRenderTargetContext::ColorArrayType::kPremulGrColor; } if (optimizations.readsLocalCoords()) { fFlags |= kPipelineRequiresLocalCoords_Flag; } else { - fFlags |= kIgnoreTexCoords_VerticesFlag; + fMeshes[0].fIgnoreTexCoords = true; fFlags &= ~kAnyMeshHasExplicitLocalCoords; } } diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h index 4bd14afad3..009c5e0415 100644 --- a/src/gpu/ops/GrDrawVerticesOp.h +++ b/src/gpu/ops/GrDrawVerticesOp.h @@ -25,11 +25,6 @@ class GrDrawVerticesOp final : public GrLegacyMeshDrawOp { public: DEFINE_OP_CLASS_ID - enum { - kIgnoreTexCoords_VerticesFlag = 1 << 0, - kIgnoreColors_VerticesFlag = 1 << 1, - }; - /** * The 'color' param is used if the 'colors' array is null. 'bounds' is the bounds of the * 'positions' array (in local space prior to application of 'viewMatrix'). If 'indices' is null @@ -66,8 +61,7 @@ public: private: GrDrawVerticesOp(sk_sp<SkVertices>, GrPrimitiveType, GrColor, - GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix, - uint32_t flags = 0); + GrRenderTargetContext::ColorArrayType, const SkMatrix& viewMatrix); void getProcessorAnalysisInputs(GrProcessorAnalysisColor* color, GrProcessorAnalysisCoverage* coverage) const override; @@ -89,14 +83,15 @@ private: GrColor fColor; // Used if this->hasPerVertexColors() is false. sk_sp<SkVertices> fVertices; SkMatrix fViewMatrix; - uint32_t fFlags; + bool fIgnoreTexCoords; + bool fIgnoreColors; bool hasExplicitLocalCoords() const { - return fVertices->hasTexCoords() && !(kIgnoreTexCoords_VerticesFlag & fFlags); + return fVertices->hasTexCoords() && !fIgnoreTexCoords; } bool hasPerVertexColors() const { - return fVertices->hasColors() && !(kIgnoreColors_VerticesFlag & fFlags); + return fVertices->hasColors() && !fIgnoreColors; } }; |