aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-10-27 14:47:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-10-27 19:14:09 +0000
commit1105224f9701e57ec5ce0354d6a380b664f5c638 (patch)
tree2b6f3db0bfd99da5e22adabc0da37d9271c8b543 /gm
parent6e74412a9cf1ffa44271a55b42f18e8a0813a0a2 (diff)
Rename GrDrawContext to GrRenderTargetContext
This is in preparation for GrTextureContext and GrSurfaceContext BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4030 Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd Reviewed-on: https://skia-review.googlesource.com/4030 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'gm')
-rw-r--r--gm/beziereffects.cpp38
-rw-r--r--gm/bigrrectaaeffect.cpp10
-rw-r--r--gm/constcolorprocessor.cpp14
-rw-r--r--gm/convexpolyeffect.cpp13
-rw-r--r--gm/croppedrects.cpp11
-rw-r--r--gm/gammacolorfilter.cpp5
-rw-r--r--gm/gaussianedge.cpp5
-rw-r--r--gm/rrectclipdrawpaint.cpp3
-rw-r--r--gm/rrects.cpp10
-rw-r--r--gm/texdata.cpp11
-rw-r--r--gm/texturedomaineffect.cpp10
-rw-r--r--gm/windowrectangles.cpp67
-rw-r--r--gm/yuvtorgbeffect.cpp18
13 files changed, 123 insertions, 92 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 3dd4d65f7f..c6d58e17f0 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -11,7 +11,7 @@
#if SK_SUPPORT_GPU
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrContext.h"
#include "GrPathUtils.h"
#include "GrTest.h"
@@ -99,8 +99,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -121,8 +122,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(drawContext->width()) / numCols;
- SkScalar h = SkIntToScalar(drawContext->height()) / numRows;
+ SkScalar w = SkIntToScalar(renderTargetContext->width()) / numCols;
+ SkScalar h = SkIntToScalar(renderTargetContext->height()) / numRows;
int row = 0;
int col = 0;
constexpr GrColor color = 0xff000000;
@@ -194,7 +195,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, klmSigns[c]));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
}
++col;
if (numCols == col) {
@@ -231,8 +233,9 @@ protected:
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -253,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(drawContext->width()) / numCols;
- SkScalar h = SkIntToScalar(drawContext->height()) / numRows;
+ SkScalar w = SkIntToScalar(renderTargetContext->width()) / numCols;
+ SkScalar h = SkIntToScalar(renderTargetContext->height()) / numRows;
int row = 0;
int col = 0;
constexpr GrColor color = 0xff000000;
@@ -325,7 +328,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
}
++col;
if (numCols == col) {
@@ -445,8 +449,9 @@ protected:
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -466,8 +471,8 @@ protected:
int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3)));
int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols);
- SkScalar w = SkIntToScalar(drawContext->width()) / numCols;
- SkScalar h = SkIntToScalar(drawContext->height()) / numRows;
+ SkScalar w = SkIntToScalar(renderTargetContext->width()) / numCols;
+ SkScalar h = SkIntToScalar(renderTargetContext->height()) / numRows;
int row = 0;
int col = 0;
constexpr GrColor color = 0xff000000;
@@ -536,7 +541,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
new BezierQuadTestBatch(gp, bounds, color, DevToUV));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
}
++col;
if (numCols == col) {
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp
index 8387d5ed16..aa0d02d6d7 100644
--- a/gm/bigrrectaaeffect.cpp
+++ b/gm/bigrrectaaeffect.cpp
@@ -8,7 +8,7 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "SkRRect.h"
#include "batches/GrDrawBatch.h"
#include "batches/GrRectBatchFactory.h"
@@ -48,8 +48,9 @@ protected:
SkISize onISize() override { return SkISize::Make(fWidth, fHeight); }
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -89,7 +90,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds,
nullptr, nullptr));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
}
canvas->restore();
x = x + fTestOffsetX;
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index b4983dc44c..4059c43269 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -12,7 +12,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "SkGrPriv.h"
#include "SkGradientShader.h"
#include "batches/GrDrawBatch.h"
@@ -46,8 +46,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -99,8 +100,8 @@ protected:
} else {
skPaint.setColor(kPaintColors[paintType]);
}
- SkAssertResult(SkPaintToGrPaint(context, drawContext, skPaint, viewMatrix,
- &grPaint));
+ SkAssertResult(SkPaintToGrPaint(context, renderTargetContext, skPaint,
+ viewMatrix, &grPaint));
GrConstColorProcessor::InputMode mode = (GrConstColorProcessor::InputMode) m;
GrColor4f color = GrColor4f::FromGrColor(kColors[procColor]);
@@ -111,7 +112,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(grPaint.getColor(), viewMatrix,
renderRect, nullptr, nullptr));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
// Draw labels for the input to the processor and the processor to the right of
// the test rect. The input label appears above the processor label.
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 44471e5f13..e06fa9792b 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -13,7 +13,7 @@
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrPathUtils.h"
#include "GrTest.h"
#include "SkColorPriv.h"
@@ -153,8 +153,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -184,7 +185,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
x += SkScalarCeilToScalar(path->getBounds().width() + kDX);
}
@@ -223,7 +225,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff000000));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
x += SkScalarCeilToScalar(rect.width() + kDX);
}
diff --git a/gm/croppedrects.cpp b/gm/croppedrects.cpp
index 5c36c54815..246251919f 100644
--- a/gm/croppedrects.cpp
+++ b/gm/croppedrects.cpp
@@ -16,8 +16,9 @@ namespace skiagm {
constexpr SkRect kSrcImageClip{75, 75, 275, 275};
/*
- * The purpose of this test is to exercise all three codepaths in GrDrawContext (drawFilledRect,
- * fillRectToRect, fillRectWithLocalMatrix) that pre-crop filled rects based on the clip.
+ * The purpose of this test is to exercise all three codepaths in GrRenderTargetContext
+ * (drawFilledRect, fillRectToRect, fillRectWithLocalMatrix) that pre-crop filled rects based on the
+ * clip.
*
* The test creates an image of a green square surrounded by red background, then draws this image
* in various ways with the red clipped out. The test is successful if there is no visible red
@@ -54,7 +55,7 @@ private:
canvas->clear(SK_ColorWHITE);
{
- // GrDrawContext::drawFilledRect.
+ // GrRenderTargetContext::drawFilledRect.
SkAutoCanvasRestore acr(canvas, true);
SkPaint paint;
paint.setShader(fSrcImageShader);
@@ -64,7 +65,7 @@ private:
}
{
- // GrDrawContext::fillRectToRect.
+ // GrRenderTargetContext::fillRectToRect.
SkAutoCanvasRestore acr(canvas, true);
SkPaint paint;
paint.setFilterQuality(kNone_SkFilterQuality);
@@ -78,7 +79,7 @@ private:
}
{
- // GrDrawContext::fillRectWithLocalMatrix.
+ // GrRenderTargetContext::fillRectWithLocalMatrix.
SkAutoCanvasRestore acr(canvas, true);
SkPath path;
path.moveTo(kSrcImageClip.fLeft - kSrcImageClip.width(), kSrcImageClip.centerY());
diff --git a/gm/gammacolorfilter.cpp b/gm/gammacolorfilter.cpp
index f5e6542062..9e39025b0a 100644
--- a/gm/gammacolorfilter.cpp
+++ b/gm/gammacolorfilter.cpp
@@ -64,8 +64,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
diff --git a/gm/gaussianedge.cpp b/gm/gaussianedge.cpp
index bed42af321..7a451183cf 100644
--- a/gm/gaussianedge.cpp
+++ b/gm/gaussianedge.cpp
@@ -186,8 +186,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
diff --git a/gm/rrectclipdrawpaint.cpp b/gm/rrectclipdrawpaint.cpp
index c997f845eb..291dc48042 100644
--- a/gm/rrectclipdrawpaint.cpp
+++ b/gm/rrectclipdrawpaint.cpp
@@ -9,7 +9,8 @@
#include "SkPath.h"
#include "SkGradientShader.h"
-// Exercises code in GrDrawContext that attempts to replace a rrect clip/draw paint with draw rrect.
+// Exercises code in GrRenderTargetContext that attempts to replace a rrect clip/draw paint with
+// draw rrect.
DEF_SIMPLE_GM(rrect_clip_draw_paint, canvas, 256, 256) {
SkRRect rrect = SkRRect::MakeRectXY(SkRect::MakeXYWH(10.f, 10.f, 236.f, 236.f), 30.f, 40.f);
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index 1f47f77daa..6e0995d503 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -8,7 +8,7 @@
#include "gm.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "batches/GrDrawBatch.h"
#include "batches/GrRectBatchFactory.h"
#include "effects/GrRRectEffect.h"
@@ -62,8 +62,9 @@ protected:
SkISize onISize() override { return SkISize::Make(kImageWidth, kImageHeight); }
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (kEffect_Type == fType && !drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (kEffect_Type == fType && !renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -117,7 +118,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(),
bounds, nullptr, nullptr));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(
+ grPaint, batch);
} else {
drew = false;
}
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index 5fb90839f9..c269448188 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -11,7 +11,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#include "SkColorPriv.h"
#include "effects/GrPorterDuffXferProcessor.h"
@@ -20,8 +20,9 @@
constexpr int S = 200;
DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -101,7 +102,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
tm.postIDiv(2*S, 2*S);
paint.addColorTextureProcessor(texture, nullptr, tm);
- drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S));
+ renderTargetContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S));
// now update the lower right of the texture in first pass
// or upper right in second pass
@@ -115,7 +116,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
texture->writePixels(S, (i ? 0 : S), S, S,
texture->config(), gTextureData.get(),
4 * stride);
- drawContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S));
+ renderTargetContext->drawRect(clip, paint, vm, SkRect::MakeWH(2*S, 2*S));
}
}
#endif
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index b0d2ecede6..96f70e0bda 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -11,7 +11,7 @@
#if SK_SUPPORT_GPU
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrContext.h"
#include "SkBitmap.h"
#include "SkGr.h"
@@ -70,8 +70,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -129,7 +130,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix,
renderRect, nullptr, nullptr));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
x += renderRect.width() + kTestPad;
}
y += renderRect.height() + kTestPad;
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index 5266df2e08..bb914d5844 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -11,8 +11,8 @@
#if SK_SUPPORT_GPU
# include "GrAppliedClip.h"
-# include "GrDrawContext.h"
-# include "GrDrawContextPriv.h"
+# include "GrRenderTargetContext.h"
+# include "GrRenderTargetContextPriv.h"
# include "GrFixedClip.h"
# include "GrReducedClip.h"
# include "GrRenderTargetPriv.h"
@@ -127,9 +127,11 @@ private:
constexpr static int kMaskCheckerSize = 5;
SkString onShortName() final { return SkString("windowrectangles_mask"); }
void onCoverClipStack(const SkClipStack&, SkCanvas*) final;
- void visualizeAlphaMask(GrContext*, GrDrawContext*, const GrReducedClip&, const GrPaint&);
- void visualizeStencilMask(GrContext*, GrDrawContext*, const GrReducedClip&, const GrPaint&);
- void stencilCheckerboard(GrDrawContext*, bool flip);
+ void visualizeAlphaMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&,
+ const GrPaint&);
+ void visualizeStencilMask(GrContext*, GrRenderTargetContext*, const GrReducedClip&,
+ const GrPaint&);
+ void stencilCheckerboard(GrRenderTargetContext*, bool flip);
void fail(SkCanvas*);
};
@@ -158,7 +160,7 @@ public:
fFP = GrDeviceSpaceTextureDecalFragmentProcessor::Make(mask, SkIRect::MakeWH(w, h), {x, y});
}
private:
- bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip* out) const override {
+ bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out) const override {
out->addCoverageFP(fFP);
return true;
}
@@ -170,7 +172,7 @@ private:
*/
class StencilOnlyClip final : public MaskOnlyClipBase {
private:
- bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip* out) const override {
+ bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out) const override {
out->addStencilClip();
return true;
}
@@ -178,10 +180,10 @@ private:
void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas* canvas) {
GrContext* ctx = canvas->getGrContext();
- GrDrawContext* dc = canvas->internal_private_accessTopLayerDrawContext();
+ GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext();
- if (!ctx || !dc ||
- dc->accessRenderTarget()->renderTargetPriv().maxWindowRectangles() < kNumWindows) {
+ if (!ctx || !rtc ||
+ rtc->accessRenderTarget()->renderTargetPriv().maxWindowRectangles() < kNumWindows) {
this->fail(canvas);
return;
}
@@ -190,21 +192,22 @@ void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas
GrPaint paint;
paint.setAntiAlias(true);
- if (!dc->isStencilBufferMultisampled()) {
+ if (!rtc->isStencilBufferMultisampled()) {
paint.setColor4f(GrColor4f(0, 0.25f, 1, 1));
- this->visualizeAlphaMask(ctx, dc, reducedClip, paint);
+ this->visualizeAlphaMask(ctx, rtc, reducedClip, paint);
} else {
paint.setColor4f(GrColor4f(1, 0.25f, 0.25f, 1));
- this->visualizeStencilMask(ctx, dc, reducedClip, paint);
+ this->visualizeStencilMask(ctx, rtc, reducedClip, paint);
}
}
-void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrDrawContext* dc,
+void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetContext* rtc,
const GrReducedClip& reducedClip,
const GrPaint& paint) {
- sk_sp<GrDrawContext> maskDC(
- ctx->makeDrawContextWithFallback(SkBackingFit::kExact, kLayerRect.width(),
- kLayerRect.height(), kAlpha_8_GrPixelConfig, nullptr));
+ sk_sp<GrRenderTargetContext> maskDC(
+ ctx->makeRenderTargetContextWithFallback(SkBackingFit::kExact, kLayerRect.width(),
+ kLayerRect.height(), kAlpha_8_GrPixelConfig,
+ nullptr));
if (!maskDC ||
!ctx->resourceProvider()->attachStencilAttachment(maskDC->accessRenderTarget())) {
return;
@@ -214,10 +217,12 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrDrawContext* d
// the clip mask generation.
this->stencilCheckerboard(maskDC.get(), true);
maskDC->clear(nullptr, GrColorPackA4(0xff), true);
- maskDC->drawContextPriv().drawAndStencilRect(StencilOnlyClip(), &GrUserStencilSettings::kUnused,
- SkRegion::kDifference_Op, false, false,
- SkMatrix::I(),
- SkRect::MakeIWH(maskDC->width(), maskDC->height()));
+ maskDC->renderTargetContextPriv().drawAndStencilRect(StencilOnlyClip(),
+ &GrUserStencilSettings::kUnused,
+ SkRegion::kDifference_Op, false, false,
+ SkMatrix::I(),
+ SkRect::MakeIWH(maskDC->width(),
+ maskDC->height()));
reducedClip.drawAlphaClipMask(maskDC.get());
sk_sp<GrTexture> mask(maskDC->asTexture());
@@ -228,29 +233,29 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrDrawContext* d
// inside window rectangles or outside the scissor should still have the initial checkerboard
// intact. (This verifies we didn't spend any time modifying those pixels in the mask.)
AlphaOnlyClip clip(mask.get(), x, y);
- dc->drawRect(clip, paint, SkMatrix::I(),
+ rtc->drawRect(clip, paint, SkMatrix::I(),
SkRect::Make(SkIRect::MakeXYWH(x, y, mask->width(), mask->height())));
}
-void WindowRectanglesMaskGM::visualizeStencilMask(GrContext* ctx, GrDrawContext* dc,
+void WindowRectanglesMaskGM::visualizeStencilMask(GrContext* ctx, GrRenderTargetContext* rtc,
const GrReducedClip& reducedClip,
const GrPaint& paint) {
- if (!ctx->resourceProvider()->attachStencilAttachment(dc->accessRenderTarget())) {
+ if (!ctx->resourceProvider()->attachStencilAttachment(rtc->accessRenderTarget())) {
return;
}
// Draw a checker pattern into the stencil buffer so we can visualize the regions left untouched
// by the clip mask generation.
- this->stencilCheckerboard(dc, false);
- reducedClip.drawStencilClipMask(ctx, dc, {kLayerRect.x(), kLayerRect.y()});
+ this->stencilCheckerboard(rtc, false);
+ reducedClip.drawStencilClipMask(ctx, rtc, {kLayerRect.x(), kLayerRect.y()});
// Now visualize the stencil mask by covering the entire render target. The regions inside
// window rectangless or outside the scissor should still have the initial checkerboard intact.
// (This verifies we didn't spend any time modifying those pixels in the mask.)
- dc->drawPaint(StencilOnlyClip(), paint, SkMatrix::I());
+ rtc->drawPaint(StencilOnlyClip(), paint, SkMatrix::I());
}
-void WindowRectanglesMaskGM::stencilCheckerboard(GrDrawContext* dc, bool flip) {
+void WindowRectanglesMaskGM::stencilCheckerboard(GrRenderTargetContext* rtc, bool flip) {
constexpr static GrUserStencilSettings kSetClip(
GrUserStencilSettings::StaticInit<
0,
@@ -261,14 +266,14 @@ void WindowRectanglesMaskGM::stencilCheckerboard(GrDrawContext* dc, bool flip) {
0>()
);
- dc->drawContextPriv().clearStencilClip(GrFixedClip::Disabled(), false);
+ rtc->renderTargetContextPriv().clearStencilClip(GrFixedClip::Disabled(), false);
for (int y = 0; y < kLayerRect.height(); y += kMaskCheckerSize) {
for (int x = (y & 1) == flip ? 0 : kMaskCheckerSize;
x < kLayerRect.width(); x += 2 * kMaskCheckerSize) {
SkIRect checker = SkIRect::MakeXYWH(x, y, kMaskCheckerSize, kMaskCheckerSize);
- dc->drawContextPriv().stencilRect(GrNoClip(), &kSetClip, false, SkMatrix::I(),
- SkRect::Make(checker));
+ rtc->renderTargetContextPriv().stencilRect(GrNoClip(), &kSetClip, false, SkMatrix::I(),
+ SkRect::Make(checker));
}
}
}
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index d064cf3cf4..71f66f0f27 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -12,7 +12,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "SkBitmap.h"
#include "SkGr.h"
#include "SkGradientShader.h"
@@ -68,8 +68,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -124,7 +125,8 @@ protected:
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix,
renderRect, nullptr, nullptr));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
}
x += renderRect.width() + kTestPad;
}
@@ -188,8 +190,9 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
- GrDrawContext* drawContext = canvas->internal_private_accessTopLayerDrawContext();
- if (!drawContext) {
+ GrRenderTargetContext* renderTargetContext =
+ canvas->internal_private_accessTopLayerRenderTargetContext();
+ if (!renderTargetContext) {
skiagm::GM::DrawGpuOnlyMessage(canvas);
return;
}
@@ -235,7 +238,8 @@ protected:
grPaint.addColorFragmentProcessor(fp);
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(
GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint,
+ batch);
}
}
}