Add a factory to any GrOp-derived class that lacked one
All GrOp-derived classes are going to have allocate their memory in a GrMemoryPool.
Change-Id: Ifa410b05eecd9b68c39dcc15dd4298d617204c13
Reviewed-on: https://skia-review.googlesource.com/132828
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index b6ca8f0..227fd7c 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -105,6 +105,14 @@
public:
DEFINE_OP_CLASS_ID
+ static std::unique_ptr<GrDrawOp> Make(GrContext* context,
+ ScissorState scissorState,
+ sk_sp<const GrBuffer> vbuff) {
+ return std::unique_ptr<GrDrawOp>(new GrPipelineDynamicStateTestOp(scissorState,
+ std::move(vbuff)));
+ }
+
+private:
GrPipelineDynamicStateTestOp(ScissorState scissorState, sk_sp<const GrBuffer> vbuff)
: INHERITED(ClassID())
, fScissorState(scissorState)
@@ -113,7 +121,6 @@
HasAABloat::kNo, IsZeroArea::kNo);
}
-private:
const char* name() const override { return "GrPipelineDynamicStateTestOp"; }
FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; }
RequiresDstTexture finalize(const GrCaps&, const GrAppliedClip*,
@@ -143,7 +150,7 @@
};
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo) {
- GrContext* const context = ctxInfo.grContext();
+ GrContext* context = ctxInfo.grContext();
GrResourceProvider* rp = context->contextPriv().resourceProvider();
sk_sp<GrRenderTargetContext> rtc(context->contextPriv().makeDeferredRenderTargetContext(
@@ -192,7 +199,7 @@
for (ScissorState scissorState : {ScissorState::kEnabled, ScissorState::kDisabled}) {
rtc->clear(nullptr, 0xbaaaaaad, GrRenderTargetContext::CanClearFullscreen::kYes);
rtc->priv().testingOnly_addDrawOp(
- skstd::make_unique<GrPipelineDynamicStateTestOp>(scissorState, vbuff));
+ GrPipelineDynamicStateTestOp::Make(context, scissorState, vbuff));
rtc->readPixels(SkImageInfo::Make(kScreenSize, kScreenSize,
kRGBA_8888_SkColorType, kPremul_SkAlphaType),
resultPx, 4 * kScreenSize, 0, 0, 0);