Splitup GrSimpleMeshDrawOpHelper.h
Change-Id: Ie3d05053633176ba27e55cc2de61eeba1e9f45d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273981
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 003ea8b..4992b6b 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -27,7 +27,7 @@
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
#include "src/gpu/ops/GrAAConvexPathRenderer.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
}
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 3cb8241..8a7ebdf 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -27,7 +27,7 @@
#include "src/gpu/geometry/GrShape.h"
#include "src/gpu/ops/GrAAHairLinePathRenderer.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
#define PREALLOC_PTARRAY(N) SkSTArray<(N),SkPoint, true>
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index c95f324..a66e20c 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -25,7 +25,7 @@
#include "src/gpu/ops/GrAAConvexTessellator.h"
#include "src/gpu/ops/GrAALinearizingConvexPathRenderer.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
static const int DEFAULT_BUFFER_SIZE = 100;
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index fb2ce42..0bb6e05 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -25,7 +25,7 @@
#include "src/gpu/geometry/GrPathUtils.h"
#include "src/gpu/geometry/GrShape.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
GrDefaultPathRenderer::GrDefaultPathRenderer() {
}
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index 37e5e58..d1ef972 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -21,6 +21,7 @@
#include "src/gpu/glsl/GrGLSLVarying.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
#include "src/gpu/ops/GrQuadPerEdgeAA.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
namespace {
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index 3c993b4..15dd0af 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -16,7 +16,7 @@
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrVertexWriter.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
static GrGeometryProcessor* make_gp(SkArenaAlloc* arena,
const GrShaderCaps* shaderCaps,
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp b/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp
index 87d03c9..0ba0e05 100644
--- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.cpp
@@ -186,58 +186,3 @@
return result;
}
#endif
-
-const GrPipeline* GrSimpleMeshDrawOpHelperWithStencil::createPipelineWithStencil(
- GrOpFlushState* flushState) {
- return GrSimpleMeshDrawOpHelper::CreatePipeline(&flushState->caps(),
- flushState->allocator(),
- flushState->view(),
- flushState->detachAppliedClip(),
- flushState->dstProxyView(),
- this->detachProcessorSet(),
- this->pipelineFlags(),
- this->stencilSettings());
-}
-
-GrSimpleMeshDrawOpHelperWithStencil::GrSimpleMeshDrawOpHelperWithStencil(
- const MakeArgs& args, GrAAType aaType, const GrUserStencilSettings* stencilSettings,
- InputFlags inputFlags)
- : INHERITED(args, aaType, inputFlags)
- , fStencilSettings(stencilSettings ? stencilSettings : &GrUserStencilSettings::kUnused) {}
-
-GrDrawOp::FixedFunctionFlags GrSimpleMeshDrawOpHelperWithStencil::fixedFunctionFlags() const {
- GrDrawOp::FixedFunctionFlags flags = INHERITED::fixedFunctionFlags();
- if (fStencilSettings != &GrUserStencilSettings::kUnused) {
- flags |= GrDrawOp::FixedFunctionFlags::kUsesStencil;
- }
- return flags;
-}
-
-GrProcessorSet::Analysis GrSimpleMeshDrawOpHelperWithStencil::finalizeProcessors(
- const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
- GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
- SkPMColor4f* geometryColor, bool* wideColor) {
- GrProcessorAnalysisColor color = *geometryColor;
- auto result = this->finalizeProcessors(
- caps, clip, hasMixedSampledCoverage, clampType, geometryCoverage, &color);
- color.isConstant(geometryColor);
- if (wideColor) {
- *wideColor = !geometryColor->fitsInBytes();
- }
- return result;
-}
-
-bool GrSimpleMeshDrawOpHelperWithStencil::isCompatible(
- const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps& caps,
- const SkRect& thisBounds, const SkRect& thatBounds, bool ignoreAAType) const {
- return INHERITED::isCompatible(that, caps, thisBounds, thatBounds, ignoreAAType) &&
- fStencilSettings == that.fStencilSettings;
-}
-
-#ifdef SK_DEBUG
-SkString GrSimpleMeshDrawOpHelperWithStencil::dumpInfo() const {
- SkString result = INHERITED::dumpInfo();
- result.appendf("Stencil settings: %s\n", (fStencilSettings ? "yes" : "no"));
- return result;
-}
-#endif
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
index 04f7c14..ee5f382 100644
--- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
@@ -161,70 +161,6 @@
SkDEBUGCODE(unsigned fDidAnalysis : 1;)
};
-/**
- * This class extends GrSimpleMeshDrawOpHelper to support an optional GrUserStencilSettings. This
- * uses private inheritance because it non-virtually overrides methods in the base class and should
- * never be used with a GrSimpleMeshDrawOpHelper pointer or reference.
- */
-class GrSimpleMeshDrawOpHelperWithStencil : private GrSimpleMeshDrawOpHelper {
-public:
- using MakeArgs = GrSimpleMeshDrawOpHelper::MakeArgs;
- using InputFlags = GrSimpleMeshDrawOpHelper::InputFlags;
-
- using GrSimpleMeshDrawOpHelper::visitProxies;
-
- const GrPipeline* createPipelineWithStencil(GrOpFlushState* flushState);
-
- // using declarations can't be templated, so this is a pass through function instead.
- template <typename Op, typename... OpArgs>
- static std::unique_ptr<GrDrawOp> FactoryHelper(GrRecordingContext* context, GrPaint&& paint,
- OpArgs... opArgs) {
- return GrSimpleMeshDrawOpHelper::FactoryHelper<Op, OpArgs...>(
- context, std::move(paint), std::forward<OpArgs>(opArgs)...);
- }
-
- GrSimpleMeshDrawOpHelperWithStencil(const MakeArgs&, GrAAType, const GrUserStencilSettings*,
- InputFlags = InputFlags::kNone);
-
- GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const;
-
- GrProcessorSet::Analysis finalizeProcessors(
- const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
- GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
- GrProcessorAnalysisColor* geometryColor) {
- return this->INHERITED::finalizeProcessors(
- caps, clip, fStencilSettings, hasMixedSampledCoverage, clampType, geometryCoverage,
- geometryColor);
- }
-
- GrProcessorSet::Analysis finalizeProcessors(
- const GrCaps&, const GrAppliedClip*, bool hasMixedSampledCoverage, GrClampType,
- GrProcessorAnalysisCoverage geometryCoverage, SkPMColor4f* geometryColor, bool*
- wideColor);
-
- using GrSimpleMeshDrawOpHelper::aaType;
- using GrSimpleMeshDrawOpHelper::setAAType;
- using GrSimpleMeshDrawOpHelper::isTrivial;
- using GrSimpleMeshDrawOpHelper::usesLocalCoords;
- using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha;
- using GrSimpleMeshDrawOpHelper::detachProcessorSet;
- using GrSimpleMeshDrawOpHelper::pipelineFlags;
-
- bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&,
- const SkRect& thisBounds, const SkRect& thatBounds,
- bool ignoreAAType = false) const;
-
-#ifdef SK_DEBUG
- SkString dumpInfo() const;
-#endif
-
- const GrUserStencilSettings* stencilSettings() const { return fStencilSettings; }
-
-private:
- const GrUserStencilSettings* fStencilSettings;
- typedef GrSimpleMeshDrawOpHelper INHERITED;
-};
-
template <typename Op, typename... OpArgs>
std::unique_ptr<GrDrawOp> GrSimpleMeshDrawOpHelper::FactoryHelper(GrRecordingContext* context,
GrPaint&& paint,
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.cpp b/src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.cpp
new file mode 100644
index 0000000..3317631
--- /dev/null
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
+
+const GrPipeline* GrSimpleMeshDrawOpHelperWithStencil::createPipelineWithStencil(
+ GrOpFlushState* flushState) {
+ return GrSimpleMeshDrawOpHelper::CreatePipeline(&flushState->caps(),
+ flushState->allocator(),
+ flushState->view(),
+ flushState->detachAppliedClip(),
+ flushState->dstProxyView(),
+ this->detachProcessorSet(),
+ this->pipelineFlags(),
+ this->stencilSettings());
+}
+
+GrSimpleMeshDrawOpHelperWithStencil::GrSimpleMeshDrawOpHelperWithStencil(
+ const MakeArgs& args, GrAAType aaType, const GrUserStencilSettings* stencilSettings,
+ InputFlags inputFlags)
+ : INHERITED(args, aaType, inputFlags)
+ , fStencilSettings(stencilSettings ? stencilSettings : &GrUserStencilSettings::kUnused) {}
+
+GrDrawOp::FixedFunctionFlags GrSimpleMeshDrawOpHelperWithStencil::fixedFunctionFlags() const {
+ GrDrawOp::FixedFunctionFlags flags = INHERITED::fixedFunctionFlags();
+ if (fStencilSettings != &GrUserStencilSettings::kUnused) {
+ flags |= GrDrawOp::FixedFunctionFlags::kUsesStencil;
+ }
+ return flags;
+}
+
+GrProcessorSet::Analysis GrSimpleMeshDrawOpHelperWithStencil::finalizeProcessors(
+ const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
+ GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
+ SkPMColor4f* geometryColor, bool* wideColor) {
+ GrProcessorAnalysisColor color = *geometryColor;
+ auto result = this->finalizeProcessors(
+ caps, clip, hasMixedSampledCoverage, clampType, geometryCoverage, &color);
+ color.isConstant(geometryColor);
+ if (wideColor) {
+ *wideColor = !geometryColor->fitsInBytes();
+ }
+ return result;
+}
+
+bool GrSimpleMeshDrawOpHelperWithStencil::isCompatible(
+ const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps& caps,
+ const SkRect& thisBounds, const SkRect& thatBounds, bool ignoreAAType) const {
+ return INHERITED::isCompatible(that, caps, thisBounds, thatBounds, ignoreAAType) &&
+ fStencilSettings == that.fStencilSettings;
+}
+
+#ifdef SK_DEBUG
+SkString GrSimpleMeshDrawOpHelperWithStencil::dumpInfo() const {
+ SkString result = INHERITED::dumpInfo();
+ result.appendf("Stencil settings: %s\n", (fStencilSettings ? "yes" : "no"));
+ return result;
+}
+#endif
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h b/src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h
new file mode 100644
index 0000000..506b48a
--- /dev/null
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrSimpleMeshDrawOpHelperWithStencil_DEFINED
+#define GrSimpleMeshDrawOpHelperWithStencil_DEFINED
+
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+
+/**
+ * This class extends GrSimpleMeshDrawOpHelper to support an optional GrUserStencilSettings. This
+ * uses private inheritance because it non-virtually overrides methods in the base class and should
+ * never be used with a GrSimpleMeshDrawOpHelper pointer or reference.
+ */
+class GrSimpleMeshDrawOpHelperWithStencil : private GrSimpleMeshDrawOpHelper {
+public:
+ using MakeArgs = GrSimpleMeshDrawOpHelper::MakeArgs;
+ using InputFlags = GrSimpleMeshDrawOpHelper::InputFlags;
+
+ using GrSimpleMeshDrawOpHelper::visitProxies;
+
+ const GrPipeline* createPipelineWithStencil(GrOpFlushState* flushState);
+
+ // using declarations can't be templated, so this is a pass through function instead.
+ template <typename Op, typename... OpArgs>
+ static std::unique_ptr<GrDrawOp> FactoryHelper(GrRecordingContext* context, GrPaint&& paint,
+ OpArgs... opArgs) {
+ return GrSimpleMeshDrawOpHelper::FactoryHelper<Op, OpArgs...>(
+ context, std::move(paint), std::forward<OpArgs>(opArgs)...);
+ }
+
+ GrSimpleMeshDrawOpHelperWithStencil(const MakeArgs&, GrAAType, const GrUserStencilSettings*,
+ InputFlags = InputFlags::kNone);
+
+ GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const;
+
+ GrProcessorSet::Analysis finalizeProcessors(
+ const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
+ GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage,
+ GrProcessorAnalysisColor* geometryColor) {
+ return this->INHERITED::finalizeProcessors(
+ caps, clip, fStencilSettings, hasMixedSampledCoverage, clampType, geometryCoverage,
+ geometryColor);
+ }
+
+ GrProcessorSet::Analysis finalizeProcessors(
+ const GrCaps&, const GrAppliedClip*, bool hasMixedSampledCoverage, GrClampType,
+ GrProcessorAnalysisCoverage geometryCoverage, SkPMColor4f* geometryColor, bool*
+ wideColor);
+
+ using GrSimpleMeshDrawOpHelper::aaType;
+ using GrSimpleMeshDrawOpHelper::setAAType;
+ using GrSimpleMeshDrawOpHelper::isTrivial;
+ using GrSimpleMeshDrawOpHelper::usesLocalCoords;
+ using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha;
+ using GrSimpleMeshDrawOpHelper::detachProcessorSet;
+ using GrSimpleMeshDrawOpHelper::pipelineFlags;
+
+ bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&,
+ const SkRect& thisBounds, const SkRect& thatBounds,
+ bool ignoreAAType = false) const;
+
+#ifdef SK_DEBUG
+ SkString dumpInfo() const;
+#endif
+
+ const GrUserStencilSettings* stencilSettings() const { return fStencilSettings; }
+
+private:
+ const GrUserStencilSettings* fStencilSettings;
+ typedef GrSimpleMeshDrawOpHelper INHERITED;
+};
+
+#endif
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index a68f6cb..fed8c4d 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -27,7 +27,7 @@
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
#include "src/gpu/geometry/GrQuad.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
static constexpr size_t kMaxAtlasTextureBytes = 2048 * 2048;
static constexpr size_t kPlotWidth = 512;
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index fb619f2..4061dbc 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -23,7 +23,7 @@
#include "src/gpu/geometry/GrPathUtils.h"
#include "src/gpu/geometry/GrShape.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
-#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
+#include "src/gpu/ops/GrSimpleMeshDrawOpHelperWithStencil.h"
#ifndef GR_AA_TESSELLATOR_MAX_VERB_COUNT
#define GR_AA_TESSELLATOR_MAX_VERB_COUNT 10