aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/ops/GrSimpleMeshDrawOpHelper.h')
-rw-r--r--src/gpu/ops/GrSimpleMeshDrawOpHelper.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
index b63728fe0f..e5229a713a 100644
--- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
@@ -174,19 +174,22 @@ template <typename Op, typename... OpArgs>
std::unique_ptr<GrDrawOp> GrSimpleMeshDrawOpHelper::FactoryHelper(GrContext* context,
GrPaint&& paint,
OpArgs... opArgs) {
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
MakeArgs makeArgs;
makeArgs.fSRGBFlags = GrPipeline::SRGBFlagsFromPaint(paint);
GrColor color = paint.getColor();
if (paint.isTrivial()) {
makeArgs.fProcessorSet = nullptr;
- return std::unique_ptr<GrDrawOp>(new Op(makeArgs, color, std::forward<OpArgs>(opArgs)...));
+ return pool->allocate<Op>(makeArgs, color, std::forward<OpArgs>(opArgs)...);
} else {
- char* mem = (char*)GrOp::operator new(sizeof(Op) + sizeof(GrProcessorSet));
+ char* mem = (char*) pool->allocate(sizeof(Op) + sizeof(GrProcessorSet));
char* setMem = mem + sizeof(Op);
makeArgs.fProcessorSet = new (setMem) GrProcessorSet(std::move(paint));
- return std::unique_ptr<GrDrawOp>(
- new (mem) Op(makeArgs, color, std::forward<OpArgs>(opArgs)...));
+
+ return std::unique_ptr<GrDrawOp>(new (mem) Op(makeArgs, color,
+ std::forward<OpArgs>(opArgs)...));
}
}