Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: gm/beziereffects.cpp

Issue 1930623003: Clean up test drawContext usage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix typo Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/bigrrectaaeffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/beziereffects.cpp
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 015450895bf15f4b3bdc12cd6f101602ae637731..cfb84a5bcca3aedaa2efe022e2a5600e85363134 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -99,18 +99,14 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (nullptr == rt) {
+ GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
+ if (!drawContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
- GrContext* context = rt->getContext();
- if (nullptr == context) {
- return;
- }
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(rt)));
- if (!drawContext) {
+ GrContext* context = canvas->getGrContext();
+ if (!context) {
return;
}
@@ -125,8 +121,8 @@ protected:
// Mult by 3 for each edge effect type
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3)));
int numRows = SkScalarCeilToInt(SkIntToScalar(kNumCubics*3) / numCols);
- SkScalar w = SkIntToScalar(rt->width()) / numCols;
- SkScalar h = SkIntToScalar(rt->height()) / numRows;
+ SkScalar w = SkIntToScalar(drawContext->width()) / numCols;
+ SkScalar h = SkIntToScalar(drawContext->height()) / numRows;
int row = 0;
int col = 0;
static const GrColor color = 0xff000000;
@@ -196,7 +192,7 @@ protected:
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setXPFactory(
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
- pipelineBuilder.setRenderTarget(rt);
+ pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
SkAutoTUnref<GrDrawBatch> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, klmSigns[c]));
@@ -238,18 +234,14 @@ protected:
void onDraw(SkCanvas* canvas) override {
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (nullptr == rt) {
+ GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
+ if (!drawContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
- GrContext* context = rt->getContext();
- if (nullptr == context) {
- return;
- }
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(rt)));
- if (!drawContext) {
+ GrContext* context = canvas->getGrContext();
+ if (!context) {
return;
}
@@ -264,8 +256,8 @@ protected:
// Mult by 3 for each edge effect type
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3)));
int numRows = SkScalarCeilToInt(SkIntToScalar(kNumConics*3) / numCols);
- SkScalar w = SkIntToScalar(rt->width()) / numCols;
- SkScalar h = SkIntToScalar(rt->height()) / numRows;
+ SkScalar w = SkIntToScalar(drawContext->width()) / numCols;
+ SkScalar h = SkIntToScalar(drawContext->height()) / numRows;
int row = 0;
int col = 0;
static const GrColor color = 0xff000000;
@@ -333,7 +325,7 @@ protected:
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setXPFactory(
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
- pipelineBuilder.setRenderTarget(rt);
+ pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
SkAutoTUnref<GrDrawBatch> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f));
@@ -455,18 +447,14 @@ protected:
void onDraw(SkCanvas* canvas) override {
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
- if (nullptr == rt) {
+ GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
+ if (!drawContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
- GrContext* context = rt->getContext();
- if (nullptr == context) {
- return;
- }
- sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(rt)));
- if (!drawContext) {
+ GrContext* context = canvas->getGrContext();
+ if (!context) {
return;
}
@@ -480,8 +468,8 @@ protected:
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3)));
int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols);
- SkScalar w = SkIntToScalar(rt->width()) / numCols;
- SkScalar h = SkIntToScalar(rt->height()) / numRows;
+ SkScalar w = SkIntToScalar(drawContext->width()) / numCols;
+ SkScalar h = SkIntToScalar(drawContext->height()) / numRows;
int row = 0;
int col = 0;
static const GrColor color = 0xff000000;
@@ -545,7 +533,7 @@ protected:
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setXPFactory(
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
- pipelineBuilder.setRenderTarget(rt);
+ pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
GrPathUtils::QuadUVMatrix DevToUV(pts);
« no previous file with comments | « no previous file | gm/bigrrectaaeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698