Make GrDrawAtlasOp a non-legacy GrMeshDrawOp
Change-Id: I4d517855dbe3ee6894d7d457e0fc4488f204300c
Reviewed-on: https://skia-review.googlesource.com/22542
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/ops/GrDrawAtlasOp.h b/src/gpu/ops/GrDrawAtlasOp.h
index 79a6098..bec2eb1 100644
--- a/src/gpu/ops/GrDrawAtlasOp.h
+++ b/src/gpu/ops/GrDrawAtlasOp.h
@@ -11,48 +11,37 @@
#include "GrColor.h"
#include "GrDefaultGeoProcFactory.h"
#include "GrMeshDrawOp.h"
+#include "GrSimpleMeshDrawOpHelper.h"
-class GrDrawAtlasOp final : public GrLegacyMeshDrawOp {
+class GrDrawAtlasOp final : public GrMeshDrawOp {
+private:
+ using Helper = GrSimpleMeshDrawOpHelper;
+
public:
DEFINE_OP_CLASS_ID
- static std::unique_ptr<GrLegacyMeshDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
- int spriteCount, const SkRSXform* xforms,
- const SkRect* rects, const SkColor* colors) {
- return std::unique_ptr<GrLegacyMeshDrawOp>(
- new GrDrawAtlasOp(color, viewMatrix, spriteCount, xforms, rects, colors));
+ static std::unique_ptr<GrDrawOp> Make(GrPaint&& paint, const SkMatrix& viewMatrix,
+ GrAAType aaType, int spriteCount, const SkRSXform* xforms,
+ const SkRect* rects, const SkColor* colors) {
+ return Helper::FactoryHelper<GrDrawAtlasOp>(std::move(paint), viewMatrix, aaType,
+ spriteCount, xforms, rects, colors);
}
+ GrDrawAtlasOp(const Helper::MakeArgs& helperArgs, GrColor color, const SkMatrix& viewMatrix,
+ GrAAType, int spriteCount, const SkRSXform* xforms, const SkRect* rects,
+ const SkColor* colors);
+
const char* name() const override { return "DrawAtlasOp"; }
- SkString dumpInfo() const override {
- SkString string;
- for (const auto& geo : fGeoData) {
- string.appendf("Color: 0x%08x, Quads: %d\n", geo.fColor, geo.fVerts.count() / 4);
- }
- string.append(DumpPipelineInfo(*this->pipeline()));
- string.append(INHERITED::dumpInfo());
- return string;
- }
+ SkString dumpInfo() const override;
+
+ FixedFunctionFlags fixedFunctionFlags() const override;
+
+ RequiresDstTexture finalize(const GrCaps& caps, const GrAppliedClip* clip) override;
private:
- GrDrawAtlasOp(GrColor color, const SkMatrix& viewMatrix, int spriteCount,
- const SkRSXform* xforms, const SkRect* rects, const SkColor* colors);
-
- void getProcessorAnalysisInputs(GrProcessorAnalysisColor* color,
- GrProcessorAnalysisCoverage* coverage) const override {
- if (this->hasColors()) {
- color->setToUnknown();
- } else {
- color->setToConstant(fGeoData[0].fColor);
- }
- *coverage = GrProcessorAnalysisCoverage::kNone;
- }
-
void onPrepareDraws(Target*) const override;
- void applyPipelineOptimizations(const PipelineOptimizations&) override;
-
GrColor color() const { return fColor; }
const SkMatrix& viewMatrix() const { return fViewMatrix; }
bool hasColors() const { return fHasColors; }
@@ -66,13 +55,13 @@
};
SkSTArray<1, Geometry, true> fGeoData;
-
+ Helper fHelper;
SkMatrix fViewMatrix;
GrColor fColor;
int fQuadCount;
bool fHasColors;
- typedef GrLegacyMeshDrawOp INHERITED;
+ typedef GrMeshDrawOp INHERITED;
};
#endif