Revert "put an arena on GrSurfaceDrawContext"
This reverts commit 5a2de5e72f24d1bfbdc532252be3dcdefa7b75a2.
Reason for revert: Upon further investigation this still leaks
Original change's description:
> put an arena on GrSurfaceDrawContext
>
> This is part one of two CLs. In this CL, I put a
> sk_sp<GrArenas> on GrSurfaceFillContext where GrArenas wraps
> a SkArenaAlloc to add ref counting. Creating
> a GrOpsTask shares the GrArenas with the ops task. New plumbing
> was added to GR_DRAW_OP_TEST_DEFINE to allow a proper
> GrSurfaceDrawContext to be passed to GrAtlasTextOp's
> GR_DRAW_OP_TEST_DEFINE so the arena will have a proper lifetime.
>
> The second CL will work on replacing GrOpsTask's fAllocators
> system with the shared arena.
>
> Change-Id: Ife3be0ab265441cbffab360f2808f5eed86db8b3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392936
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
TBR=bsalomon@google.com,herb@google.com
Change-Id: I9ca5c8b1e16b468003788cd3126eda1d40ff93ed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393177
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index c528362..dcaf5e3 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -112,18 +112,14 @@
SkPoint drawOrigin,
SkIRect clipRect,
sk_sp<GrTextBlob> blob,
- const SkPMColor4f& color,
- SkArenaAlloc* alloc) -> Geometry* {
- // Bypass the automatic dtor behavior in SkArenaAlloc. I'm leaving this up to the Op to run
- // all geometry dtors for now.
- void* geo = alloc->makeBytesAlignedTo(sizeof(Geometry), alignof(Geometry));
- return new(geo) Geometry{subRun,
- drawMatrix,
- drawOrigin,
- clipRect,
- std::move(blob),
- nullptr,
- color};
+ const SkPMColor4f& color) -> Geometry* {
+ return new Geometry{subRun,
+ drawMatrix,
+ drawOrigin,
+ clipRect,
+ std::move(blob),
+ nullptr,
+ color};
}
void GrAtlasTextOp::Geometry::fillVertexData(void *dst, int offset, int count) const {
@@ -526,6 +522,10 @@
}
GR_DRAW_OP_TEST_DEFINE(GrAtlasTextOp) {
+ // Setup dummy SkPaint / GrPaint / GrSurfaceDrawContext
+ auto rtc = GrSurfaceDrawContext::Make(
+ context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1024, 1024});
+
SkSimpleMatrixProvider matrixProvider(GrTest::TestMatrixInvertible(random));
SkPaint skPaint;
@@ -548,7 +548,8 @@
int xInt = (random->nextU() % kMaxTrans) * xPos;
int yInt = (random->nextU() % kMaxTrans) * yPos;
- return GrAtlasTextOp::CreateOpTestingOnly(sdc, skPaint, font, matrixProvider, text, xInt, yInt);
+ return GrAtlasTextOp::CreateOpTestingOnly(
+ rtc.get(), skPaint, font, matrixProvider, text, xInt, yInt);
}
#endif