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>
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 557bb32..dafd4dc 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -44,7 +44,7 @@
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 @@
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 @@
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 4bd14af..009c5e0 100644
--- a/src/gpu/ops/GrDrawVerticesOp.h
+++ b/src/gpu/ops/GrDrawVerticesOp.h
@@ -25,11 +25,6 @@
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 @@
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 @@
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;
}
};