aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/beziereffects.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-06-12 10:11:12 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-12 14:43:03 +0000
commit7c525e62d405d57ae7a7742cf607b9770a83a0ab (patch)
tree8dabe9ed08bddd398b8fac935decaf2743f5a6f7 /gm/beziereffects.cpp
parent7deacf4833dcdb6c1101a18a2b46a8c516a96f9a (diff)
Plumb GrContext everywhere
There is no good way to split the monster CL up. This breaks out the GrContext plumbing but doesn't use it. Change-Id: I90856d428d372bcec3f8821e6364667b367927d4 Reviewed-on: https://skia-review.googlesource.com/133382 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'gm/beziereffects.cpp')
-rw-r--r--gm/beziereffects.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index ab9a5fdb5b..dea6150549 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -11,6 +11,7 @@
#include "sk_tool_utils.h"
#include "GrContext.h"
+#include "GrMemoryPool.h"
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
#include "GrRenderTargetContextPriv.h"
@@ -75,12 +76,16 @@ public:
const char* name() const override { return "BezierCubicTestOp"; }
- static std::unique_ptr<GrDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& rect,
+ static std::unique_ptr<GrDrawOp> Make(GrContext* context,
+ sk_sp<GrGeometryProcessor> gp,
+ const SkRect& rect,
GrColor color) {
return std::unique_ptr<GrDrawOp>(new BezierCubicTestOp(std::move(gp), rect, color));
}
private:
+ friend class ::GrOpMemoryPool; // for ctor
+
BezierCubicTestOp(sk_sp<GrGeometryProcessor> gp, const SkRect& rect, GrColor color)
: INHERITED(std::move(gp), rect, color, ClassID()) {}
@@ -230,7 +235,7 @@ protected:
}
std::unique_ptr<GrDrawOp> op =
- BezierCubicTestOp::Make(std::move(gp), bounds, color);
+ BezierCubicTestOp::Make(context, std::move(gp), bounds, color);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
}
++col;
@@ -254,13 +259,18 @@ public:
const char* name() const override { return "BezierConicTestOp"; }
- static std::unique_ptr<GrDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& rect,
- GrColor color, const SkMatrix& klm) {
+ static std::unique_ptr<GrDrawOp> Make(GrContext* context,
+ sk_sp<GrGeometryProcessor> gp,
+ const SkRect& rect,
+ GrColor color,
+ const SkMatrix& klm) {
return std::unique_ptr<GrMeshDrawOp>(
new BezierConicTestOp(std::move(gp), rect, color, klm));
}
private:
+ friend class ::GrOpMemoryPool; // for ctor
+
BezierConicTestOp(sk_sp<GrGeometryProcessor> gp, const SkRect& rect, GrColor color,
const SkMatrix& klm)
: INHERITED(std::move(gp), rect, color, ClassID()), fKLM(klm) {}
@@ -406,7 +416,8 @@ protected:
boundsPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(bounds, boundsPaint);
- std::unique_ptr<GrDrawOp> op = BezierConicTestOp::Make(gp, bounds, color, klm);
+ std::unique_ptr<GrDrawOp> op = BezierConicTestOp::Make(context, gp, bounds,
+ color, klm);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
}
++col;
@@ -469,12 +480,17 @@ public:
DEFINE_OP_CLASS_ID
const char* name() const override { return "BezierQuadTestOp"; }
- static std::unique_ptr<GrDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& rect,
- GrColor color, const GrPathUtils::QuadUVMatrix& devToUV) {
+ static std::unique_ptr<GrDrawOp> Make(GrContext* context,
+ sk_sp<GrGeometryProcessor> gp,
+ const SkRect& rect,
+ GrColor color,
+ const GrPathUtils::QuadUVMatrix& devToUV) {
return std::unique_ptr<GrDrawOp>(new BezierQuadTestOp(std::move(gp), rect, color, devToUV));
}
private:
+ friend class ::GrOpMemoryPool; // for ctor
+
BezierQuadTestOp(sk_sp<GrGeometryProcessor> gp, const SkRect& rect, GrColor color,
const GrPathUtils::QuadUVMatrix& devToUV)
: INHERITED(std::move(gp), rect, color, ClassID()), fDevToUV(devToUV) {}
@@ -615,8 +631,8 @@ protected:
GrPathUtils::QuadUVMatrix DevToUV(pts);
- std::unique_ptr<GrDrawOp> op =
- BezierQuadTestOp::Make(gp, bounds, color, DevToUV);
+ std::unique_ptr<GrDrawOp> op = BezierQuadTestOp::Make(context, gp,
+ bounds, color, DevToUV);
renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
}
++col;