More programInfo cleanup

This CL moves the boiler-plate implementation of onPrePrepareDraws up to GrMeshDrawOp. This, unfortunately, required the addition of a 'programInfo' virtual but that may go away in the future.


The only GrMeshDrawOp-derived classes left are:
  AAHairlineOp - which has 3 programInfos
  AAFlatteningConvexPathOp - which has >=1 mesh (but just 1 programInfo)
  GrAtlasTextOp - which has inline uploads
  SmallPathOp - which, maybe, has inline uploads
  TextureOp - which has chaining

Bug: skia:9455
Change-Id: Id10f70e764054134751545ad38b99f0a0778de76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276642
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrMeshDrawOp.cpp b/src/gpu/ops/GrMeshDrawOp.cpp
index 375ce55..0cdc857 100644
--- a/src/gpu/ops/GrMeshDrawOp.cpp
+++ b/src/gpu/ops/GrMeshDrawOp.cpp
@@ -9,6 +9,7 @@
 
 #include "src/gpu/GrOpFlushState.h"
 #include "src/gpu/GrOpsRenderPass.h"
+#include "src/gpu/GrRecordingContextPriv.h"
 #include "src/gpu/GrResourceProvider.h"
 
 GrMeshDrawOp::GrMeshDrawOp(uint32_t classID) : INHERITED(classID) {}
@@ -23,6 +24,23 @@
                             target->dstProxyView());
 }
 
+// This onPrepareDraws implementation assumes the derived Op only has a single programInfo -
+// which is the majority of the cases.
+void GrMeshDrawOp::onPrePrepareDraws(GrRecordingContext* context,
+                                     const GrSurfaceProxyView* outputView,
+                                     GrAppliedClip* clip,
+                                     const GrXferProcessor::DstProxyView& dstProxyView) {
+    SkArenaAlloc* arena = context->priv().recordTimeAllocator();
+
+    // This is equivalent to a GrOpFlushState::detachAppliedClip
+    GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip();
+
+    this->createProgramInfo(context->priv().caps(), arena, outputView,
+                            std::move(appliedClip), dstProxyView);
+
+    context->priv().recordProgramInfo(this->programInfo());
+}
+
 //////////////////////////////////////////////////////////////////////////////
 
 GrMeshDrawOp::PatternHelper::PatternHelper(Target* target, GrPrimitiveType primitiveType,