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/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