Move op memory storage to GrContext (take 2)
TBR=bsalomon@google.com
Change-Id: I4a448694d4114d83cd3a720cfc8bd37de51733d1
Reviewed-on: https://skia-review.googlesource.com/135707
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index ad078b2..e3010f9 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -22,9 +22,12 @@
return false;
}
-std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(GrContext*, const SkIRect& clipIBounds,
- const SkMatrix& m, const GrShape& shape,
- const SkRect& devBounds, GrPaint&& paint) {
+std::unique_ptr<GrCCDrawPathsOp> GrCCDrawPathsOp::Make(GrContext* context,
+ const SkIRect& clipIBounds,
+ const SkMatrix& m,
+ const GrShape& shape,
+ const SkRect& devBounds,
+ GrPaint&& paint) {
bool canStashPathMask = true;
SkIRect looseClippedIBounds;
devBounds.roundOut(&looseClippedIBounds); // GrCCPathParser might find slightly tighter bounds.
@@ -34,9 +37,11 @@
return nullptr;
}
}
- return std::unique_ptr<GrCCDrawPathsOp>(new GrCCDrawPathsOp(looseClippedIBounds, m, shape,
- canStashPathMask, devBounds,
- std::move(paint)));
+
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<GrCCDrawPathsOp>(looseClippedIBounds, m, shape, canStashPathMask,
+ devBounds, std::move(paint));
}
GrCCDrawPathsOp::GrCCDrawPathsOp(const SkIRect& looseClippedIBounds, const SkMatrix& m,
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp
index 84f905c..a1cecb3 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.cpp
+++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp
@@ -53,8 +53,10 @@
sk_sp<const GrCCPerFlushResources> resources,
sk_sp<GrTextureProxy> copyProxy, int baseInstance,
int endInstance, const SkISize& drawBounds) {
- return std::unique_ptr<GrDrawOp>(new CopyAtlasOp(std::move(resources), std::move(copyProxy),
- baseInstance, endInstance, drawBounds));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<CopyAtlasOp>(std::move(resources), std::move(copyProxy),
+ baseInstance, endInstance, drawBounds);
}
const char* name() const override { return "CopyAtlasOp (CCPR)"; }
@@ -96,8 +98,9 @@
static std::unique_ptr<GrDrawOp> Make(GrContext* context,
sk_sp<const GrCCPerFlushResources> resources,
CoverageCountBatchID batchID, const SkISize& drawBounds) {
- return std::unique_ptr<GrDrawOp>(new RenderAtlasOp(std::move(resources), batchID,
- drawBounds));
+ GrOpMemoryPool* pool = context->contextPriv().opMemoryPool();
+
+ return pool->allocate<RenderAtlasOp>(std::move(resources), batchID, drawBounds);
}
// GrDrawOp interface.