From c8cee446bf9c07da8848bbd032abf26e79966ac1 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 14 Jun 2018 14:31:17 -0400 Subject: Move op memory storage to GrContext TBR=bsalomon@google.com Change-Id: Ifa95bf0073b9d948f2c937d10088b7734b971f90 Reviewed-on: https://skia-review.googlesource.com/131500 Reviewed-by: Brian Salomon Reviewed-by: Greg Daniel Commit-Queue: Robert Phillips --- gm/atlastext.cpp | 2 ++ gm/beziereffects.cpp | 13 +++++++++---- gm/convexpolyeffect.cpp | 4 +++- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'gm') diff --git a/gm/atlastext.cpp b/gm/atlastext.cpp index 226b83fdd7..c30a6754db 100644 --- a/gm/atlastext.cpp +++ b/gm/atlastext.cpp @@ -8,6 +8,7 @@ #include "gm.h" #if SK_SUPPORT_ATLAS_TEXT +#include "GrContext.h" #include "SkAtlasTextContext.h" #include "SkAtlasTextFont.h" @@ -72,6 +73,7 @@ protected: if (!targetHandle) { return; } + fTarget = SkAtlasTextTarget::Make(fContext, kSize, kSize, targetHandle); fTypefaces[0] = sk_tool_utils::create_portable_typeface("serif", SkFontStyle::Italic()); diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index dea6150549..1c26989df2 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -80,7 +80,9 @@ public: sk_sp gp, const SkRect& rect, GrColor color) { - return std::unique_ptr(new BezierCubicTestOp(std::move(gp), rect, color)); + GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); + + return pool->allocate(std::move(gp), rect, color); } private: @@ -264,8 +266,9 @@ public: const SkRect& rect, GrColor color, const SkMatrix& klm) { - return std::unique_ptr( - new BezierConicTestOp(std::move(gp), rect, color, klm)); + GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); + + return pool->allocate(std::move(gp), rect, color, klm); } private: @@ -485,7 +488,9 @@ public: const SkRect& rect, GrColor color, const GrPathUtils::QuadUVMatrix& devToUV) { - return std::unique_ptr(new BezierQuadTestOp(std::move(gp), rect, color, devToUV)); + GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); + + return pool->allocate(std::move(gp), rect, color, devToUV); } private: diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 8f8d1b4d50..18c5ebdcdc 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -45,7 +45,9 @@ public: static std::unique_ptr Make(GrContext* context, GrPaint&& paint, const SkRect& rect) { - return std::unique_ptr(new PolyBoundsOp(std::move(paint), rect)); + GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); + + return pool->allocate(std::move(paint), rect); } const char* name() const override { return "PolyBoundsOp"; } -- cgit v1.2.3