aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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
-rw-r--r--gn/gpu.gni10
-rw-r--r--include/core/SkCanvas.h4
-rw-r--r--include/core/SkDevice.h2
-rw-r--r--include/core/SkMaskFilter.h6
-rw-r--r--include/gpu/GrClip.h8
-rw-r--r--include/gpu/GrContext.h35
-rw-r--r--include/gpu/GrProcessorUnitTest.h8
-rw-r--r--include/gpu/GrRenderTargetContext.h (renamed from include/gpu/GrDrawContext.h)34
-rw-r--r--include/gpu/GrSurface.h2
-rw-r--r--include/private/GrSurfaceProxy.h2
-rw-r--r--src/core/SkBlurImageFilter.cpp8
-rw-r--r--src/core/SkCanvas.cpp4
-rw-r--r--src/core/SkGpuBlurUtils.cpp126
-rw-r--r--src/core/SkGpuBlurUtils.h27
-rw-r--r--src/core/SkImageFilter.cpp18
-rw-r--r--src/core/SkMaskFilter.cpp4
-rw-r--r--src/core/SkSpecialSurface.cpp31
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp17
-rw-r--r--src/effects/SkBlurMaskFilter.cpp76
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp20
-rw-r--r--src/effects/SkLightingImageFilter.cpp48
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp1
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp1
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp58
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp20
-rw-r--r--src/gpu/GrBlurUtils.cpp54
-rw-r--r--src/gpu/GrBlurUtils.h6
-rw-r--r--src/gpu/GrClipStackClip.cpp45
-rw-r--r--src/gpu/GrClipStackClip.h6
-rw-r--r--src/gpu/GrContext.cpp120
-rw-r--r--src/gpu/GrContextPriv.h32
-rw-r--r--src/gpu/GrDrawingManager.cpp22
-rw-r--r--src/gpu/GrDrawingManager.h12
-rw-r--r--src/gpu/GrFixedClip.cpp7
-rw-r--r--src/gpu/GrFixedClip.h2
-rw-r--r--src/gpu/GrPathRenderer.h26
-rw-r--r--src/gpu/GrPathRenderingRenderTargetContext.cpp (renamed from src/gpu/GrPathRenderingDrawContext.cpp)42
-rw-r--r--src/gpu/GrPathRenderingRenderTargetContext.h (renamed from src/gpu/GrPathRenderingDrawContext.h)17
-rw-r--r--src/gpu/GrPipeline.cpp6
-rw-r--r--src/gpu/GrPipeline.h4
-rw-r--r--src/gpu/GrReducedClip.cpp85
-rw-r--r--src/gpu/GrReducedClip.h6
-rw-r--r--src/gpu/GrRenderTarget.cpp10
-rw-r--r--src/gpu/GrRenderTargetContext.cpp (renamed from src/gpu/GrDrawContext.cpp)466
-rw-r--r--src/gpu/GrRenderTargetContextPriv.h (renamed from src/gpu/GrDrawContextPriv.h)39
-rw-r--r--src/gpu/GrRenderTargetOpList.cpp27
-rw-r--r--src/gpu/GrRenderTargetOpList.h8
-rw-r--r--src/gpu/GrSWMaskHelper.cpp8
-rw-r--r--src/gpu/GrSWMaskHelper.h2
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp31
-rw-r--r--src/gpu/GrSoftwarePathRenderer.h4
-rw-r--r--src/gpu/GrTextureParamsAdjuster.cpp8
-rw-r--r--src/gpu/GrTextureToYUVPlanes.cpp113
-rw-r--r--src/gpu/GrYUVProvider.cpp17
-rw-r--r--src/gpu/SkGpuDevice.cpp361
-rw-r--r--src/gpu/SkGpuDevice.h28
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp17
-rw-r--r--src/gpu/SkGr.cpp44
-rw-r--r--src/gpu/SkGrPriv.h23
-rw-r--r--src/gpu/batches/GrAAConvexPathRenderer.cpp6
-rw-r--r--src/gpu/batches/GrAADistanceFieldPathRenderer.cpp6
-rw-r--r--src/gpu/batches/GrAAHairLinePathRenderer.cpp9
-rw-r--r--src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp6
-rw-r--r--src/gpu/batches/GrDashLinePathRenderer.cpp6
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.cpp23
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.h2
-rw-r--r--src/gpu/batches/GrMSAAPathRenderer.cpp23
-rw-r--r--src/gpu/batches/GrMSAAPathRenderer.h2
-rw-r--r--src/gpu/batches/GrPLSPathRenderer.cpp5
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp31
-rw-r--r--src/gpu/batches/GrTessellatingPathRenderer.cpp10
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp12
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp4
-rw-r--r--src/gpu/text/GrAtlasTextBlob.cpp37
-rw-r--r--src/gpu/text/GrAtlasTextBlob.h10
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp38
-rw-r--r--src/gpu/text/GrAtlasTextContext.h10
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp51
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.h12
-rw-r--r--src/gpu/text/GrTextUtils.cpp10
-rw-r--r--src/gpu/text/GrTextUtils.h6
-rw-r--r--src/image/SkImage_Gpu.cpp25
-rw-r--r--src/image/SkSurface_Gpu.cpp49
-rw-r--r--tests/ClearTest.cpp147
-rw-r--r--tests/DFPathRendererTest.cpp23
-rw-r--r--tests/GLProgramsTest.cpp56
-rw-r--r--tests/PrimitiveProcessorTest.cpp19
-rw-r--r--tests/RectangleTextureTest.cpp12
-rw-r--r--tests/SRGBMipMapTest.cpp26
-rw-r--r--tests/SurfaceTest.cpp19
-rw-r--r--tests/TessellatingPathRendererTests.cpp56
-rw-r--r--tools/debugger/SkDebugCanvas.cpp2
-rw-r--r--tools/gpu/GrTest.cpp38
-rw-r--r--tools/gpu/GrTest.h6
107 files changed, 1697 insertions, 1583 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);
}
}
}
diff --git a/gn/gpu.gni b/gn/gpu.gni
index 12e3b498a0..f300677de5 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -19,7 +19,6 @@ skia_gpu_sources = [
"$_include/gpu/GrContextOptions.h",
"$_include/gpu/GrContext.h",
"$_include/gpu/GrCoordTransform.h",
- "$_include/gpu/GrDrawContext.h",
"$_include/gpu/GrFragmentProcessor.h",
"$_include/gpu/GrGpuResource.h",
"$_include/gpu/GrInvariantOutput.h",
@@ -29,6 +28,7 @@ skia_gpu_sources = [
"$_include/gpu/GrProgramElement.h",
"$_include/gpu/GrGpuResourceRef.h",
"$_include/gpu/GrRenderTarget.h",
+ "$_include/gpu/GrRenderTargetContext.h",
"$_include/gpu/GrResourceKey.h",
"$_include/gpu/GrShaderVar.h",
"$_include/gpu/GrSurface.h",
@@ -89,10 +89,6 @@ skia_gpu_sources = [
"$_src/gpu/GrCoordTransform.cpp",
"$_src/gpu/GrDefaultGeoProcFactory.cpp",
"$_src/gpu/GrDefaultGeoProcFactory.h",
- "$_src/gpu/GrDrawContext.cpp",
- "$_src/gpu/GrDrawContextPriv.h",
- "$_src/gpu/GrPathRenderingDrawContext.cpp",
- "$_src/gpu/GrPathRenderingDrawContext.h",
"$_src/gpu/GrDrawingManager.cpp",
"$_src/gpu/GrDrawingManager.h",
"$_src/gpu/GrFixedClip.cpp",
@@ -162,6 +158,10 @@ skia_gpu_sources = [
"$_src/gpu/GrRenderTargetProxy.cpp",
"$_src/gpu/GrReducedClip.cpp",
"$_src/gpu/GrReducedClip.h",
+ "$_src/gpu/GrRenderTargetContext.cpp",
+ "$_src/gpu/GrRenderTargetContextPriv.h",
+ "$_src/gpu/GrPathRenderingRenderTargetContext.cpp",
+ "$_src/gpu/GrPathRenderingRenderTargetContext.h",
"$_src/gpu/GrRenderTargetOpList.cpp",
"$_src/gpu/GrRenderTargetOpList.h",
"$_src/gpu/GrResourceCache.cpp",
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index b323b2af8e..c233d91dcf 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -23,7 +23,7 @@
#include "../private/SkShadowParams.h"
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
class SkBaseDevice;
class SkCanvasClipVisitor;
class SkClipStack;
@@ -1371,7 +1371,7 @@ public:
///////////////////////////////////////////////////////////////////////////
// don't call
- GrDrawContext* internal_private_accessTopLayerDrawContext();
+ GrRenderTargetContext* internal_private_accessTopLayerRenderTargetContext();
// don't call
static void Internal_Private_SetIgnoreSaveLayerBounds(bool);
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index c29a65d776..28846229a9 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -343,7 +343,7 @@ private:
/**
* Don't call this!
*/
- virtual GrDrawContext* accessDrawContext() { return nullptr; }
+ virtual GrRenderTargetContext* accessRenderTargetContext() { return nullptr; }
// just called by SkCanvas when built as a layer
void setOrigin(int x, int y) { fOrigin.set(x, y); }
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index 95a663d56d..34989354cd 100644
--- a/include/core/SkMaskFilter.h
+++ b/include/core/SkMaskFilter.h
@@ -18,7 +18,7 @@
class GrClip;
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrPaint;
class GrRenderTarget;
class GrTextureProvider;
@@ -113,7 +113,7 @@ public:
* true if drawing was successful.
*/
virtual bool directFilterMaskGPU(GrTextureProvider* texProvider,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
@@ -124,7 +124,7 @@ public:
* true if drawing was successful.
*/
virtual bool directFilterRRectMaskGPU(GrContext*,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h
index 96c6291ef7..2d4c1f2628 100644
--- a/include/gpu/GrClip.h
+++ b/include/gpu/GrClip.h
@@ -13,7 +13,7 @@
class GrAppliedClip;
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
/**
* GrClip is an abstract base class for applying a clip. It constructs a clip mask if necessary, and
@@ -27,8 +27,8 @@ public:
}
virtual void getConservativeBounds(int width, int height, SkIRect* devResult,
bool* isIntersectionOfRects = nullptr) const = 0;
- virtual bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings,
- GrAppliedClip* out) const = 0;
+ virtual bool apply(GrContext*, GrRenderTargetContext*, bool useHWAA,
+ bool hasUserStencilSettings, GrAppliedClip* out) const = 0;
virtual ~GrClip() {}
@@ -137,7 +137,7 @@ private:
*isIntersectionOfRects = true;
}
}
- bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const final {
+ bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip*) const final {
return true;
}
bool isRRect(const SkRect&, SkRRect*, bool*) const override { return false; }
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 8e5781100e..4c66ac0f47 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -27,7 +27,7 @@ struct GrContextOptions;
class GrContextPriv;
class GrContextThreadSafeProxy;
class GrDrawingManager;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrFragmentProcessor;
class GrGpu;
class GrIndexBuffer;
@@ -181,26 +181,27 @@ public:
int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
/**
- * Create both a GrRenderTarget and a matching GrDrawContext to wrap it.
- * We guarantee that "asTexture" will succeed for drawContexts created
+ * Create both a GrRenderTarget and a matching GrRenderTargetContext to wrap it.
+ * We guarantee that "asTexture" will succeed for renderTargetContexts created
* via this entry point.
*/
- sk_sp<GrDrawContext> makeDrawContext(SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt = 0,
- GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin,
- const SkSurfaceProps* surfaceProps = nullptr,
- SkBudgeted = SkBudgeted::kYes);
+ sk_sp<GrRenderTargetContext> makeRenderTargetContext(
+ SkBackingFit fit,
+ int width, int height,
+ GrPixelConfig config,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 0,
+ GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted = SkBudgeted::kYes);
/*
- * This method will attempt to create a drawContext that has, at least, the number of
+ * This method will attempt to create a renderTargetContext that has, at least, the number of
* channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
* converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
* SRGB-ness will be preserved.
*/
- sk_sp<GrDrawContext> makeDrawContextWithFallback(
+ sk_sp<GrRenderTargetContext> makeRenderTargetContextWithFallback(
SkBackingFit fit,
int width, int height,
GrPixelConfig config,
@@ -333,8 +334,8 @@ public:
const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
GrResourceCache* getResourceCache() { return fResourceCache; }
- // Called by tests that draw directly to the context via GrDrawContext
- void getTestTarget(GrTestTarget*, sk_sp<GrDrawContext>);
+ // Called by tests that draw directly to the context via GrRenderTargetContext
+ void getTestTarget(GrTestTarget*, sk_sp<GrRenderTargetContext>);
/** Reset GPU stats */
void resetGpuStats() const ;
@@ -406,7 +407,7 @@ private:
// In debug builds we guard against improper thread handling
// This guard is passed to the GrDrawingManager and, from there to all the
- // GrDrawContexts. It is also passed to the GrTextureProvider and SkGpuDevice.
+ // GrRenderTargetContexts. It is also passed to the GrTextureProvider and SkGpuDevice.
mutable GrSingleOwner fSingleOwner;
struct CleanUpData {
@@ -422,7 +423,7 @@ private:
GrAuditTrail fAuditTrail;
- // TODO: have the GrClipStackClip use drawContexts and rm this friending
+ // TODO: have the GrClipStackClip use renderTargetContexts and rm this friending
friend class GrContextPriv;
GrContext(); // init must be called after the constructor.
diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h
index 4f26665cbe..075581f6c1 100644
--- a/include/gpu/GrProcessorUnitTest.h
+++ b/include/gpu/GrProcessorUnitTest.h
@@ -15,7 +15,7 @@
class SkMatrix;
class GrCaps;
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
struct GrProcessorTestData;
namespace GrProcessorUnitTest {
@@ -43,19 +43,19 @@ struct GrProcessorTestData {
GrProcessorTestData(SkRandom* random,
GrContext* context,
const GrCaps* caps,
- const GrDrawContext* drawContext,
+ const GrRenderTargetContext* renderTargetContext,
GrTexture* textures[2])
: fRandom(random)
, fContext(context)
, fCaps(caps)
- , fDrawContext(drawContext) {
+ , fRenderTargetContext(renderTargetContext) {
fTextures[0] = textures[0];
fTextures[1] = textures[1];
}
SkRandom* fRandom;
GrContext* fContext;
const GrCaps* fCaps;
- const GrDrawContext* fDrawContext;
+ const GrRenderTargetContext* fRenderTargetContext;
GrTexture* fTextures[2];
};
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrRenderTargetContext.h
index 6e9056dd02..d188230b35 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrRenderTargetContext.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrDrawContext_DEFINED
-#define GrDrawContext_DEFINED
+#ifndef GrRenderTargetContext_DEFINED
+#define GrRenderTargetContext_DEFINED
#include "GrColor.h"
#include "GrContext.h"
@@ -21,7 +21,7 @@
class GrAuditTrail;
class GrClip;
class GrDrawBatch;
-class GrDrawContextPriv;
+class GrRenderTargetContextPriv;
class GrDrawPathBatchBase;
class GrDrawingManager;
class GrFixedClip;
@@ -49,9 +49,9 @@ class SkTextBlob;
/*
* A helper object to orchestrate draws
*/
-class SK_API GrDrawContext : public SkRefCnt {
+class SK_API GrRenderTargetContext : public SkRefCnt {
public:
- ~GrDrawContext() override;
+ ~GrRenderTargetContext() override;
bool copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint);
@@ -286,12 +286,12 @@ public:
void prepareForExternalIO();
/**
- * Reads a rectangle of pixels from the draw context.
+ * Reads a rectangle of pixels from the render target context.
* @param dstInfo image info for the destination
* @param dstBuffer destination pixels for the read
* @param dstRowBytes bytes in a row of 'dstBuffer'
- * @param x x offset w/in the draw context from which to read
- * @param y y offset w/in the draw context from which to read
+ * @param x x offset w/in the render target context from which to read
+ * @param y y offset w/in the render target context from which to read
*
* @return true if the read succeeded, false if not. The read can fail because of an
* unsupported pixel config.
@@ -300,12 +300,12 @@ public:
/**
* Writes a rectangle of pixels [srcInfo, srcBuffer, srcRowbytes] into the
- * drawContext at the specified position.
+ * renderTargetContext at the specified position.
* @param srcInfo image info for the source pixels
* @param srcBuffer source for the write
* @param srcRowBytes bytes in a row of 'srcBuffer'
- * @param x x offset w/in the draw context at which to write
- * @param y y offset w/in the draw context at which to write
+ * @param x x offset w/in the render target context at which to write
+ * @param y y offset w/in the render target context at which to write
*
* @return true if the write succeeded, false if not. The write can fail because of an
* unsupported pixel config.
@@ -346,14 +346,14 @@ public:
sk_sp<GrTexture> asTexture() { return sk_ref_sp(fRenderTarget->asTexture()); }
// Provides access to functions that aren't part of the public API.
- GrDrawContextPriv drawContextPriv();
- const GrDrawContextPriv drawContextPriv() const;
+ GrRenderTargetContextPriv renderTargetContextPriv();
+ const GrRenderTargetContextPriv renderTargetContextPriv() const;
GrAuditTrail* auditTrail() { return fAuditTrail; }
protected:
- GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, sk_sp<SkColorSpace>,
- const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
+ GrRenderTargetContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, sk_sp<SkColorSpace>,
+ const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
GrDrawingManager* drawingManager() { return fDrawingManager; }
@@ -365,7 +365,7 @@ private:
friend class GrStencilAndCoverTextContext; // for access to drawBatch
friend class GrDrawingManager; // for ctor
- friend class GrDrawContextPriv;
+ friend class GrRenderTargetContextPriv;
friend class GrTestTarget; // for access to getOpList
friend class GrSWMaskHelper; // for access to drawBatch
@@ -420,7 +420,7 @@ private:
GrDrawingManager* fDrawingManager;
sk_sp<GrRenderTarget> fRenderTarget;
- // In MDB-mode the GrOpList can be closed by some other drawContext that has picked
+ // In MDB-mode the GrOpList can be closed by some other renderTargetContext that has picked
// it up. For this reason, the GrOpList should only ever be accessed via 'getOpList'.
GrRenderTargetOpList* fOpList;
GrContext* fContext;
diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h
index 0ac4bf3b12..8479599948 100644
--- a/include/gpu/GrSurface.h
+++ b/include/gpu/GrSurface.h
@@ -167,7 +167,7 @@ private:
ReleaseCtx fReleaseCtx;
// The last opList that wrote to or is currently going to write to this surface
- // The opList can be closed (e.g., no draw or copy context is currently bound
+ // The opList can be closed (e.g., no render target or texture context is currently bound
// to this renderTarget or texture).
// This back-pointer is required so that we can add a dependancy between
// the opList used to create the current contents of this surface
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 4e2ad3bf14..79d3450de5 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -91,7 +91,7 @@ private:
bool notifyRefCountIsZero() const { return true; }
// The last opList that wrote to or is currently going to write to this surface
- // The opList can be closed (e.g., no draw context is currently bound
+ // The opList can be closed (e.g., no render target context is currently bound
// to this renderTarget).
// This back-pointer is required so that we can add a dependancy between
// the opList used to create the current contents of this surface
diff --git a/src/core/SkBlurImageFilter.cpp b/src/core/SkBlurImageFilter.cpp
index 3eacab1511..d531b44393 100644
--- a/src/core/SkBlurImageFilter.cpp
+++ b/src/core/SkBlurImageFilter.cpp
@@ -152,7 +152,7 @@ sk_sp<SkSpecialImage> SkBlurImageFilterImpl::onFilterImage(SkSpecialImage* sourc
// We intentionally use the source's color space, not the destination's (from ctx). We
// always blur in the source's config, so we need a compatible color space. We also want to
// avoid doing gamut conversion on every fetch of the texture.
- sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(
+ sk_sp<GrRenderTargetContext> renderTargetContext(SkGpuBlurUtils::GaussianBlur(
context,
inputTexture.get(),
sk_ref_sp(source->getColorSpace()),
@@ -160,14 +160,14 @@ sk_sp<SkSpecialImage> SkBlurImageFilterImpl::onFilterImage(SkSpecialImage* sourc
&inputBounds,
sigma.x(),
sigma.y()));
- if (!drawContext) {
+ if (!renderTargetContext) {
return nullptr;
}
- // TODO: Get the colorSpace from the drawContext (once it has one)
+ // TODO: Get the colorSpace from the renderTargetContext (once it has one)
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
+ renderTargetContext->asTexture(),
sk_ref_sp(input->getColorSpace()), &source->props());
}
#endif
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 7c9f5c6cd5..4e74a77992 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1813,9 +1813,9 @@ const SkRegion& SkCanvas::internal_private_getTotalClip() const {
return fMCRec->fRasterClip.forceGetBW();
}
-GrDrawContext* SkCanvas::internal_private_accessTopLayerDrawContext() {
+GrRenderTargetContext* SkCanvas::internal_private_accessTopLayerRenderTargetContext() {
SkBaseDevice* dev = this->getTopDevice();
- return dev ? dev->accessDrawContext() : nullptr;
+ return dev ? dev->accessRenderTargetContext() : nullptr;
}
GrContext* SkCanvas::getGrContext() {
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index ec3b0a9909..8107642783 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -14,7 +14,7 @@
#include "effects/GrMatrixConvolutionEffect.h"
#include "GrContext.h"
#include "GrCaps.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#define MAX_BLUR_SIGMA 4.0f
@@ -65,7 +65,7 @@ static float adjust_sigma(float sigma, int maxTextureSize, int *scaleFactor, int
return sigma;
}
-static void convolve_gaussian_1d(GrDrawContext* drawContext,
+static void convolve_gaussian_1d(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkIRect& dstRect,
const SkIPoint& srcOffset,
@@ -76,18 +76,18 @@ static void convolve_gaussian_1d(GrDrawContext* drawContext,
bool useBounds,
float bounds[2]) {
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
sk_sp<GrFragmentProcessor> conv(GrConvolutionEffect::MakeGaussian(
texture, direction, radius, sigma, useBounds, bounds));
paint.addColorFragmentProcessor(std::move(conv));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkMatrix localMatrix = SkMatrix::MakeTrans(-SkIntToScalar(srcOffset.x()),
-SkIntToScalar(srcOffset.y()));
- drawContext->fillRectWithLocalMatrix(clip, paint, SkMatrix::I(),
- SkRect::Make(dstRect), localMatrix);
+ renderTargetContext->fillRectWithLocalMatrix(clip, paint, SkMatrix::I(),
+ SkRect::Make(dstRect), localMatrix);
}
-static void convolve_gaussian_2d(GrDrawContext* drawContext,
+static void convolve_gaussian_2d(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkIRect& dstRect,
const SkIPoint& srcOffset,
@@ -102,7 +102,7 @@ static void convolve_gaussian_2d(GrDrawContext* drawContext,
SkISize size = SkISize::Make(2 * radiusX + 1, 2 * radiusY + 1);
SkIPoint kernelOffset = SkIPoint::Make(radiusX, radiusY);
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
SkIRect bounds = srcBounds ? *srcBounds : SkIRect::EmptyIRect();
sk_sp<GrFragmentProcessor> conv(GrMatrixConvolutionEffect::MakeGaussian(
@@ -111,11 +111,11 @@ static void convolve_gaussian_2d(GrDrawContext* drawContext,
true, sigmaX, sigmaY));
paint.addColorFragmentProcessor(std::move(conv));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectWithLocalMatrix(clip, paint, SkMatrix::I(),
- SkRect::Make(dstRect), localMatrix);
+ renderTargetContext->fillRectWithLocalMatrix(clip, paint, SkMatrix::I(),
+ SkRect::Make(dstRect), localMatrix);
}
-static void convolve_gaussian(GrDrawContext* drawContext,
+static void convolve_gaussian(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkIRect& srcRect,
GrTexture* texture,
@@ -127,7 +127,7 @@ static void convolve_gaussian(GrDrawContext* drawContext,
float bounds[2] = { 0.0f, 1.0f };
SkIRect dstRect = SkIRect::MakeWH(srcRect.width(), srcRect.height());
if (!srcBounds) {
- convolve_gaussian_1d(drawContext, clip, dstRect, srcOffset, texture,
+ convolve_gaussian_1d(renderTargetContext, clip, dstRect, srcOffset, texture,
direction, radius, sigma, false, bounds);
return;
}
@@ -158,37 +158,37 @@ static void convolve_gaussian(GrDrawContext* drawContext,
dstRect.fRight = midRect.right();
}
if (!topRect.isEmpty()) {
- drawContext->clear(&topRect, 0, false);
+ renderTargetContext->clear(&topRect, 0, false);
}
if (!bottomRect.isEmpty()) {
- drawContext->clear(&bottomRect, 0, false);
+ renderTargetContext->clear(&bottomRect, 0, false);
}
if (midRect.isEmpty()) {
// Blur radius covers srcBounds; use bounds over entire draw
- convolve_gaussian_1d(drawContext, clip, dstRect, srcOffset, texture,
+ convolve_gaussian_1d(renderTargetContext, clip, dstRect, srcOffset, texture,
direction, radius, sigma, true, bounds);
} else {
// Draw right and left margins with bounds; middle without.
- convolve_gaussian_1d(drawContext, clip, leftRect, srcOffset, texture,
+ convolve_gaussian_1d(renderTargetContext, clip, leftRect, srcOffset, texture,
direction, radius, sigma, true, bounds);
- convolve_gaussian_1d(drawContext, clip, rightRect, srcOffset, texture,
+ convolve_gaussian_1d(renderTargetContext, clip, rightRect, srcOffset, texture,
direction, radius, sigma, true, bounds);
- convolve_gaussian_1d(drawContext, clip, midRect, srcOffset, texture,
+ convolve_gaussian_1d(renderTargetContext, clip, midRect, srcOffset, texture,
direction, radius, sigma, false, bounds);
}
}
namespace SkGpuBlurUtils {
-sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
- GrTexture* origSrc,
- sk_sp<SkColorSpace> colorSpace,
- const SkIRect& dstBounds,
- const SkIRect* srcBounds,
- float sigmaX,
- float sigmaY,
- SkBackingFit fit) {
+sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
+ GrTexture* origSrc,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkIRect& dstBounds,
+ const SkIRect* srcBounds,
+ float sigmaX,
+ float sigmaY,
+ SkBackingFit fit) {
SkASSERT(context);
SkIRect clearRect;
int scaleFactorX, radiusX;
@@ -229,10 +229,9 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
const int height = dstBounds.height();
const GrPixelConfig config = srcTexture->config();
- sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(fit,
- width, height, config, colorSpace,
- 0, kDefault_GrSurfaceOrigin));
- if (!dstDrawContext) {
+ sk_sp<GrRenderTargetContext> dstRenderTargetContext(context->makeRenderTargetContext(
+ fit, width, height, config, colorSpace, 0, kDefault_GrSurfaceOrigin));
+ if (!dstRenderTargetContext) {
return nullptr;
}
@@ -243,26 +242,25 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
// We shouldn't be scaling because this is a small size blur
SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY));
- convolve_gaussian_2d(dstDrawContext.get(), clip, localDstBounds, srcOffset,
+ convolve_gaussian_2d(dstRenderTargetContext.get(), clip, localDstBounds, srcOffset,
srcTexture.get(), radiusX, radiusY, sigmaX, sigmaY, srcBounds);
- return dstDrawContext;
+ return dstRenderTargetContext;
}
- sk_sp<GrDrawContext> tmpDrawContext(context->makeDrawContext(fit,
- width, height, config, colorSpace,
- 0, kDefault_GrSurfaceOrigin));
- if (!tmpDrawContext) {
+ sk_sp<GrRenderTargetContext> tmpRenderTargetContext(context->makeRenderTargetContext(
+ fit, width, height, config, colorSpace, 0, kDefault_GrSurfaceOrigin));
+ if (!tmpRenderTargetContext) {
return nullptr;
}
- sk_sp<GrDrawContext> srcDrawContext;
+ sk_sp<GrRenderTargetContext> srcRenderTargetContext;
SkASSERT(SkIsPow2(scaleFactorX) && SkIsPow2(scaleFactorY));
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
GrPaint paint;
- paint.setGammaCorrect(dstDrawContext->isGammaCorrect());
+ paint.setGammaCorrect(dstRenderTargetContext->isGammaCorrect());
SkMatrix matrix;
matrix.setIDiv(srcTexture->width(), srcTexture->height());
SkIRect dstRect(srcRect);
@@ -288,13 +286,13 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
shrink_irect_by_2(&dstRect, i < scaleFactorX, i < scaleFactorY);
- dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(),
- SkRect::Make(dstRect), SkRect::Make(srcRect));
+ dstRenderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(),
+ SkRect::Make(dstRect), SkRect::Make(srcRect));
- srcDrawContext = dstDrawContext;
+ srcRenderTargetContext = dstRenderTargetContext;
srcRect = dstRect;
- srcTexture = srcDrawContext->asTexture();
- dstDrawContext.swap(tmpDrawContext);
+ srcTexture = srcRenderTargetContext->asTexture();
+ dstRenderTargetContext.swap(tmpRenderTargetContext);
localSrcBounds = srcRect;
}
@@ -302,79 +300,79 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
scale_irect_roundout(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY);
if (sigmaX > 0.0f) {
if (scaleFactorX > 1) {
- SkASSERT(srcDrawContext);
+ SkASSERT(srcRenderTargetContext);
// Clear out a radius to the right of the srcRect to prevent the
// X convolution from reading garbage.
clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop,
radiusX, srcRect.height());
- srcDrawContext->clear(&clearRect, 0x0, false);
+ srcRenderTargetContext->clear(&clearRect, 0x0, false);
}
- convolve_gaussian(dstDrawContext.get(), clip, srcRect,
+ convolve_gaussian(dstRenderTargetContext.get(), clip, srcRect,
srcTexture.get(), Gr1DKernelEffect::kX_Direction, radiusX, sigmaX,
srcBounds, srcOffset);
- srcDrawContext = dstDrawContext;
- srcTexture = srcDrawContext->asTexture();
+ srcRenderTargetContext = dstRenderTargetContext;
+ srcTexture = srcRenderTargetContext->asTexture();
srcRect.offsetTo(0, 0);
- dstDrawContext.swap(tmpDrawContext);
+ dstRenderTargetContext.swap(tmpRenderTargetContext);
localSrcBounds = srcRect;
srcOffset.set(0, 0);
}
if (sigmaY > 0.0f) {
if (scaleFactorY > 1 || sigmaX > 0.0f) {
- SkASSERT(srcDrawContext);
+ SkASSERT(srcRenderTargetContext);
// Clear out a radius below the srcRect to prevent the Y
// convolution from reading garbage.
clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom,
srcRect.width(), radiusY);
- srcDrawContext->clear(&clearRect, 0x0, false);
+ srcRenderTargetContext->clear(&clearRect, 0x0, false);
}
- convolve_gaussian(dstDrawContext.get(), clip, srcRect,
+ convolve_gaussian(dstRenderTargetContext.get(), clip, srcRect,
srcTexture.get(), Gr1DKernelEffect::kY_Direction, radiusY, sigmaY,
srcBounds, srcOffset);
- srcDrawContext = dstDrawContext;
+ srcRenderTargetContext = dstRenderTargetContext;
srcRect.offsetTo(0, 0);
- dstDrawContext.swap(tmpDrawContext);
+ dstRenderTargetContext.swap(tmpRenderTargetContext);
}
- SkASSERT(srcDrawContext);
+ SkASSERT(srcRenderTargetContext);
srcTexture = nullptr; // we don't use this from here on out
if (scaleFactorX > 1 || scaleFactorY > 1) {
// Clear one pixel to the right and below, to accommodate bilinear upsampling.
clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom, srcRect.width() + 1, 1);
- srcDrawContext->clear(&clearRect, 0x0, false);
+ srcRenderTargetContext->clear(&clearRect, 0x0, false);
clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop, 1, srcRect.height());
- srcDrawContext->clear(&clearRect, 0x0, false);
+ srcRenderTargetContext->clear(&clearRect, 0x0, false);
SkMatrix matrix;
- matrix.setIDiv(srcDrawContext->width(), srcDrawContext->height());
+ matrix.setIDiv(srcRenderTargetContext->width(), srcRenderTargetContext->height());
GrPaint paint;
- paint.setGammaCorrect(dstDrawContext->isGammaCorrect());
+ paint.setGammaCorrect(dstRenderTargetContext->isGammaCorrect());
// FIXME: this should be mitchell, not bilinear.
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
- sk_sp<GrTexture> tex(srcDrawContext->asTexture());
+ sk_sp<GrTexture> tex(srcRenderTargetContext->asTexture());
paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkIRect dstRect(srcRect);
scale_irect(&dstRect, scaleFactorX, scaleFactorY);
- dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(),
- SkRect::Make(dstRect), SkRect::Make(srcRect));
+ dstRenderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(),
+ SkRect::Make(dstRect), SkRect::Make(srcRect));
- srcDrawContext = dstDrawContext;
+ srcRenderTargetContext = dstRenderTargetContext;
srcRect = dstRect;
- dstDrawContext.swap(tmpDrawContext);
+ dstRenderTargetContext.swap(tmpRenderTargetContext);
}
- return srcDrawContext;
+ return srcRenderTargetContext;
}
}
diff --git a/src/core/SkGpuBlurUtils.h b/src/core/SkGpuBlurUtils.h
index a12a08873c..7849e8c651 100644
--- a/src/core/SkGpuBlurUtils.h
+++ b/src/core/SkGpuBlurUtils.h
@@ -9,7 +9,7 @@
#define SkGpuBlurUtils_DEFINED
#if SK_SUPPORT_GPU
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
class GrContext;
class GrTexture;
@@ -19,27 +19,28 @@ struct SkRect;
namespace SkGpuBlurUtils {
/**
* Applies a 2D Gaussian blur to a given texture. The blurred result is returned
- * as a drawContext in case the caller wishes to future draw into the result.
+ * as a renderTargetContext in case the caller wishes to future draw into the result.
* Note: one of sigmaX and sigmaY should be non-zero!
* @param context The GPU context
* @param srcTexture The source texture to be blurred.
- * @param colorSpace Color space of the source (used for the drawContext result, too).
+ * @param colorSpace Color space of the source (used for the renderTargetContext result,
+ * too).
* @param dstBounds The destination bounds, relative to the source texture.
* @param srcBounds The source bounds, relative to the source texture. If non-null,
* no pixels will be sampled outside of this rectangle.
* @param sigmaX The blur's standard deviation in X.
* @param sigmaY The blur's standard deviation in Y.
- * @param fit backing fit for the returned draw context
- * @return The drawContext containing the blurred result.
+ * @param fit backing fit for the returned render target context
+ * @return The renderTargetContext containing the blurred result.
*/
- sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
- GrTexture* srcTexture,
- sk_sp<SkColorSpace> colorSpace,
- const SkIRect& dstBounds,
- const SkIRect* srcBounds,
- float sigmaX,
- float sigmaY,
- SkBackingFit fit = SkBackingFit::kApprox);
+ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
+ GrTexture* srcTexture,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkIRect& dstBounds,
+ const SkIRect* srcBounds,
+ float sigmaX,
+ float sigmaY,
+ SkBackingFit fit = SkBackingFit::kApprox);
};
#endif
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 68183cc444..09c26d387e 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -20,7 +20,7 @@
#include "SkWriteBuffer.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#include "SkGrPriv.h"
#endif
@@ -285,24 +285,22 @@ sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
sk_sp<SkColorSpace> colorSpace = sk_ref_sp(outputProperties.colorSpace());
GrPixelConfig config = GrRenderableConfigForColorSpace(colorSpace.get());
- sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApprox,
- bounds.width(), bounds.height(),
- config,
- std::move(colorSpace)));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(), config, std::move(colorSpace)));
+ if (!renderTargetContext) {
return nullptr;
}
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height());
SkRect srcRect = SkRect::Make(bounds);
SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
GrFixedClip clip(dstIRect);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
#endif
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 62cfcf9646..aff95f0ba5 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -314,7 +314,7 @@ bool SkMaskFilter::canFilterMaskGPU(const SkRRect& devRRect,
}
bool SkMaskFilter::directFilterMaskGPU(GrTextureProvider* texProvider,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
@@ -325,7 +325,7 @@ bool SkMaskFilter::canFilterMaskGPU(const SkRRect& devRRect,
bool SkMaskFilter::directFilterRRectMaskGPU(GrContext*,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 85bb61a3e3..b719be2969 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -115,13 +115,13 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRaster(const SkImageInfo& info,
class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
public:
- SkSpecialSurface_Gpu(sk_sp<GrDrawContext> drawContext,
+ SkSpecialSurface_Gpu(sk_sp<GrRenderTargetContext> renderTargetContext,
int width, int height,
const SkIRect& subset)
- : INHERITED(subset, &drawContext->surfaceProps())
- , fDrawContext(std::move(drawContext)) {
+ : INHERITED(subset, &renderTargetContext->surfaceProps())
+ , fRenderTargetContext(std::move(renderTargetContext)) {
- sk_sp<SkBaseDevice> device(SkGpuDevice::Make(fDrawContext, width, height,
+ sk_sp<SkBaseDevice> device(SkGpuDevice::Make(fRenderTargetContext, width, height,
SkGpuDevice::kUninit_InitContents));
if (!device) {
return;
@@ -138,17 +138,17 @@ public:
sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
sk_sp<SkSpecialImage> tmp(SkSpecialImage::MakeFromGpu(
- this->subset(),
- kNeedNewImageUniqueID_SpecialImage,
- fDrawContext->asTexture(),
- sk_ref_sp(fDrawContext->getColorSpace()),
- &this->props()));
- fDrawContext = nullptr;
+ this->subset(),
+ kNeedNewImageUniqueID_SpecialImage,
+ fRenderTargetContext->asTexture(),
+ sk_ref_sp(fRenderTargetContext->getColorSpace()),
+ &this->props()));
+ fRenderTargetContext = nullptr;
return tmp;
}
private:
- sk_sp<GrDrawContext> fDrawContext;
+ sk_sp<GrRenderTargetContext> fRenderTargetContext;
typedef SkSpecialSurface_Base INHERITED;
};
@@ -161,16 +161,15 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
return nullptr;
}
- sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApprox,
- width, height, config,
- std::move(colorSpace)));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, width, height, config, std::move(colorSpace)));
+ if (!renderTargetContext) {
return nullptr;
}
const SkIRect subset = SkIRect::MakeWH(width, height);
- return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, height, subset);
+ return sk_make_sp<SkSpecialSurface_Gpu>(std::move(renderTargetContext), width, height, subset);
}
#endif
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index bbae2e1552..b1c8b21460 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -16,7 +16,7 @@
#if SK_SUPPORT_GPU
#include "GrAlphaThresholdFragmentProcessor.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#endif
@@ -97,28 +97,25 @@ sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex
const SkMatrix& inMatrix,
const SkIRect& bounds) const {
- sk_sp<GrDrawContext> drawContext(context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- bounds.width(),
- bounds.height(),
- kAlpha_8_GrPixelConfig,
- nullptr));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(), kAlpha_8_GrPixelConfig, nullptr));
+ if (!renderTargetContext) {
return nullptr;
}
GrPaint grPaint;
grPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkRegion::Iterator iter(fRegion);
- drawContext->clear(nullptr, 0x0, true);
+ renderTargetContext->clear(nullptr, 0x0, true);
GrFixedClip clip(SkIRect::MakeWH(bounds.width(), bounds.height()));
while (!iter.done()) {
SkRect rect = SkRect::Make(iter.rect());
- drawContext->drawRect(clip, grPaint, inMatrix, rect);
+ renderTargetContext->drawRect(clip, grPaint, inMatrix, rect);
iter.next();
}
- return drawContext->asTexture();
+ return renderTargetContext->asTexture();
}
#endif
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index c32e111f29..e7f660148a 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -18,7 +18,7 @@
#if SK_SUPPORT_GPU
#include "GrCircleBlurFragmentProcessor.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrTexture.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
@@ -50,14 +50,14 @@ public:
const SkMatrix& ctm,
SkRect* maskRect) const override;
bool directFilterMaskGPU(GrTextureProvider* texProvider,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
const SkStrokeRec& strokeRec,
const SkPath& path) const override;
bool directFilterRRectMaskGPU(GrContext*,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip&,
const SkMatrix& viewMatrix,
@@ -1011,13 +1011,13 @@ sk_sp<GrFragmentProcessor> GrRectBlurEffect::TestCreate(GrProcessorTestData* d)
bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkStrokeRec& strokeRec,
const SkPath& path) const {
- SkASSERT(drawContext);
+ SkASSERT(renderTargetContext);
if (fBlurStyle != kNormal_SkBlurStyle) {
return false;
@@ -1059,7 +1059,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
return false;
}
- drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), rect, inverse);
+ renderTargetContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), rect, inverse);
return true;
}
@@ -1121,34 +1121,33 @@ static sk_sp<GrTexture> find_or_create_rrect_blur_mask(GrContext* context,
sk_sp<GrTexture> mask(context->textureProvider()->findAndRefTextureByUniqueKey(key));
if (!mask) {
// TODO: this could be approx but the texture coords will need to be updated
- sk_sp<GrDrawContext> dc(context->makeDrawContextWithFallback(SkBackingFit::kExact,
- size.fWidth, size.fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kExact, size.fWidth, size.fHeight, kAlpha_8_GrPixelConfig, nullptr));
+ if (!rtc) {
return nullptr;
}
GrPaint grPaint;
grPaint.setAntiAlias(doAA);
- dc->clear(nullptr, 0x0, true);
- dc->drawRRect(GrNoClip(), grPaint, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill());
-
- sk_sp<GrTexture> srcTexture(dc->asTexture());
- sk_sp<GrDrawContext> dc2(SkGpuBlurUtils::GaussianBlur(context,
- srcTexture.get(),
- nullptr,
- SkIRect::MakeWH(size.fWidth,
- size.fHeight),
- nullptr,
- xformedSigma, xformedSigma,
- SkBackingFit::kExact));
- if (!dc2) {
+ rtc->clear(nullptr, 0x0, true);
+ rtc->drawRRect(GrNoClip(), grPaint, SkMatrix::I(), rrectToDraw, GrStyle::SimpleFill());
+
+ sk_sp<GrTexture> srcTexture(rtc->asTexture());
+ sk_sp<GrRenderTargetContext> rtc2(SkGpuBlurUtils::GaussianBlur(context,
+ srcTexture.get(),
+ nullptr,
+ SkIRect::MakeWH(
+ size.fWidth,
+ size.fHeight),
+ nullptr,
+ xformedSigma, xformedSigma,
+ SkBackingFit::kExact));
+ if (!rtc2) {
return nullptr;
}
- mask = dc2->asTexture();
+ mask = rtc2->asTexture();
SkASSERT(mask);
context->textureProvider()->assignUniqueKeyToTexture(key, mask.get());
}
@@ -1333,14 +1332,14 @@ GrGLSLFragmentProcessor* GrRRectBlurEffect::onCreateGLSLInstance() const {
}
bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
GrPaint* grp,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkStrokeRec& strokeRec,
const SkRRect& srcRRect,
const SkRRect& devRRect) const {
- SkASSERT(drawContext);
+ SkASSERT(renderTargetContext);
if (fBlurStyle != kNormal_SkBlurStyle) {
return false;
@@ -1380,7 +1379,7 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
SkRect srcProxyRect = srcRRect.rect();
srcProxyRect.outset(3.0f*fSigma, 3.0f*fSigma);
- drawContext->drawRect(clip, newPaint, viewMatrix, srcProxyRect);
+ renderTargetContext->drawRect(clip, newPaint, viewMatrix, srcProxyRect);
return true;
}
@@ -1425,8 +1424,8 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
numIndices = 6;
}
- drawContext->drawVertices(clip, newPaint, viewMatrix, kTriangles_GrPrimitiveType,
- numPoints, points, nullptr, nullptr, indices, numIndices);
+ renderTargetContext->drawVertices(clip, newPaint, viewMatrix, kTriangles_GrPrimitiveType,
+ numPoints, points, nullptr, nullptr, indices, numIndices);
} else {
SkMatrix inverse;
@@ -1439,7 +1438,8 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
proxyRect.outset(extra, extra);
- drawContext->fillRectWithLocalMatrix(clip, newPaint, SkMatrix::I(), proxyRect, inverse);
+ renderTargetContext->fillRectWithLocalMatrix(clip, newPaint, SkMatrix::I(), proxyRect,
+ inverse);
}
return true;
@@ -1502,10 +1502,12 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
// If we're doing a normal blur, we can clobber the pathTexture in the
// gaussianBlur. Otherwise, we need to save it for later compositing.
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
- sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src, nullptr,
- clipRect, nullptr,
- xformedSigma, xformedSigma));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(SkGpuBlurUtils::GaussianBlur(context, src,
+ nullptr, clipRect,
+ nullptr,
+ xformedSigma,
+ xformedSigma));
+ if (!renderTargetContext) {
return false;
}
@@ -1530,10 +1532,10 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
paint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
}
- drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::Make(clipRect));
+ renderTargetContext->drawRect(GrNoClip(), paint, SkMatrix::I(), SkRect::Make(clipRect));
}
- *result = drawContext->asTexture().release();
+ *result = renderTargetContext->asTexture().release();
return true;
}
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 88f5026663..d73b440a75 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -15,7 +15,7 @@
#include "SkColorPriv.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrCoordTransform.h"
#include "GrInvariantOutput.h"
#include "SkGr.h"
@@ -348,23 +348,23 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
SkColorSpace* colorSpace = ctx.outputProperties().colorSpace();
- sk_sp<GrDrawContext> drawContext(
- context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
- GrRenderableConfigForColorSpace(colorSpace),
- sk_ref_sp(colorSpace)));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ context->makeRenderTargetContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
+ GrRenderableConfigForColorSpace(colorSpace),
+ sk_ref_sp(colorSpace)));
+ if (!renderTargetContext) {
return nullptr;
}
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
- drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBounds));
+ renderTargetContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBounds));
offset->fX = bounds.left();
offset->fY = bounds.top();
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
#endif
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 057ef24e95..fc106911b7 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -16,7 +16,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
@@ -369,7 +369,7 @@ protected:
#endif
private:
#if SK_SUPPORT_GPU
- void drawRect(GrDrawContext* drawContext,
+ void drawRect(GrRenderTargetContext* renderTargetContext,
GrTexture* src,
const SkMatrix& matrix,
const GrClip& clip,
@@ -382,7 +382,7 @@ private:
};
#if SK_SUPPORT_GPU
-void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext,
+void SkLightingImageFilterInternal::drawRect(GrRenderTargetContext* renderTargetContext,
GrTexture* src,
const SkMatrix& matrix,
const GrClip& clip,
@@ -392,12 +392,12 @@ void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext,
const SkIRect& bounds) const {
SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()));
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBounds,
boundaryMode));
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
}
sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
@@ -413,11 +413,11 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
sk_sp<GrTexture> inputTexture(input->asTextureRef(context));
SkASSERT(inputTexture);
- sk_sp<GrDrawContext> drawContext(
- context->makeDrawContext(SkBackingFit::kApprox,offsetBounds.width(), offsetBounds.height(),
- GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
- sk_ref_sp(outputProperties.colorSpace())));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox,offsetBounds.width(), offsetBounds.height(),
+ GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
+ sk_ref_sp(outputProperties.colorSpace())));
+ if (!renderTargetContext) {
return nullptr;
}
@@ -439,29 +439,29 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
SkRect bottomRight = SkRect::MakeXYWH(dstRect.width() - 1, dstRect.height() - 1, 1, 1);
const SkIRect* pSrcBounds = inputBounds.contains(offsetBounds) ? nullptr : &inputBounds;
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, topLeft,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, topLeft,
kTopLeft_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, top, kTop_BoundaryMode,
- pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, topRight,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, top,
+ kTop_BoundaryMode, pSrcBounds, offsetBounds);
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, topRight,
kTopRight_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, left, kLeft_BoundaryMode,
- pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, interior,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, left,
+ kLeft_BoundaryMode, pSrcBounds, offsetBounds);
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, interior,
kInterior_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, right, kRight_BoundaryMode,
- pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomLeft,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, right,
+ kRight_BoundaryMode, pSrcBounds, offsetBounds);
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, bottomLeft,
kBottomLeft_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottom,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, bottom,
kBottom_BoundaryMode, pSrcBounds, offsetBounds);
- this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight,
+ this->drawRect(renderTargetContext.get(), inputTexture.get(), matrix, clip, bottomRight,
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
#endif
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index c546730e80..ccff378cee 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -17,7 +17,6 @@
////////////////////////////////////////////////////////////////////////////////
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
#include "GrInvariantOutput.h"
#include "effects/GrSingleTextureEffect.h"
#include "glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 5477d7ab7e..fe6d8acbbe 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -17,7 +17,6 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
#include "effects/GrMatrixConvolutionEffect.h"
#endif
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 2bd792860b..630f782f90 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -17,7 +17,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrFixedClip.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
@@ -385,7 +385,7 @@ sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d
}
-static void apply_morphology_rect(GrDrawContext* drawContext,
+static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrTexture* texture,
const SkIRect& srcRect,
@@ -395,18 +395,18 @@ static void apply_morphology_rect(GrDrawContext* drawContext,
float bounds[2],
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture,
direction,
radius,
morphType,
bounds));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
- SkRect::Make(srcRect));
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
+ SkRect::Make(srcRect));
}
-static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
+static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrTexture* texture,
const SkIRect& srcRect,
@@ -415,15 +415,15 @@ static void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
GrMorphologyEffect::MorphologyType morphType,
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, direction, radius,
morphType));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
- SkRect::Make(srcRect));
+ renderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect),
+ SkRect::Make(srcRect));
}
-static void apply_morphology_pass(GrDrawContext* drawContext,
+static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrTexture* texture,
const SkIRect& srcRect,
@@ -456,16 +456,16 @@ static void apply_morphology_pass(GrDrawContext* drawContext,
}
if (middleSrcRect.fLeft - middleSrcRect.fRight >= 0) {
// radius covers srcRect; use bounds over entire draw
- apply_morphology_rect(drawContext, clip, texture, srcRect, dstRect, radius,
+ apply_morphology_rect(renderTargetContext, clip, texture, srcRect, dstRect, radius,
morphType, bounds, direction);
} else {
// Draw upper and lower margins with bounds; middle without.
- apply_morphology_rect(drawContext, clip, texture, lowerSrcRect, lowerDstRect, radius,
- morphType, bounds, direction);
- apply_morphology_rect(drawContext, clip, texture, upperSrcRect, upperDstRect, radius,
- morphType, bounds, direction);
- apply_morphology_rect_no_bounds(drawContext, clip, texture, middleSrcRect, middleDstRect,
- radius, morphType, direction);
+ apply_morphology_rect(renderTargetContext, clip, texture, lowerSrcRect, lowerDstRect,
+ radius, morphType, bounds, direction);
+ apply_morphology_rect(renderTargetContext, clip, texture, upperSrcRect, upperDstRect,
+ radius, morphType, bounds, direction);
+ apply_morphology_rect_no_bounds(renderTargetContext, clip, texture, middleSrcRect,
+ middleDstRect, radius, morphType, direction);
}
}
@@ -490,14 +490,13 @@ static sk_sp<SkSpecialImage> apply_morphology(
SkASSERT(radius.width() > 0 || radius.height() > 0);
if (radius.fWidth > 0) {
- sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox,
- rect.width(), rect.height(),
- config, colorSpace));
- if (!dstDrawContext) {
+ sk_sp<GrRenderTargetContext> dstRenderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, rect.width(), rect.height(), config, colorSpace));
+ if (!dstRenderTargetContext) {
return nullptr;
}
- apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(),
+ apply_morphology_pass(dstRenderTargetContext.get(), clip, srcTexture.get(),
srcRect, dstRect, radius.fWidth, morphType,
Gr1DKernelEffect::kX_Direction);
SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom,
@@ -505,24 +504,23 @@ static sk_sp<SkSpecialImage> apply_morphology(
GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType
? SK_ColorWHITE
: SK_ColorTRANSPARENT;
- dstDrawContext->clear(&clearRect, clearColor, false);
+ dstRenderTargetContext->clear(&clearRect, clearColor, false);
- srcTexture = dstDrawContext->asTexture();
+ srcTexture = dstRenderTargetContext->asTexture();
srcRect = dstRect;
}
if (radius.fHeight > 0) {
- sk_sp<GrDrawContext> dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox,
- rect.width(), rect.height(),
- config, colorSpace));
- if (!dstDrawContext) {
+ sk_sp<GrRenderTargetContext> dstRenderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, rect.width(), rect.height(), config, colorSpace));
+ if (!dstRenderTargetContext) {
return nullptr;
}
- apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(),
+ apply_morphology_pass(dstRenderTargetContext.get(), clip, srcTexture.get(),
srcRect, dstRect, radius.fHeight, morphType,
Gr1DKernelEffect::kY_Direction);
- srcTexture = dstDrawContext->asTexture();
+ srcTexture = dstRenderTargetContext->asTexture();
}
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 2ceba4b385..6587b749f9 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -17,7 +17,7 @@
#include "SkXfermode.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "effects/GrConstColorProcessor.h"
#include "effects/GrTextureDomain.h"
#include "effects/GrSimpleTextureEffect.h"
@@ -301,23 +301,23 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- sk_sp<GrDrawContext> drawContext(
- context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
- GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
- sk_ref_sp(outputProperties.colorSpace())));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(),
+ GrRenderableConfigForColorSpace(outputProperties.colorSpace()),
+ sk_ref_sp(outputProperties.colorSpace())));
+ if (!renderTargetContext) {
return nullptr;
}
- paint.setGammaCorrect(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(renderTargetContext->isGammaCorrect());
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
- drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
+ renderTargetContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
- drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()));
+ renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()));
}
sk_sp<GrFragmentProcessor>
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index a167101c8c..1c278c35f1 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -6,7 +6,7 @@
*/
#include "GrBlurUtils.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrFixedClip.h"
@@ -27,7 +27,7 @@ static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& r
// Draw a mask using the supplied paint. Since the coverage/geometry
// is already burnt into the mask this boils down to a rect draw.
// Return true if the mask was successfully drawn.
-static bool draw_mask(GrDrawContext* drawContext,
+static bool draw_mask(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkIRect& maskRect,
@@ -43,12 +43,12 @@ static bool draw_mask(GrDrawContext* drawContext,
if (!viewMatrix.invert(&inverse)) {
return false;
}
- drawContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), SkRect::Make(maskRect),
- inverse);
+ renderTargetContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), SkRect::Make(maskRect),
+ inverse);
return true;
}
-static bool sw_draw_with_mask_filter(GrDrawContext* drawContext,
+static bool sw_draw_with_mask_filter(GrRenderTargetContext* renderTargetContext,
GrTextureProvider* textureProvider,
const GrClip& clipData,
const SkMatrix& viewMatrix,
@@ -88,7 +88,7 @@ static bool sw_draw_with_mask_filter(GrDrawContext* drawContext,
texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
dstM.fImage, dstM.fRowBytes);
- return draw_mask(drawContext, clipData, viewMatrix, dstM.fBounds, grp, texture);
+ return draw_mask(renderTargetContext, clipData, viewMatrix, dstM.fBounds, grp, texture);
}
// Create a mask of 'devPath' and place the result in 'mask'.
@@ -103,17 +103,14 @@ static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
sampleCnt = 0;
}
- sk_sp<GrDrawContext> drawContext(context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- maskRect.width(),
- maskRect.height(),
- kAlpha_8_GrPixelConfig,
- nullptr,
- sampleCnt));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, maskRect.width(), maskRect.height(), kAlpha_8_GrPixelConfig, nullptr,
+ sampleCnt));
+ if (!renderTargetContext) {
return nullptr;
}
- drawContext->clear(nullptr, 0x0, true);
+ renderTargetContext->clear(nullptr, 0x0, true);
GrPaint tempPaint;
tempPaint.setAntiAlias(doAA);
@@ -127,12 +124,12 @@ static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
// the origin using tempPaint.
SkMatrix translate;
translate.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop));
- drawContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHairline));
- return drawContext->asTexture();;
+ renderTargetContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHairline));
+ return renderTargetContext->asTexture();;
}
static void draw_path_with_mask_filter(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrPaint* paint,
const SkMatrix& viewMatrix,
@@ -143,7 +140,8 @@ static void draw_path_with_mask_filter(GrContext* context,
SkASSERT(maskFilter);
SkIRect clipBounds;
- clip.getConservativeBounds(drawContext->width(), drawContext->height(), &clipBounds);
+ clip.getConservativeBounds(renderTargetContext->width(), renderTargetContext->height(),
+ &clipBounds);
SkTLazy<SkPath> tmpPath;
SkStrokeRec::InitStyle fillOrHairline;
@@ -195,7 +193,7 @@ static void draw_path_with_mask_filter(GrContext* context,
}
if (maskFilter->directFilterMaskGPU(context->textureProvider(),
- drawContext,
+ renderTargetContext,
paint,
clip,
viewMatrix,
@@ -211,14 +209,14 @@ static void draw_path_with_mask_filter(GrContext* context,
*path,
fillOrHairline,
paint->isAntiAlias(),
- drawContext->numColorSamples()));
+ renderTargetContext->numColorSamples()));
if (mask) {
GrTexture* filtered;
if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered)) {
// filterMaskGPU gives us ownership of a ref to the result
SkAutoTUnref<GrTexture> atu(filtered);
- if (draw_mask(drawContext, clip, viewMatrix, finalIRect, paint, filtered)) {
+ if (draw_mask(renderTargetContext, clip, viewMatrix, finalIRect, paint, filtered)) {
// This path is completely drawn
return;
}
@@ -226,13 +224,13 @@ static void draw_path_with_mask_filter(GrContext* context,
}
}
- sw_draw_with_mask_filter(drawContext, context->textureProvider(),
+ sw_draw_with_mask_filter(renderTargetContext, context->textureProvider(),
clip, viewMatrix, *path,
maskFilter, clipBounds, paint, fillOrHairline);
}
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkPath& path,
GrPaint* paint,
@@ -240,12 +238,12 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
const SkMaskFilter* mf,
const GrStyle& style,
bool pathIsMutable) {
- draw_path_with_mask_filter(context, drawContext, clip, paint, viewMatrix, mf,
+ draw_path_with_mask_filter(context, renderTargetContext, clip, paint, viewMatrix, mf,
style, &path, pathIsMutable);
}
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkPath& origPath,
const SkPaint& paint,
@@ -281,17 +279,17 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;)
GrPaint grPaint;
- if (!SkPaintToGrPaint(context, drawContext, paint, viewMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(context, renderTargetContext, paint, viewMatrix, &grPaint)) {
return;
}
SkMaskFilter* mf = paint.getMaskFilter();
if (mf && !mf->asFragmentProcessor(nullptr, nullptr, viewMatrix)) {
// The MaskFilter wasn't already handled in SkPaintToGrPaint
- draw_path_with_mask_filter(context, drawContext, clip, &grPaint, viewMatrix,
+ draw_path_with_mask_filter(context, renderTargetContext, clip, &grPaint, viewMatrix,
mf, style,
path, pathIsMutable);
} else {
- drawContext->drawPath(clip, grPaint, viewMatrix, *path, style);
+ renderTargetContext->drawPath(clip, grPaint, viewMatrix, *path, style);
}
}
diff --git a/src/gpu/GrBlurUtils.h b/src/gpu/GrBlurUtils.h
index aef1bdba05..090448fb6e 100644
--- a/src/gpu/GrBlurUtils.h
+++ b/src/gpu/GrBlurUtils.h
@@ -10,7 +10,7 @@
class GrClip;
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrPaint;
class GrRenderTarget;
class GrStyle;
@@ -30,7 +30,7 @@ namespace GrBlurUtils {
* Draw a path handling the mask filter if present.
*/
void drawPathWithMaskFilter(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkPath& origSrcPath,
const SkPaint& paint,
@@ -44,7 +44,7 @@ namespace GrBlurUtils {
* optional. The GrPaint will be modified after return.
*/
void drawPathWithMaskFilter(GrContext*,
- GrDrawContext*,
+ GrRenderTargetContext*,
const GrClip&,
const SkPath& path,
GrPaint*,
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 7694a3f403..14c2dbe8ac 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -10,7 +10,7 @@
#include "GrAppliedClip.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
#include "GrRenderTargetPriv.h"
@@ -92,7 +92,7 @@ static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrTexture* result,
// 'prOut' to the non-SW path renderer that will do the job).
bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
bool hasUserStencilSettings,
- const GrDrawContext* drawContext,
+ const GrRenderTargetContext* renderTargetContext,
const SkMatrix& viewMatrix,
const Element* element,
GrPathRenderer** prOut,
@@ -134,7 +134,7 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
canDrawArgs.fShape = &shape;
canDrawArgs.fAntiAlias = element->isAA();
canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings;
- canDrawArgs.fIsStencilBufferMSAA = drawContext->isStencilBufferMultisampled();
+ canDrawArgs.fIsStencilBufferMSAA = renderTargetContext->isStencilBufferMultisampled();
// the 'false' parameter disallows use of the SW path renderer
GrPathRenderer* pr =
@@ -153,7 +153,7 @@ bool GrClipStackClip::PathNeedsSWRenderer(GrContext* context,
*/
bool GrClipStackClip::UseSWOnlyPath(GrContext* context,
bool hasUserStencilSettings,
- const GrDrawContext* drawContext,
+ const GrRenderTargetContext* renderTargetContext,
const GrReducedClip& reducedClip) {
// TODO: generalize this function so that when
// a clip gets complex enough it can just be done in SW regardless
@@ -173,7 +173,7 @@ bool GrClipStackClip::UseSWOnlyPath(GrContext* context,
SkCanvas::kIntersect_Op == op || SkCanvas::kReverseDifference_Op == op;
if (PathNeedsSWRenderer(context, hasUserStencilSettings,
- drawContext, translate, element, nullptr, needsStencil)) {
+ renderTargetContext, translate, element, nullptr, needsStencil)) {
return true;
}
}
@@ -262,18 +262,18 @@ static bool get_analytic_clip_processor(const ElementList& elements,
////////////////////////////////////////////////////////////////////////////////
// sort out what kind of clip mask needs to be created: alpha, stencil,
// scissor, or entirely software
-bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool useHWAA,
- bool hasUserStencilSettings, GrAppliedClip* out) const {
+bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTargetContext,
+ bool useHWAA, bool hasUserStencilSettings, GrAppliedClip* out) const {
if (!fStack || fStack->isWideOpen()) {
return true;
}
- SkRect devBounds = SkRect::MakeIWH(drawContext->width(), drawContext->height());
+ SkRect devBounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
if (!devBounds.intersect(out->clippedDrawBounds())) {
return false;
}
- GrRenderTarget* rt = drawContext->accessRenderTarget();
+ GrRenderTarget* rt = renderTargetContext->accessRenderTarget();
const SkScalar clipX = SkIntToScalar(fOrigin.x()),
clipY = SkIntToScalar(fOrigin.y());
@@ -311,8 +311,8 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
if (reducedClip.elements().count() <= kMaxAnalyticElements) {
// When there are multiple samples we want to do per-sample clipping, not compute a
// fractional pixel coverage.
- bool disallowAnalyticAA = drawContext->isStencilBufferMultisampled();
- if (disallowAnalyticAA && !drawContext->numColorSamples()) {
+ bool disallowAnalyticAA = renderTargetContext->isStencilBufferMultisampled();
+ if (disallowAnalyticAA && !renderTargetContext->numColorSamples()) {
// With a single color sample, any coverage info is lost from color once it hits the
// color buffer anyway, so we may as well use coverage AA if nothing else in the pipe
// is multisampled.
@@ -328,9 +328,9 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
}
// If the stencil buffer is multisampled we can use it to do everything.
- if (!drawContext->isStencilBufferMultisampled() && reducedClip.requiresAA()) {
+ if (!renderTargetContext->isStencilBufferMultisampled() && reducedClip.requiresAA()) {
sk_sp<GrTexture> result;
- if (UseSWOnlyPath(context, hasUserStencilSettings, drawContext, reducedClip)) {
+ if (UseSWOnlyPath(context, hasUserStencilSettings, renderTargetContext, reducedClip)) {
// The clip geometry is complex enough that it will be more efficient to create it
// entirely in software
result = CreateSoftwareClipMask(context->textureProvider(), reducedClip);
@@ -365,7 +365,7 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
// after clipping is overhauled.
if (stencilAttachment->mustRenderClip(reducedClip.elementsGenID(), reducedClip.ibounds(),
fOrigin)) {
- reducedClip.drawStencilClipMask(context, drawContext, fOrigin);
+ reducedClip.drawStencilClipMask(context, renderTargetContext, fOrigin);
stencilAttachment->setLastClip(reducedClip.elementsGenID(), reducedClip.ibounds(),
fOrigin);
}
@@ -393,20 +393,21 @@ sk_sp<GrTexture> GrClipStackClip::CreateAlphaClipMask(GrContext* context,
return sk_sp<GrTexture>(texture);
}
- sk_sp<GrDrawContext> dc(context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- reducedClip.width(),
- reducedClip.height(),
- kAlpha_8_GrPixelConfig,
- nullptr));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ reducedClip.width(),
+ reducedClip.height(),
+ kAlpha_8_GrPixelConfig,
+ nullptr));
+ if (!rtc) {
return nullptr;
}
- if (!reducedClip.drawAlphaClipMask(dc.get())) {
+ if (!reducedClip.drawAlphaClipMask(rtc.get())) {
return nullptr;
}
- sk_sp<GrTexture> texture(dc->asTexture());
+ sk_sp<GrTexture> texture(rtc->asTexture());
SkASSERT(texture);
texture->resourcePriv().setUniqueKey(key);
return texture;
diff --git a/src/gpu/GrClipStackClip.h b/src/gpu/GrClipStackClip.h
index 075d1d857d..4e99955a09 100644
--- a/src/gpu/GrClipStackClip.h
+++ b/src/gpu/GrClipStackClip.h
@@ -35,7 +35,7 @@ public:
bool quickContains(const SkRRect&) const final;
void getConservativeBounds(int width, int height, SkIRect* devResult,
bool* isIntersectionOfRects) const final;
- bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings,
+ bool apply(GrContext*, GrRenderTargetContext*, bool useHWAA, bool hasUserStencilSettings,
GrAppliedClip* out) const final;
bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override;
@@ -43,7 +43,7 @@ public:
private:
static bool PathNeedsSWRenderer(GrContext* context,
bool hasUserStencilSettings,
- const GrDrawContext*,
+ const GrRenderTargetContext*,
const SkMatrix& viewMatrix,
const SkClipStack::Element* element,
GrPathRenderer** prOut,
@@ -58,7 +58,7 @@ private:
static bool UseSWOnlyPath(GrContext*,
bool hasUserStencilSettings,
- const GrDrawContext*,
+ const GrRenderTargetContext*,
const GrReducedClip&);
static GrTexture* CreateCachedMask(int width, int height, const GrUniqueKey& key,
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index dfb2fce279..6fb68c6008 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -9,7 +9,7 @@
#include "GrContextPriv.h"
#include "GrContextOptions.h"
#include "GrDrawingManager.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrResourceCache.h"
#include "GrResourceProvider.h"
#include "GrSoftwarePathRenderer.h"
@@ -208,9 +208,10 @@ void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
void GrContext::TextBlobCacheOverBudgetCB(void* data) {
SkASSERT(data);
- // TextBlobs are drawn at the SkGpuDevice level, therefore they cannot rely on GrDrawContext
- // to perform a necessary flush. The solution is to move drawText calls to below the GrContext
- // level, but this is not trivial because they call drawPath on SkGpuDevice.
+ // TextBlobs are drawn at the SkGpuDevice level, therefore they cannot rely on
+ // GrRenderTargetContext to perform a necessary flush. The solution is to move drawText calls
+ // to below the GrContext level, but this is not trivial because they call drawPath on
+ // SkGpuDevice.
GrContext* context = reinterpret_cast<GrContext*>(data);
context->flush();
}
@@ -348,10 +349,10 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
// TODO: Need to decide the semantics of this function for color spaces. Do we support
// conversion from a passed-in color space? For now, specifying nullptr means that this
// path will do no conversion, so it will match the behavior of the non-draw path.
- sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDrawContext(
- sk_ref_sp(renderTarget),
- nullptr));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(renderTarget),
+ nullptr));
+ if (!renderTargetContext) {
return false;
}
GrPaint paint;
@@ -359,7 +360,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.setAllowSRGBInputs(true);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
- drawContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
+ renderTargetContext->drawRect(GrNoClip(), paint, matrix, rect, nullptr);
if (kFlushWrites_PixelOp & pixelOpsFlags) {
this->flushSurfaceWrites(surface);
@@ -440,7 +441,8 @@ bool GrContext::readSurfacePixels(GrSurface* src,
// TODO: Need to decide the semantics of this function for color spaces. Do we support
// conversion to a passed-in color space? For now, specifying nullptr means that this
// path will do no conversion, so it will match the behavior of the non-draw path.
- sk_sp<GrDrawContext> tempDC = this->makeDrawContext(tempDrawInfo.fTempSurfaceFit,
+ sk_sp<GrRenderTargetContext> tempDC = this->makeRenderTargetContext(
+ tempDrawInfo.fTempSurfaceFit,
tempDrawInfo.fTempSurfaceDesc.fWidth,
tempDrawInfo.fTempSurfaceDesc.fHeight,
tempDrawInfo.fTempSurfaceDesc.fConfig,
@@ -544,22 +546,22 @@ bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
&clippedSrcRect, &clippedDstPoint)) {
return false;
}
- // If we don't have an RT for the dst then we won't have a GrDrawContext to insert the
+ // If we don't have an RT for the dst then we won't have a GrRenderTargetContext to insert
// the copy surface into. In the future we plan to have a more limited Context type
- // (GrCopyContext?) that has the subset of GrDrawContext operations that should be
+ // (GrCopyContext?) that has the subset of GrRenderTargetContext operations that should be
// allowed on textures that aren't render targets.
// For now we just flush any writes to the src and issue an immediate copy to the dst.
src->flushWrites();
return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint);
}
- sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDrawContext(
- sk_ref_sp(dst->asRenderTarget()),
- nullptr));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(dst->asRenderTarget()),
+ nullptr));
+ if (!renderTargetContext) {
return false;
}
- if (!drawContext->copySurface(src, srcRect, dstPoint)) {
+ if (!renderTargetContext->copySurface(src, srcRect, dstPoint)) {
return false;
}
return true;
@@ -600,19 +602,20 @@ int GrContext::getRecommendedSampleCount(GrPixelConfig config,
return chosenSampleCount <= fGpu->caps()->maxSampleCount() ? chosenSampleCount : 0;
}
-sk_sp<GrDrawContext> GrContextPriv::makeWrappedDrawContext(sk_sp<GrRenderTarget> rt,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* surfaceProps) {
+sk_sp<GrRenderTargetContext> GrContextPriv::makeWrappedRenderTargetContext(
+ sk_sp<GrRenderTarget> rt,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps) {
ASSERT_SINGLE_OWNER_PRIV
- return this->drawingManager()->makeDrawContext(std::move(rt),
- std::move(colorSpace),
- surfaceProps);
+ return this->drawingManager()->makeRenderTargetContext(std::move(rt), std::move(colorSpace),
+ surfaceProps);
}
-sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureDrawContext(const GrBackendTextureDesc& desc,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* props,
- GrWrapOwnership ownership) {
+sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContext(
+ const GrBackendTextureDesc& desc,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* props,
+ GrWrapOwnership ownership) {
ASSERT_SINGLE_OWNER_PRIV
SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag);
@@ -621,11 +624,11 @@ sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureDrawContext(const GrBacken
return nullptr;
}
- return this->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRenderTarget()),
- std::move(colorSpace), props);
+ return this->drawingManager()->makeRenderTargetContext(sk_ref_sp(surface->asRenderTarget()),
+ std::move(colorSpace), props);
}
-sk_sp<GrDrawContext> GrContextPriv::makeBackendRenderTargetDrawContext(
+sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetContext(
const GrBackendRenderTargetDesc& desc,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
@@ -636,12 +639,11 @@ sk_sp<GrDrawContext> GrContextPriv::makeBackendRenderTargetDrawContext(
return nullptr;
}
- return this->drawingManager()->makeDrawContext(std::move(rt),
- std::move(colorSpace),
- surfaceProps);
+ return this->drawingManager()->makeRenderTargetContext(std::move(rt), std::move(colorSpace),
+ surfaceProps);
}
-sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureAsRenderTargetDrawContext(
+sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRenderTargetContext(
const GrBackendTextureDesc& desc,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
@@ -653,9 +655,8 @@ sk_sp<GrDrawContext> GrContextPriv::makeBackendTextureAsRenderTargetDrawContext(
return nullptr;
}
- return this->drawingManager()->makeDrawContext(sk_ref_sp(surface->asRenderTarget()),
- std::move(colorSpace),
- surfaceProps);
+ return this->drawingManager()->makeRenderTargetContext(sk_ref_sp(surface->asRenderTarget()),
+ std::move(colorSpace), surfaceProps);
}
static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
@@ -698,30 +699,31 @@ static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFallback) == kGrPixelConfigCnt);
}
-sk_sp<GrDrawContext> GrContext::makeDrawContextWithFallback(SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
+sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContextWithFallback(
+ SkBackingFit fit,
+ int width, int height,
+ GrPixelConfig config,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted) {
if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
config = GrPixelConfigFallback(config);
}
- return this->makeDrawContext(fit, width, height, config, std::move(colorSpace),
- sampleCnt, origin, surfaceProps, budgeted);
+ return this->makeRenderTargetContext(fit, width, height, config, std::move(colorSpace),
+ sampleCnt, origin, surfaceProps, budgeted);
}
-sk_sp<GrDrawContext> GrContext::makeDrawContext(SkBackingFit fit,
- int width, int height,
- GrPixelConfig config,
- sk_sp<SkColorSpace> colorSpace,
- int sampleCnt,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps,
- SkBudgeted budgeted) {
+sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContext(SkBackingFit fit,
+ int width, int height,
+ GrPixelConfig config,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted) {
if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
return nullptr;
}
@@ -744,14 +746,14 @@ sk_sp<GrDrawContext> GrContext::makeDrawContext(SkBackingFit fit,
return nullptr;
}
- sk_sp<GrDrawContext> drawContext(this->contextPriv().makeWrappedDrawContext(
- sk_ref_sp(tex->asRenderTarget()),
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(tex->asRenderTarget()),
std::move(colorSpace), surfaceProps));
- if (!drawContext) {
+ if (!renderTargetContext) {
return nullptr;
}
- return drawContext;
+ return renderTargetContext;
}
bool GrContext::abandoned() const {
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 398fc8a549..d2fa7c1610 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -17,21 +17,23 @@ class GrContextPriv {
public:
GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); }
- // Create a drawContext that wraps an existing renderTarget
- sk_sp<GrDrawContext> makeWrappedDrawContext(sk_sp<GrRenderTarget> rt,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* = nullptr);
-
- sk_sp<GrDrawContext> makeBackendTextureDrawContext(const GrBackendTextureDesc& desc,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* = nullptr,
- GrWrapOwnership = kBorrow_GrWrapOwnership);
-
- sk_sp<GrDrawContext> makeBackendRenderTargetDrawContext(const GrBackendRenderTargetDesc& desc,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* = nullptr);
-
- sk_sp<GrDrawContext> makeBackendTextureAsRenderTargetDrawContext(
+ // Create a renderTargetContext that wraps an existing renderTarget
+ sk_sp<GrRenderTargetContext> makeWrappedRenderTargetContext(sk_sp<GrRenderTarget> rt,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* = nullptr);
+
+ sk_sp<GrRenderTargetContext> makeBackendTextureRenderTargetContext(
+ const GrBackendTextureDesc& desc,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* = nullptr,
+ GrWrapOwnership = kBorrow_GrWrapOwnership);
+
+ sk_sp<GrRenderTargetContext> makeBackendRenderTargetRenderTargetContext(
+ const GrBackendRenderTargetDesc& desc,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* = nullptr);
+
+ sk_sp<GrRenderTargetContext> makeBackendTextureAsRenderTargetRenderTargetContext(
const GrBackendTextureDesc& desc,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* = nullptr);
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 0fe173dac3..0198f2fead 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -8,8 +8,8 @@
#include "GrDrawingManager.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
-#include "GrPathRenderingDrawContext.h"
+#include "GrRenderTargetContext.h"
+#include "GrPathRenderingRenderTargetContext.h"
#include "GrResourceProvider.h"
#include "GrSoftwarePathRenderer.h"
#include "GrSurfacePriv.h"
@@ -207,9 +207,10 @@ GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawP
return pr;
}
-sk_sp<GrDrawContext> GrDrawingManager::makeDrawContext(sk_sp<GrRenderTarget> rt,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* surfaceProps) {
+sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
+ sk_sp<GrRenderTarget> rt,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps) {
if (this->wasAbandoned()) {
return nullptr;
}
@@ -231,15 +232,16 @@ sk_sp<GrDrawContext> GrDrawingManager::makeDrawContext(sk_sp<GrRenderTarget> rt,
rt->isStencilBufferMultisampled()) {
GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAttachment(rt.get());
if (sb) {
- return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext(
+ return sk_sp<GrRenderTargetContext>(new GrPathRenderingRenderTargetContext(
fContext, this, std::move(rt),
std::move(colorSpace), surfaceProps,
fContext->getAuditTrail(), fSingleOwner));
}
}
- return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
- std::move(colorSpace), surfaceProps,
- fContext->getAuditTrail(),
- fSingleOwner));
+ return sk_sp<GrRenderTargetContext>(new GrRenderTargetContext(fContext, this, std::move(rt),
+ std::move(colorSpace),
+ surfaceProps,
+ fContext->getAuditTrail(),
+ fSingleOwner));
}
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 838bb9b75e..6b502665bf 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -18,14 +18,14 @@
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrSingleOWner;
class GrSoftwarePathRenderer;
-// The GrDrawingManager allocates a new GrDrawContext for each GrRenderTarget
+// The GrDrawingManager allocates a new GrRenderTargetContext for each GrRenderTarget
// but all of them still land in the same GrOpList!
//
-// In the future this class will allocate a new GrDrawContext for
+// In the future this class will allocate a new GrRenderTargetContext for
// each GrRenderTarget/GrOpList and manage the DAG.
class GrDrawingManager {
public:
@@ -34,9 +34,9 @@ public:
bool wasAbandoned() const { return fAbandoned; }
void freeGpuResources();
- sk_sp<GrDrawContext> makeDrawContext(sk_sp<GrRenderTarget> rt,
- sk_sp<SkColorSpace>,
- const SkSurfaceProps*);
+ sk_sp<GrRenderTargetContext> makeRenderTargetContext(sk_sp<GrRenderTarget> rt,
+ sk_sp<SkColorSpace>,
+ const SkSurfaceProps*);
// The caller automatically gets a ref on the returned opList. It must
// be balanced by an unref call.
diff --git a/src/gpu/GrFixedClip.cpp b/src/gpu/GrFixedClip.cpp
index 7385028baf..79e26624d2 100644
--- a/src/gpu/GrFixedClip.cpp
+++ b/src/gpu/GrFixedClip.cpp
@@ -8,7 +8,7 @@
#include "GrFixedClip.h"
#include "GrAppliedClip.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
bool GrFixedClip::quickContains(const SkRect& rect) const {
if (fWindowRectsState.enabled()) {
@@ -45,9 +45,10 @@ bool GrFixedClip::isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const {
return false;
};
-bool GrFixedClip::apply(GrContext*, GrDrawContext* dc, bool, bool, GrAppliedClip* out) const {
+bool GrFixedClip::apply(GrContext*, GrRenderTargetContext* rtc,
+ bool, bool, GrAppliedClip* out) const {
if (fScissorState.enabled()) {
- SkIRect tightScissor = SkIRect::MakeWH(dc->width(), dc->height());
+ SkIRect tightScissor = SkIRect::MakeWH(rtc->width(), rtc->height());
if (!tightScissor.intersect(fScissorState.rect())) {
return false;
}
diff --git a/src/gpu/GrFixedClip.h b/src/gpu/GrFixedClip.h
index 6fb7d23ed1..6c350d5cba 100644
--- a/src/gpu/GrFixedClip.h
+++ b/src/gpu/GrFixedClip.h
@@ -43,7 +43,7 @@ public:
bool quickContains(const SkRect&) const override;
void getConservativeBounds(int w, int h, SkIRect* devResult, bool* iior) const override;
bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override;
- bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip* out) const override;
+ bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out) const override;
static const GrFixedClip& Disabled();
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 3ac18144e0..2b5ccdc883 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -9,7 +9,7 @@
#define GrPathRenderer_DEFINED
#include "GrCaps.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrPaint.h"
#include "GrResourceProvider.h"
#include "GrShape.h"
@@ -129,7 +129,7 @@ public:
const GrPaint* fPaint;
const GrUserStencilSettings*fUserStencilSettings;
- GrDrawContext* fDrawContext;
+ GrRenderTargetContext* fRenderTargetContext;
const GrClip* fClip;
const SkMatrix* fViewMatrix;
const GrShape* fShape;
@@ -140,7 +140,7 @@ public:
SkASSERT(fResourceProvider);
SkASSERT(fPaint);
SkASSERT(fUserStencilSettings);
- SkASSERT(fDrawContext);
+ SkASSERT(fRenderTargetContext);
SkASSERT(fClip);
SkASSERT(fViewMatrix);
SkASSERT(fShape);
@@ -162,7 +162,7 @@ public:
canArgs.fAntiAlias = args.fAntiAlias;
canArgs.fHasUserStencilSettings = !args.fUserStencilSettings->isUnused();
- canArgs.fIsStencilBufferMSAA = args.fDrawContext->isStencilBufferMultisampled();
+ canArgs.fIsStencilBufferMSAA = args.fRenderTargetContext->isStencilBufferMultisampled();
SkASSERT(this->canDrawPath(canArgs));
if (!args.fUserStencilSettings->isUnused()) {
SkPath path;
@@ -177,23 +177,23 @@ public:
/* Args to stencilPath().
*
* fResourceProvider The resource provider for creating gpu resources to render the path
- * fDrawContext The target of the draws
+ * fRenderTargetContext The target of the draws
* fViewMatrix Matrix applied to the path.
* fPath The path to draw.
* fIsAA Is the path to be drawn AA (only set when MSAA is available)
*/
struct StencilPathArgs {
- GrResourceProvider* fResourceProvider;
- GrDrawContext* fDrawContext;
- const GrClip* fClip;
- const SkMatrix* fViewMatrix;
- bool fIsAA;
- const GrShape* fShape;
+ GrResourceProvider* fResourceProvider;
+ GrRenderTargetContext* fRenderTargetContext;
+ const GrClip* fClip;
+ const SkMatrix* fViewMatrix;
+ bool fIsAA;
+ const GrShape* fShape;
#ifdef SK_DEBUG
void validate() const {
SkASSERT(fResourceProvider);
- SkASSERT(fDrawContext);
+ SkASSERT(fRenderTargetContext);
SkASSERT(fViewMatrix);
SkASSERT(fShape);
SkASSERT(fShape->style().isSimpleFill());
@@ -280,7 +280,7 @@ private:
drawArgs.fResourceProvider = args.fResourceProvider;
drawArgs.fPaint = &paint;
drawArgs.fUserStencilSettings = &kIncrementStencil;
- drawArgs.fDrawContext = args.fDrawContext;
+ drawArgs.fRenderTargetContext = args.fRenderTargetContext;
drawArgs.fViewMatrix = args.fViewMatrix;
drawArgs.fShape = args.fShape;
drawArgs.fAntiAlias = false; // In this case the MSAA handles the AA so we want to draw BW
diff --git a/src/gpu/GrPathRenderingDrawContext.cpp b/src/gpu/GrPathRenderingRenderTargetContext.cpp
index 1380f7dc78..f2d092abe3 100644
--- a/src/gpu/GrPathRenderingDrawContext.cpp
+++ b/src/gpu/GrPathRenderingRenderTargetContext.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "GrPathRenderingDrawContext.h"
+#include "GrPathRenderingRenderTargetContext.h"
#include "GrDrawingManager.h"
@@ -15,15 +15,15 @@
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
#define RETURN_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return; }
-void GrPathRenderingDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint,
- const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const char text[],
- size_t byteLength, SkScalar x, SkScalar y,
- const SkIRect& clipBounds) {
+void GrPathRenderingRenderTargetContext::drawText(const GrClip& clip, const GrPaint& grPaint,
+ const SkPaint& skPaint,
+ const SkMatrix& viewMatrix, const char text[],
+ size_t byteLength, SkScalar x, SkScalar y,
+ const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::drawText");
+ GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingRenderTargetContext::drawText");
if (!fStencilAndCoverTextContext) {
GrAtlasTextContext* fallbackContext = this->drawingManager()->getAtlasTextContext();
@@ -35,16 +35,17 @@ void GrPathRenderingDrawContext::drawText(const GrClip& clip, const GrPaint& gr
text, byteLength, x, y, clipBounds);
}
-void GrPathRenderingDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
- const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const char text[],
- size_t byteLength, const SkScalar pos[],
- int scalarsPerPosition, const SkPoint& offset,
- const SkIRect& clipBounds) {
+void GrPathRenderingRenderTargetContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
+ const SkPaint& skPaint,
+ const SkMatrix& viewMatrix, const char text[],
+ size_t byteLength, const SkScalar pos[],
+ int scalarsPerPosition, const SkPoint& offset,
+ const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::drawPosText");
+ GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(),
+ "GrPathRenderingRenderTargetContext::drawPosText");
if (!fStencilAndCoverTextContext) {
GrAtlasTextContext* fallbackContext = this->drawingManager()->getAtlasTextContext();
@@ -57,14 +58,17 @@ void GrPathRenderingDrawContext::drawPosText(const GrClip& clip, const GrPaint&
clipBounds);
}
-void GrPathRenderingDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const SkTextBlob* blob,
- SkScalar x, SkScalar y,
- SkDrawFilter* filter, const SkIRect& clipBounds) {
+void GrPathRenderingRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
+ const SkMatrix& viewMatrix,
+ const SkTextBlob* blob,
+ SkScalar x, SkScalar y,
+ SkDrawFilter* filter,
+ const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(), "GrPathRenderingDrawContext::drawTextBlob");
+ GR_AUDIT_TRAIL_AUTO_FRAME(this->auditTrail(),
+ "GrPathRenderingRenderTargetContext::drawTextBlob");
if (!fStencilAndCoverTextContext) {
GrAtlasTextContext* fallbackContext = this->drawingManager()->getAtlasTextContext();
diff --git a/src/gpu/GrPathRenderingDrawContext.h b/src/gpu/GrPathRenderingRenderTargetContext.h
index 5c1a968b17..b19876e7f7 100644
--- a/src/gpu/GrPathRenderingDrawContext.h
+++ b/src/gpu/GrPathRenderingRenderTargetContext.h
@@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
-#ifndef GrPathRenderingDrawContext_DEFINED
-#define GrPathRenderingDrawContext_DEFINED
+#ifndef GrPathRenderingRenderTargetContext_DEFINED
+#define GrPathRenderingRenderTargetContext_DEFINED
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
class GrStencilAndCoverTextContext;
-class GrPathRenderingDrawContext : public GrDrawContext {
+class GrPathRenderingRenderTargetContext : public GrRenderTargetContext {
public:
void drawText(const GrClip&, const GrPaint&, const SkPaint&,
const SkMatrix& viewMatrix, const char text[], size_t byteLength,
@@ -26,9 +26,10 @@ public:
SkScalar x, SkScalar y,
SkDrawFilter*, const SkIRect& clipBounds) override;
protected:
- GrPathRenderingDrawContext(GrContext* ctx, GrDrawingManager* mgr, sk_sp<GrRenderTarget> rt,
- sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* surfaceProps,
- GrAuditTrail* at, GrSingleOwner* so)
+ GrPathRenderingRenderTargetContext(GrContext* ctx, GrDrawingManager* mgr,
+ sk_sp<GrRenderTarget> rt, sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps, GrAuditTrail* at,
+ GrSingleOwner* so)
: INHERITED(ctx, mgr, std::move(rt), std::move(colorSpace), surfaceProps, at, so) {}
private:
@@ -36,7 +37,7 @@ private:
friend class GrDrawingManager; // for ctor
- typedef GrDrawContext INHERITED;
+ typedef GrRenderTargetContext INHERITED;
};
#endif
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 5e658fcc87..08ffeb58b5 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -8,7 +8,7 @@
#include "GrPipeline.h"
#include "GrCaps.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpu.h"
#include "GrPipelineBuilder.h"
#include "GrProcOptInfo.h"
@@ -23,7 +23,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
const GrPipelineBuilder& builder = *args.fPipelineBuilder;
GrPipeline* pipeline = new (memory) GrPipeline;
- GrRenderTarget* rt = args.fDrawContext->accessRenderTarget();
+ GrRenderTarget* rt = args.fRenderTargetContext->accessRenderTarget();
pipeline->fRenderTarget.reset(rt);
SkASSERT(pipeline->fRenderTarget);
pipeline->fScissorState = *args.fScissor;
@@ -57,7 +57,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
}
// Create XferProcessor from DS's XPFactory
- bool hasMixedSamples = args.fDrawContext->hasMixedSamples() &&
+ bool hasMixedSamples = args.fRenderTargetContext->hasMixedSamples() &&
(builder.isHWAntialias() || !pipeline->fStencilSettings.isDisabled());
const GrXPFactory* xpFactory = builder.getXPFactory();
SkAutoTUnref<GrXferProcessor> xferProcessor;
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 6330de18d9..10ccc80aa5 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -27,7 +27,7 @@
#include "effects/GrSimpleTextureEffect.h"
class GrBatch;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrDeviceCoordTexture;
class GrPipelineBuilder;
@@ -55,7 +55,7 @@ public:
struct CreateArgs {
const GrPipelineBuilder* fPipelineBuilder;
- GrDrawContext* fDrawContext;
+ GrRenderTargetContext* fRenderTargetContext;
const GrCaps* fCaps;
GrPipelineOptimizations fOpts;
const GrScissorState* fScissor;
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 4a912d3b59..d390832be0 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -11,8 +11,8 @@
#include "GrClip.h"
#include "GrColor.h"
#include "GrContextPriv.h"
-#include "GrDrawContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContext.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrPathRenderer.h"
@@ -523,7 +523,7 @@ inline bool GrReducedClip::intersectIBounds(const SkIRect& irect) {
////////////////////////////////////////////////////////////////////////////////
// Create a 8-bit clip mask in alpha
-static bool stencil_element(GrDrawContext* dc,
+static bool stencil_element(GrRenderTargetContext* rtc,
const GrFixedClip& clip,
const GrUserStencilSettings* ss,
const SkMatrix& viewMatrix,
@@ -535,11 +535,12 @@ static bool stencil_element(GrDrawContext* dc,
SkDEBUGFAIL("Should never get here with an empty element.");
break;
case Element::kRect_Type:
- return dc->drawContextPriv().drawAndStencilRect(clip, ss,
- (SkRegion::Op)element->getOp(),
- element->isInverseFilled(),
- element->isAA(),
- viewMatrix, element->getRect());
+ return rtc->renderTargetContextPriv().drawAndStencilRect(clip, ss,
+ (SkRegion::Op)element->getOp(),
+ element->isInverseFilled(),
+ element->isAA(),
+ viewMatrix,
+ element->getRect());
break;
default: {
SkPath path;
@@ -548,10 +549,11 @@ static bool stencil_element(GrDrawContext* dc,
path.toggleInverseFillType();
}
- return dc->drawContextPriv().drawAndStencilPath(clip, ss,
- (SkRegion::Op)element->getOp(),
- element->isInverseFilled(),
- element->isAA(), viewMatrix, path);
+ return rtc->renderTargetContextPriv().drawAndStencilPath(clip, ss,
+ (SkRegion::Op)element->getOp(),
+ element->isInverseFilled(),
+ element->isAA(), viewMatrix,
+ path);
break;
}
}
@@ -559,7 +561,7 @@ static bool stencil_element(GrDrawContext* dc,
return false;
}
-static void draw_element(GrDrawContext* dc,
+static void draw_element(GrRenderTargetContext* rtc,
const GrClip& clip, // TODO: can this just always be WideOpen?
const GrPaint &paint,
const SkMatrix& viewMatrix,
@@ -571,7 +573,7 @@ static void draw_element(GrDrawContext* dc,
SkDEBUGFAIL("Should never get here with an empty element.");
break;
case Element::kRect_Type:
- dc->drawRect(clip, paint, viewMatrix, element->getRect());
+ rtc->drawRect(clip, paint, viewMatrix, element->getRect());
break;
default: {
SkPath path;
@@ -580,13 +582,13 @@ static void draw_element(GrDrawContext* dc,
path.toggleInverseFillType();
}
- dc->drawPath(clip, paint, viewMatrix, path, GrStyle::SimpleFill());
+ rtc->drawPath(clip, paint, viewMatrix, path, GrStyle::SimpleFill());
break;
}
}
}
-bool GrReducedClip::drawAlphaClipMask(GrDrawContext* dc) const {
+bool GrReducedClip::drawAlphaClipMask(GrRenderTargetContext* rtc) const {
// The texture may be larger than necessary, this rect represents the part of the texture
// we populate with a rasterization of the clip.
GrFixedClip clip(SkIRect::MakeWH(fIBounds.width(), fIBounds.height()));
@@ -599,7 +601,7 @@ bool GrReducedClip::drawAlphaClipMask(GrDrawContext* dc) const {
// The scratch texture that we are drawing into can be substantially larger than the mask. Only
// clear the part that we care about.
GrColor initialCoverage = InitialState::kAllIn == this->initialState() ? -1 : 0;
- dc->drawContextPriv().clear(clip, initialCoverage, true);
+ rtc->renderTargetContextPriv().clear(clip, initialCoverage, true);
// Set the matrix so that rendered clip elements are transformed to mask space from clip space.
SkMatrix translate;
@@ -622,7 +624,7 @@ bool GrReducedClip::drawAlphaClipMask(GrDrawContext* dc) const {
GrUserStencilOp::kReplace,
0xffff>()
);
- if (!stencil_element(dc, clip, &kStencilInElement, translate, element)) {
+ if (!stencil_element(rtc, clip, &kStencilInElement, translate, element)) {
return false;
}
@@ -636,10 +638,10 @@ bool GrReducedClip::drawAlphaClipMask(GrDrawContext* dc) const {
GrUserStencilOp::kZero,
0xffff>()
);
- if (!dc->drawContextPriv().drawAndStencilRect(clip, &kDrawOutsideElement,
- op, !invert, false,
- translate,
- SkRect::Make(fIBounds))) {
+ if (!rtc->renderTargetContextPriv().drawAndStencilRect(clip, &kDrawOutsideElement,
+ op, !invert, false,
+ translate,
+ SkRect::Make(fIBounds))) {
return false;
}
} else {
@@ -648,7 +650,7 @@ bool GrReducedClip::drawAlphaClipMask(GrDrawContext* dc) const {
paint.setAntiAlias(element->isAA());
paint.setCoverageSetOpXPFactory(op, false);
- draw_element(dc, clip, paint, translate, element);
+ draw_element(rtc, clip, paint, translate, element);
}
}
@@ -678,9 +680,9 @@ private:
bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override {
return false;
}
- bool apply(GrContext* context, GrDrawContext* drawContext, bool useHWAA,
+ bool apply(GrContext* context, GrRenderTargetContext* renderTargetContext, bool useHWAA,
bool hasUserStencilSettings, GrAppliedClip* out) const override {
- if (!fFixedClip.apply(context, drawContext, useHWAA, hasUserStencilSettings, out)) {
+ if (!fFixedClip.apply(context, renderTargetContext, useHWAA, hasUserStencilSettings, out)) {
return false;
}
out->addStencilClip();
@@ -693,7 +695,7 @@ private:
};
bool GrReducedClip::drawStencilClipMask(GrContext* context,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const SkIPoint& clipOrigin) const {
// We set the current clip to the bounds so that our recursive draws are scissored to them.
StencilClip stencilClip(fIBounds.makeOffset(-clipOrigin.x(), -clipOrigin.y()));
@@ -704,7 +706,8 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
}
bool initialState = InitialState::kAllIn == this->initialState();
- drawContext->drawContextPriv().clearStencilClip(stencilClip.fixedClip(), initialState);
+ renderTargetContext->renderTargetContextPriv().clearStencilClip(stencilClip.fixedClip(),
+ initialState);
// Set the matrix so that rendered clip elements are transformed from clip to stencil space.
SkMatrix viewMatrix;
@@ -714,7 +717,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
// with the existing clip.
for (ElementList::Iter iter(fElements); iter.get(); iter.next()) {
const Element* element = iter.get();
- bool useHWAA = element->isAA() && drawContext->isStencilBufferMultisampled();
+ bool useHWAA = element->isAA() && renderTargetContext->isStencilBufferMultisampled();
bool fillInverted = false;
@@ -743,7 +746,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
canDrawArgs.fShape = &shape;
canDrawArgs.fAntiAlias = false;
canDrawArgs.fHasUserStencilSettings = false;
- canDrawArgs.fIsStencilBufferMSAA = drawContext->isStencilBufferMultisampled();
+ canDrawArgs.fIsStencilBufferMSAA = renderTargetContext->isStencilBufferMultisampled();
GrDrawingManager* dm = context->contextPriv().drawingManager();
pr = dm->getPathRenderer(canDrawArgs, false,
@@ -776,9 +779,10 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
0xffff>()
);
if (Element::kRect_Type == element->getType()) {
- drawContext->drawContextPriv().stencilRect(stencilClip.fixedClip(),
- &kDrawToStencil, useHWAA,
- viewMatrix, element->getRect());
+ renderTargetContext->renderTargetContextPriv().stencilRect(stencilClip.fixedClip(),
+ &kDrawToStencil, useHWAA,
+ viewMatrix,
+ element->getRect());
} else {
if (!clipPath.isEmpty()) {
GrShape shape(clipPath, GrStyle::SimpleFill());
@@ -791,7 +795,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
args.fResourceProvider = context->resourceProvider();
args.fPaint = &paint;
args.fUserStencilSettings = &kDrawToStencil;
- args.fDrawContext = drawContext;
+ args.fRenderTargetContext = renderTargetContext;
args.fClip = &stencilClip.fixedClip();
args.fViewMatrix = &viewMatrix;
args.fShape = &shape;
@@ -801,7 +805,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
} else {
GrPathRenderer::StencilPathArgs args;
args.fResourceProvider = context->resourceProvider();
- args.fDrawContext = drawContext;
+ args.fRenderTargetContext = renderTargetContext;
args.fClip = &stencilClip.fixedClip();
args.fViewMatrix = &viewMatrix;
args.fIsAA = element->isAA();
@@ -817,8 +821,9 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
for (GrUserStencilSettings const* const* pass = stencilPasses; *pass; ++pass) {
if (drawDirectToClip) {
if (Element::kRect_Type == element->getType()) {
- drawContext->drawContextPriv().stencilRect(stencilClip, *pass, useHWAA,
- viewMatrix, element->getRect());
+ renderTargetContext->renderTargetContextPriv().stencilRect(stencilClip, *pass,
+ useHWAA, viewMatrix,
+ element->getRect());
} else {
GrShape shape(clipPath, GrStyle::SimpleFill());
GrPaint paint;
@@ -828,7 +833,7 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
args.fResourceProvider = context->resourceProvider();
args.fPaint = &paint;
args.fUserStencilSettings = *pass;
- args.fDrawContext = drawContext;
+ args.fRenderTargetContext = renderTargetContext;
args.fClip = &stencilClip;
args.fViewMatrix = &viewMatrix;
args.fShape = &shape;
@@ -839,9 +844,9 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context,
} else {
// The view matrix is setup to do clip space -> stencil space translation, so
// draw rect in clip space.
- drawContext->drawContextPriv().stencilRect(stencilClip, *pass,
- false, viewMatrix,
- SkRect::Make(fIBounds));
+ renderTargetContext->renderTargetContextPriv().stencilRect(stencilClip, *pass,
+ false, viewMatrix,
+ SkRect::Make(fIBounds));
}
}
}
diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h
index b8413e6df4..0063d461bb 100644
--- a/src/gpu/GrReducedClip.h
+++ b/src/gpu/GrReducedClip.h
@@ -13,7 +13,7 @@
#include "SkTLList.h"
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
/**
* This class takes a clip stack and produces a reduced set of elements that are equivalent to
@@ -70,8 +70,8 @@ public:
InitialState initialState() const { return fInitialState; }
- bool drawAlphaClipMask(GrDrawContext*) const;
- bool drawStencilClipMask(GrContext*, GrDrawContext*, const SkIPoint& clipOrigin) const;
+ bool drawAlphaClipMask(GrRenderTargetContext*) const;
+ bool drawStencilClipMask(GrContext*, GrRenderTargetContext*, const SkIPoint& clipOrigin) const;
private:
void walkStack(const SkClipStack&, const SkRect& queryBounds, int maxWindowRectangles);
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index d28b2b4191..0bcde3bafe 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -10,7 +10,7 @@
#include "GrContext.h"
#include "GrContextPriv.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpu.h"
#include "GrRenderTargetOpList.h"
#include "GrRenderTargetPriv.h"
@@ -34,13 +34,13 @@ void GrRenderTarget::discard() {
return;
}
- sk_sp<GrDrawContext> drawContext(context->contextPriv().makeWrappedDrawContext(sk_ref_sp(this),
- nullptr));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ context->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(this), nullptr));
+ if (!renderTargetContext) {
return;
}
- drawContext->discard();
+ renderTargetContext->discard();
}
void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) {
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 54de4f0ba2..a746e80528 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -7,8 +7,8 @@
#include "GrBatchTest.h"
#include "GrColor.h"
-#include "GrDrawContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContext.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
@@ -45,11 +45,11 @@
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
#define ASSERT_SINGLE_OWNER_PRIV \
- SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSingleOwner);)
+ SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->fSingleOwner);)
#define RETURN_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return; }
-#define RETURN_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandoned()) { return; }
+#define RETURN_IF_ABANDONED_PRIV if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return; }
#define RETURN_FALSE_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return false; }
-#define RETURN_FALSE_IF_ABANDONED_PRIV if (fDrawContext->fDrawingManager->wasAbandoned()) { return false; }
+#define RETURN_FALSE_IF_ABANDONED_PRIV if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return false; }
#define RETURN_NULL_IF_ABANDONED if (fDrawingManager->wasAbandoned()) { return nullptr; }
using gr_instanced::InstancedRendering;
@@ -65,21 +65,21 @@ private:
GrDrawingManager* fDrawingManager;
};
-bool GrDrawContext::wasAbandoned() const {
+bool GrRenderTargetContext::wasAbandoned() const {
return fDrawingManager->wasAbandoned();
}
// In MDB mode the reffing of the 'getLastOpList' call's result allows in-progress
-// GrOpLists to be picked up and added to by drawContexts lower in the call
+// GrOpLists to be picked up and added to by renderTargetContexts lower in the call
// stack. When this occurs with a closed GrOpList, a new one will be allocated
-// when the drawContext attempts to use it (via getOpList).
-GrDrawContext::GrDrawContext(GrContext* context,
- GrDrawingManager* drawingMgr,
- sk_sp<GrRenderTarget> rt,
- sk_sp<SkColorSpace> colorSpace,
- const SkSurfaceProps* surfaceProps,
- GrAuditTrail* auditTrail,
- GrSingleOwner* singleOwner)
+// when the renderTargetContext attempts to use it (via getOpList).
+GrRenderTargetContext::GrRenderTargetContext(GrContext* context,
+ GrDrawingManager* drawingMgr,
+ sk_sp<GrRenderTarget> rt,
+ sk_sp<SkColorSpace> colorSpace,
+ const SkSurfaceProps* surfaceProps,
+ GrAuditTrail* auditTrail,
+ GrSingleOwner* singleOwner)
: fDrawingManager(drawingMgr)
, fRenderTarget(std::move(rt))
, fOpList(SkSafeRef(fRenderTarget->getLastRenderTargetOpList()))
@@ -102,7 +102,7 @@ GrDrawContext::GrDrawContext(GrContext* context,
}
#ifdef SK_DEBUG
-void GrDrawContext::validate() const {
+void GrRenderTargetContext::validate() const {
SkASSERT(fRenderTarget);
ASSERT_OWNED_RESOURCE(fRenderTarget);
@@ -112,12 +112,12 @@ void GrDrawContext::validate() const {
}
#endif
-GrDrawContext::~GrDrawContext() {
+GrRenderTargetContext::~GrRenderTargetContext() {
ASSERT_SINGLE_OWNER
SkSafeUnref(fOpList);
}
-GrRenderTargetOpList* GrDrawContext::getOpList() {
+GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
ASSERT_SINGLE_OWNER
SkDEBUGCODE(this->validate();)
@@ -128,40 +128,41 @@ GrRenderTargetOpList* GrDrawContext::getOpList() {
return fOpList;
}
-bool GrDrawContext::copySurface(GrSurface* src, const SkIRect& srcRect, const SkIPoint& dstPoint) {
+bool GrRenderTargetContext::copySurface(GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
ASSERT_SINGLE_OWNER
RETURN_FALSE_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::copySurface");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::copySurface");
return this->getOpList()->copySurface(fRenderTarget.get(), src, srcRect, dstPoint);
}
-void GrDrawContext::drawText(const GrClip& clip, const GrPaint& grPaint,
- const SkPaint& skPaint,
- const SkMatrix& viewMatrix,
- const char text[], size_t byteLength,
- SkScalar x, SkScalar y, const SkIRect& clipBounds) {
+void GrRenderTargetContext::drawText(const GrClip& clip, const GrPaint& grPaint,
+ const SkPaint& skPaint,
+ const SkMatrix& viewMatrix,
+ const char text[], size_t byteLength,
+ SkScalar x, SkScalar y, const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawText");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawText");
GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext();
atlasTextContext->drawText(fContext, this, clip, grPaint, skPaint, viewMatrix, fSurfaceProps,
text, byteLength, x, y, clipBounds);
}
-void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
- const SkPaint& skPaint,
- const SkMatrix& viewMatrix,
- const char text[], size_t byteLength,
- const SkScalar pos[], int scalarsPerPosition,
- const SkPoint& offset, const SkIRect& clipBounds) {
+void GrRenderTargetContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
+ const SkPaint& skPaint,
+ const SkMatrix& viewMatrix,
+ const char text[], size_t byteLength,
+ const SkScalar pos[], int scalarsPerPosition,
+ const SkPoint& offset, const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPosText");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawPosText");
GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext();
atlasTextContext->drawPosText(fContext, this, clip, grPaint, skPaint, viewMatrix,
@@ -170,57 +171,58 @@ void GrDrawContext::drawPosText(const GrClip& clip, const GrPaint& grPaint,
}
-void GrDrawContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
- const SkMatrix& viewMatrix, const SkTextBlob* blob,
- SkScalar x, SkScalar y,
- SkDrawFilter* filter, const SkIRect& clipBounds) {
+void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& skPaint,
+ const SkMatrix& viewMatrix, const SkTextBlob* blob,
+ SkScalar x, SkScalar y,
+ SkDrawFilter* filter, const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawTextBlob");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawTextBlob");
GrAtlasTextContext* atlasTextContext = fDrawingManager->getAtlasTextContext();
atlasTextContext->drawTextBlob(fContext, this, clip, skPaint, viewMatrix, fSurfaceProps, blob,
x, y, filter, clipBounds);
}
-void GrDrawContext::discard() {
+void GrRenderTargetContext::discard() {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::discard");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::discard");
AutoCheckFlush acf(fDrawingManager);
this->getOpList()->discard(fRenderTarget.get());
}
-void GrDrawContext::clear(const SkIRect* rect,
- const GrColor color,
- bool canIgnoreRect) {
+void GrRenderTargetContext::clear(const SkIRect* rect,
+ const GrColor color,
+ bool canIgnoreRect) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::clear");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::clear");
AutoCheckFlush acf(fDrawingManager);
this->internalClear(rect ? GrFixedClip(*rect) : GrFixedClip::Disabled(), color, canIgnoreRect);
}
-void GrDrawContextPriv::clear(const GrFixedClip& clip,
- const GrColor color,
- bool canIgnoreClip) {
+void GrRenderTargetContextPriv::clear(const GrFixedClip& clip,
+ const GrColor color,
+ bool canIgnoreClip) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_IF_ABANDONED_PRIV
- SkDEBUGCODE(fDrawContext->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContextPriv::clear");
+ SkDEBUGCODE(fRenderTargetContext->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
+ "GrRenderTargetContextPriv::clear");
- AutoCheckFlush acf(fDrawContext->fDrawingManager);
- fDrawContext->internalClear(clip, color, canIgnoreClip);
+ AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ fRenderTargetContext->internalClear(clip, color, canIgnoreClip);
}
-void GrDrawContext::internalClear(const GrFixedClip& clip,
- const GrColor color,
- bool canIgnoreClip) {
+void GrRenderTargetContext::internalClear(const GrFixedClip& clip,
+ const GrColor color,
+ bool canIgnoreClip) {
bool isFull = false;
if (!clip.hasWindowRectangles()) {
isFull = !clip.scissorEnabled() ||
@@ -255,13 +257,13 @@ void GrDrawContext::internalClear(const GrFixedClip& clip,
}
}
-void GrDrawContext::drawPaint(const GrClip& clip,
- const GrPaint& origPaint,
- const SkMatrix& viewMatrix) {
+void GrRenderTargetContext::drawPaint(const GrClip& clip,
+ const GrPaint& origPaint,
+ const SkMatrix& viewMatrix) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPaint");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawPaint");
// set rect to be big enough to fill the space, but not super-huge, so we
// don't overflow fixed-point implementations
@@ -382,11 +384,11 @@ static bool crop_filled_rect(int width, int height, const GrClip& clip,
return rect->intersect(clipBounds);
}
-bool GrDrawContext::drawFilledRect(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const GrUserStencilSettings* ss) {
+bool GrRenderTargetContext::drawFilledRect(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const GrUserStencilSettings* ss) {
SkRect croppedRect = rect;
if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &croppedRect)) {
return true;
@@ -436,18 +438,18 @@ bool GrDrawContext::drawFilledRect(const GrClip& clip,
return false;
}
-void GrDrawContext::drawRect(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const GrStyle* style) {
+void GrRenderTargetContext::drawRect(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const GrStyle* style) {
if (!style) {
style = &GrStyle::SimpleFill();
}
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRect");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawRect");
// Path effects should've been devolved to a path in SkGpuDevice
SkASSERT(!style->pathEffect());
@@ -560,62 +562,67 @@ void GrDrawContext::drawRect(const GrClip& clip,
this->internalDrawPath(clip, paint, viewMatrix, path, *style);
}
-void GrDrawContextPriv::clearStencilClip(const GrFixedClip& clip, bool insideStencilMask) {
+void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool insideStencilMask) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_IF_ABANDONED_PRIV
- SkDEBUGCODE(fDrawContext->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContextPriv::clearStencilClip");
+ SkDEBUGCODE(fRenderTargetContext->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
+ "GrRenderTargetContextPriv::clearStencilClip");
- AutoCheckFlush acf(fDrawContext->fDrawingManager);
- fDrawContext->getOpList()->clearStencilClip(clip, insideStencilMask,
- fDrawContext->accessRenderTarget());
+ AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
+ fRenderTargetContext->getOpList()->clearStencilClip(clip, insideStencilMask,
+ fRenderTargetContext->accessRenderTarget());
}
-void GrDrawContextPriv::stencilPath(const GrClip& clip,
- bool useHWAA,
- const SkMatrix& viewMatrix,
- const GrPath* path) {
- fDrawContext->getOpList()->stencilPath(fDrawContext, clip, useHWAA, viewMatrix, path);
+void GrRenderTargetContextPriv::stencilPath(const GrClip& clip,
+ bool useHWAA,
+ const SkMatrix& viewMatrix,
+ const GrPath* path) {
+ fRenderTargetContext->getOpList()->stencilPath(fRenderTargetContext, clip, useHWAA, viewMatrix,
+ path);
}
-void GrDrawContextPriv::stencilRect(const GrClip& clip,
- const GrUserStencilSettings* ss,
- bool useHWAA,
- const SkMatrix& viewMatrix,
- const SkRect& rect) {
+void GrRenderTargetContextPriv::stencilRect(const GrClip& clip,
+ const GrUserStencilSettings* ss,
+ bool useHWAA,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_IF_ABANDONED_PRIV
- SkDEBUGCODE(fDrawContext->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::stencilRect");
+ SkDEBUGCODE(fRenderTargetContext->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
+ "GrRenderTargetContext::stencilRect");
- AutoCheckFlush acf(fDrawContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
GrPaint paint;
paint.setAntiAlias(useHWAA);
paint.setXPFactory(GrDisableColorXPFactory::Make());
- fDrawContext->drawNonAAFilledRect(clip, paint, viewMatrix, rect, nullptr, nullptr, ss, useHWAA);
+ fRenderTargetContext->drawNonAAFilledRect(clip, paint, viewMatrix, rect, nullptr, nullptr, ss,
+ useHWAA);
}
-bool GrDrawContextPriv::drawAndStencilRect(const GrClip& clip,
- const GrUserStencilSettings* ss,
- SkRegion::Op op,
- bool invert,
- bool doAA,
- const SkMatrix& viewMatrix,
- const SkRect& rect) {
+bool GrRenderTargetContextPriv::drawAndStencilRect(const GrClip& clip,
+ const GrUserStencilSettings* ss,
+ SkRegion::Op op,
+ bool invert,
+ bool doAA,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_FALSE_IF_ABANDONED_PRIV
- SkDEBUGCODE(fDrawContext->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::drawAndStencilRect");
+ SkDEBUGCODE(fRenderTargetContext->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
+ "GrRenderTargetContext::drawAndStencilRect");
- AutoCheckFlush acf(fDrawContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
GrPaint paint;
paint.setAntiAlias(doAA);
paint.setCoverageSetOpXPFactory(op, invert);
- if (fDrawContext->drawFilledRect(clip, paint, viewMatrix, rect, ss)) {
+ if (fRenderTargetContext->drawFilledRect(clip, paint, viewMatrix, rect, ss)) {
return true;
}
@@ -625,15 +632,15 @@ bool GrDrawContextPriv::drawAndStencilRect(const GrClip& clip,
return this->drawAndStencilPath(clip, ss, op, invert, doAA, viewMatrix, path);
}
-void GrDrawContext::fillRectToRect(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& rectToDraw,
- const SkRect& localRect) {
+void GrRenderTargetContext::fillRectToRect(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& rectToDraw,
+ const SkRect& localRect) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectToRect");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::fillRectToRect");
SkRect croppedRect = rectToDraw;
SkRect croppedLocalRect = localRect;
@@ -686,15 +693,15 @@ void GrDrawContext::fillRectToRect(const GrClip& clip,
this->internalDrawPath(clip, paint, viewAndUnLocalMatrix, path, GrStyle());
}
-void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& rectToDraw,
- const SkMatrix& localMatrix) {
+void GrRenderTargetContext::fillRectWithLocalMatrix(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& rectToDraw,
+ const SkMatrix& localMatrix) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::fillRectWithLocalMatrix");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::fillRectWithLocalMatrix");
SkRect croppedRect = rectToDraw;
if (!crop_filled_rect(this->width(), this->height(), clip, viewMatrix, &croppedRect)) {
@@ -744,20 +751,20 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
this->internalDrawPath(clip, paint, viewAndUnLocalMatrix, path, GrStyle());
}
-void GrDrawContext::drawVertices(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- GrPrimitiveType primitiveType,
- int vertexCount,
- const SkPoint positions[],
- const SkPoint texCoords[],
- const GrColor colors[],
- const uint16_t indices[],
- int indexCount) {
+void GrRenderTargetContext::drawVertices(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ GrPrimitiveType primitiveType,
+ int vertexCount,
+ const SkPoint positions[],
+ const SkPoint texCoords[],
+ const GrColor colors[],
+ const uint16_t indices[],
+ int indexCount) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawVertices");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawVertices");
AutoCheckFlush acf(fDrawingManager);
@@ -781,17 +788,17 @@ void GrDrawContext::drawVertices(const GrClip& clip,
///////////////////////////////////////////////////////////////////////////////
-void GrDrawContext::drawAtlas(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- int spriteCount,
- const SkRSXform xform[],
- const SkRect texRect[],
- const SkColor colors[]) {
+void GrRenderTargetContext::drawAtlas(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ int spriteCount,
+ const SkRSXform xform[],
+ const SkRect texRect[],
+ const SkColor colors[]) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawAtlas");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawAtlas");
AutoCheckFlush acf(fDrawingManager);
@@ -804,15 +811,15 @@ void GrDrawContext::drawAtlas(const GrClip& clip,
///////////////////////////////////////////////////////////////////////////////
-void GrDrawContext::drawRRect(const GrClip& origClip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const GrStyle& style) {
+void GrRenderTargetContext::drawRRect(const GrClip& origClip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const GrStyle& style) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRRect");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawRRect");
if (rrect.isEmpty()) {
return;
}
@@ -871,11 +878,11 @@ void GrDrawContext::drawRRect(const GrClip& origClip,
this->internalDrawPath(*clip, paint, viewMatrix, path, style);
}
-bool GrDrawContext::drawFilledDRRect(const GrClip& clip,
- const GrPaint& paintIn,
- const SkMatrix& viewMatrix,
- const SkRRect& origOuter,
- const SkRRect& origInner) {
+bool GrRenderTargetContext::drawFilledDRRect(const GrClip& clip,
+ const GrPaint& paintIn,
+ const SkMatrix& viewMatrix,
+ const SkRRect& origOuter,
+ const SkRRect& origInner) {
SkASSERT(!origInner.isEmpty());
SkASSERT(!origOuter.isEmpty());
@@ -941,15 +948,15 @@ bool GrDrawContext::drawFilledDRRect(const GrClip& clip,
return true;
}
-void GrDrawContext::drawDRRect(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRRect& outer,
- const SkRRect& inner) {
+void GrRenderTargetContext::drawDRRect(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRRect& outer,
+ const SkRRect& inner) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawDRRect");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawDRRect");
SkASSERT(!outer.isEmpty());
SkASSERT(!inner.isEmpty());
@@ -975,15 +982,15 @@ static inline bool is_int(float x) {
return x == (float) sk_float_round2int(x);
}
-void GrDrawContext::drawRegion(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRegion& region,
- const GrStyle& style) {
+void GrRenderTargetContext::drawRegion(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRegion& region,
+ const GrStyle& style) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawRegion");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawRegion");
bool isNonTranslate = SkToBool(viewMatrix.getType() & ~(SkMatrix::kTranslate_Mask));
bool complexStyle = !style.isSimpleFill();
@@ -1000,15 +1007,15 @@ void GrDrawContext::drawRegion(const GrClip& clip,
this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
}
-void GrDrawContext::drawOval(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& oval,
- const GrStyle& style) {
+void GrRenderTargetContext::drawOval(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& oval,
+ const GrStyle& style) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawOval");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawOval");
if (oval.isEmpty()) {
return;
@@ -1053,14 +1060,14 @@ void GrDrawContext::drawOval(const GrClip& clip,
this->internalDrawPath(clip, paint, viewMatrix, path, style);
}
-void GrDrawContext::drawArc(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& oval,
- SkScalar startAngle,
- SkScalar sweepAngle,
- bool useCenter,
- const GrStyle& style) {
+void GrRenderTargetContext::drawArc(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& oval,
+ SkScalar startAngle,
+ SkScalar sweepAngle,
+ bool useCenter,
+ const GrStyle& style) {
bool useHWAA;
if (should_apply_coverage_aa(paint, fRenderTarget.get(), &useHWAA)) {
GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
@@ -1085,17 +1092,17 @@ void GrDrawContext::drawArc(const GrClip& clip,
return;
}
-void GrDrawContext::drawImageLattice(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- int imageWidth,
- int imageHeight,
- std::unique_ptr<SkLatticeIter> iter,
- const SkRect& dst) {
+void GrRenderTargetContext::drawImageLattice(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ int imageWidth,
+ int imageHeight,
+ std::unique_ptr<SkLatticeIter> iter,
+ const SkRect& dst) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawImageLattice");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawImageLattice");
AutoCheckFlush acf(fDrawingManager);
@@ -1107,25 +1114,25 @@ void GrDrawContext::drawImageLattice(const GrClip& clip,
this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
}
-void GrDrawContext::prepareForExternalIO() {
+void GrRenderTargetContext::prepareForExternalIO() {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::prepareForExternalIO");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::prepareForExternalIO");
ASSERT_OWNED_RESOURCE(fRenderTarget);
fDrawingManager->prepareSurfaceForExternalIO(fRenderTarget.get());
}
-void GrDrawContext::drawNonAAFilledRect(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix,
- const GrUserStencilSettings* ss,
- bool useHWAA) {
+void GrRenderTargetContext::drawNonAAFilledRect(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix,
+ const GrUserStencilSettings* ss,
+ bool useHWAA) {
SkASSERT(!useHWAA || this->isStencilBufferMultisampled());
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rect, localRect,
@@ -1137,8 +1144,8 @@ void GrDrawContext::drawNonAAFilledRect(const GrClip& clip,
this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
}
-bool GrDrawContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer, size_t dstRowBytes,
- int x, int y) {
+bool GrRenderTargetContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer,
+ size_t dstRowBytes, int x, int y) {
// TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps());
if (kUnknown_GrPixelConfig == config) {
@@ -1154,8 +1161,8 @@ bool GrDrawContext::readPixels(const SkImageInfo& dstInfo, void* dstBuffer, size
config, dstBuffer, dstRowBytes, flags);
}
-bool GrDrawContext::writePixels(const SkImageInfo& srcInfo, const void* srcBuffer,
- size_t srcRowBytes, int x, int y) {
+bool GrRenderTargetContext::writePixels(const SkImageInfo& srcInfo, const void* srcBuffer,
+ size_t srcRowBytes, int x, int y) {
// TODO: teach fRenderTarget to take ImageInfo directly to specify the src pixels
GrPixelConfig config = SkImageInfo2GrPixelConfig(srcInfo, *fContext->caps());
if (kUnknown_GrPixelConfig == config) {
@@ -1216,15 +1223,15 @@ static bool fills_as_nested_rects(const SkMatrix& viewMatrix, const SkPath& path
return allEq || allGoE1;
}
-void GrDrawContext::drawPath(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkPath& path,
- const GrStyle& style) {
+void GrRenderTargetContext::drawPath(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkPath& path,
+ const GrStyle& style) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawPath");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawPath");
if (path.isEmpty()) {
if (path.isInverseFillType()) {
@@ -1277,34 +1284,34 @@ void GrDrawContext::drawPath(const GrClip& clip,
this->internalDrawPath(clip, paint, viewMatrix, path, style);
}
-bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
- const GrUserStencilSettings* ss,
- SkRegion::Op op,
- bool invert,
- bool doAA,
- const SkMatrix& viewMatrix,
- const SkPath& path) {
+bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
+ const GrUserStencilSettings* ss,
+ SkRegion::Op op,
+ bool invert,
+ bool doAA,
+ const SkMatrix& viewMatrix,
+ const SkPath& path) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_FALSE_IF_ABANDONED_PRIV
- SkDEBUGCODE(fDrawContext->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::drawPath");
+ SkDEBUGCODE(fRenderTargetContext->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail, "GrRenderTargetContext::drawPath");
if (path.isEmpty() && path.isInverseFillType()) {
this->drawAndStencilRect(clip, ss, op, invert, false, SkMatrix::I(),
- SkRect::MakeIWH(fDrawContext->width(),
- fDrawContext->height()));
+ SkRect::MakeIWH(fRenderTargetContext->width(),
+ fRenderTargetContext->height()));
return true;
}
- AutoCheckFlush acf(fDrawContext->fDrawingManager);
+ AutoCheckFlush acf(fRenderTargetContext->fDrawingManager);
// An Assumption here is that path renderer would use some form of tweaking
// the src color (either the input alpha or in the frag shader) to implement
// aa. If we have some future driver-mojo path AA that can do the right
// thing WRT to the blend then we'll need some query on the PR.
- bool useCoverageAA = doAA && !fDrawContext->isUnifiedMultisampled();
+ bool useCoverageAA = doAA && !fRenderTargetContext->isUnifiedMultisampled();
bool hasUserStencilSettings = !ss->isUnused();
- bool isStencilBufferMSAA = fDrawContext->isStencilBufferMultisampled();
+ bool isStencilBufferMSAA = fRenderTargetContext->isStencilBufferMultisampled();
const GrPathRendererChain::DrawType type =
useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType
@@ -1312,7 +1319,8 @@ bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
GrShape shape(path, GrStyle::SimpleFill());
GrPathRenderer::CanDrawPathArgs canDrawArgs;
- canDrawArgs.fShaderCaps = fDrawContext->fDrawingManager->getContext()->caps()->shaderCaps();
+ canDrawArgs.fShaderCaps =
+ fRenderTargetContext->fDrawingManager->getContext()->caps()->shaderCaps();
canDrawArgs.fViewMatrix = &viewMatrix;
canDrawArgs.fShape = &shape;
canDrawArgs.fAntiAlias = useCoverageAA;
@@ -1320,7 +1328,8 @@ bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
canDrawArgs.fIsStencilBufferMSAA = isStencilBufferMSAA;
// Don't allow the SW renderer
- GrPathRenderer* pr = fDrawContext->fDrawingManager->getPathRenderer(canDrawArgs, false, type);
+ GrPathRenderer* pr = fRenderTargetContext->fDrawingManager->getPathRenderer(canDrawArgs, false,
+ type);
if (!pr) {
return false;
}
@@ -1329,36 +1338,37 @@ bool GrDrawContextPriv::drawAndStencilPath(const GrClip& clip,
paint.setCoverageSetOpXPFactory(op, invert);
GrPathRenderer::DrawPathArgs args;
- args.fResourceProvider = fDrawContext->fDrawingManager->getContext()->resourceProvider();
+ args.fResourceProvider =
+ fRenderTargetContext->fDrawingManager->getContext()->resourceProvider();
args.fPaint = &paint;
args.fUserStencilSettings = ss;
- args.fDrawContext = fDrawContext;
+ args.fRenderTargetContext = fRenderTargetContext;
args.fClip = &clip;
args.fViewMatrix = &viewMatrix;
args.fShape = &shape;
args.fAntiAlias = useCoverageAA;
- args.fGammaCorrect = fDrawContext->isGammaCorrect();
+ args.fGammaCorrect = fRenderTargetContext->isGammaCorrect();
pr->drawPath(args);
return true;
}
-SkBudgeted GrDrawContextPriv::isBudgeted() const {
+SkBudgeted GrRenderTargetContextPriv::isBudgeted() const {
ASSERT_SINGLE_OWNER_PRIV
- if (fDrawContext->wasAbandoned()) {
+ if (fRenderTargetContext->wasAbandoned()) {
return SkBudgeted::kNo;
}
- SkDEBUGCODE(fDrawContext->validate();)
+ SkDEBUGCODE(fRenderTargetContext->validate();)
- return fDrawContext->fRenderTarget->resourcePriv().isBudgeted();
+ return fRenderTargetContext->fRenderTarget->resourcePriv().isBudgeted();
}
-void GrDrawContext::internalDrawPath(const GrClip& clip,
- const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkPath& path,
- const GrStyle& style) {
+void GrRenderTargetContext::internalDrawPath(const GrClip& clip,
+ const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkPath& path,
+ const GrStyle& style) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkASSERT(!path.isEmpty());
@@ -1417,7 +1427,7 @@ void GrDrawContext::internalDrawPath(const GrClip& clip,
args.fResourceProvider = fDrawingManager->getContext()->resourceProvider();
args.fPaint = &paint;
args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
- args.fDrawContext = this;
+ args.fRenderTargetContext = this;
args.fClip = &clip;
args.fViewMatrix = &viewMatrix;
args.fShape = canDrawArgs.fShape;
@@ -1426,12 +1436,12 @@ void GrDrawContext::internalDrawPath(const GrClip& clip,
pr->drawPath(args);
}
-void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip& clip,
- GrDrawBatch* batch) {
+void GrRenderTargetContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const GrClip& clip,
+ GrDrawBatch* batch) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
+ GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::drawBatch");
this->getOpList()->drawBatch(pipelineBuilder, this, clip, batch);
}
diff --git a/src/gpu/GrDrawContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h
index a48e4681d6..82792dd7da 100644
--- a/src/gpu/GrDrawContextPriv.h
+++ b/src/gpu/GrRenderTargetContextPriv.h
@@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
-#ifndef GrDrawContextPriv_DEFINED
-#define GrDrawContextPriv_DEFINED
+#ifndef GrRenderTargetContextPriv_DEFINED
+#define GrRenderTargetContextPriv_DEFINED
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrRenderTargetOpList.h"
#include "GrPathRendering.h"
@@ -16,13 +16,13 @@ class GrFixedClip;
class GrPath;
struct GrUserStencilSettings;
-/** Class that adds methods to GrDrawContext that are only intended for use internal to Skia.
- This class is purely a privileged window into GrDrawContext. It should never have additional
- data members or virtual methods. */
-class GrDrawContextPriv {
+/** Class that adds methods to GrRenderTargetContext that are only intended for use internal to
+ Skia. This class is purely a privileged window into GrRenderTargetContext. It should never have
+ additional data members or virtual methods. */
+class GrRenderTargetContextPriv {
public:
gr_instanced::InstancedRendering* accessInstancedRendering() const {
- return fDrawContext->getOpList()->instancedRendering();
+ return fRenderTargetContext->getOpList()->instancedRendering();
}
void clear(const GrFixedClip&, const GrColor, bool canIgnoreClip);
@@ -64,23 +64,26 @@ public:
bool snapToCenters = false);
private:
- explicit GrDrawContextPriv(GrDrawContext* drawContext) : fDrawContext(drawContext) {}
- GrDrawContextPriv(const GrRenderTargetPriv&) {} // unimpl
- GrDrawContextPriv& operator=(const GrRenderTargetPriv&); // unimpl
+ explicit GrRenderTargetContextPriv(GrRenderTargetContext* renderTargetContext)
+ : fRenderTargetContext(renderTargetContext) {}
+ GrRenderTargetContextPriv(const GrRenderTargetPriv&) {} // unimpl
+ GrRenderTargetContextPriv& operator=(const GrRenderTargetPriv&); // unimpl
// No taking addresses of this type.
- const GrDrawContextPriv* operator&() const;
- GrDrawContextPriv* operator&();
+ const GrRenderTargetContextPriv* operator&() const;
+ GrRenderTargetContextPriv* operator&();
- GrDrawContext* fDrawContext;
+ GrRenderTargetContext* fRenderTargetContext;
- friend class GrDrawContext; // to construct/copy this type.
+ friend class GrRenderTargetContext; // to construct/copy this type.
};
-inline GrDrawContextPriv GrDrawContext::drawContextPriv() { return GrDrawContextPriv(this); }
+inline GrRenderTargetContextPriv GrRenderTargetContext::renderTargetContextPriv() {
+ return GrRenderTargetContextPriv(this);
+}
-inline const GrDrawContextPriv GrDrawContext::drawContextPriv () const {
- return GrDrawContextPriv(const_cast<GrDrawContext*>(this));
+inline const GrRenderTargetContextPriv GrRenderTargetContext::renderTargetContextPriv () const {
+ return GrRenderTargetContextPriv(const_cast<GrRenderTargetContext*>(this));
}
#endif
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 3eb047c1a8..9f50d5d89c 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -10,7 +10,7 @@
#include "GrAppliedClip.h"
#include "GrAuditTrail.h"
#include "GrCaps.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpu.h"
#include "GrGpuCommandBuffer.h"
#include "GrPath.h"
@@ -277,14 +277,14 @@ static void batch_bounds(SkRect* bounds, const GrBatch* batch) {
}
void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrDrawBatch* batch) {
// Setup clip
SkRect bounds;
batch_bounds(&bounds, batch);
GrAppliedClip appliedClip(bounds);
- if (!clip.apply(fContext, drawContext, pipelineBuilder.isHWAntialias(),
+ if (!clip.apply(fContext, renderTargetContext, pipelineBuilder.isHWAntialias(),
pipelineBuilder.hasUserStencilSettings(), &appliedClip)) {
return;
}
@@ -297,7 +297,8 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
}
if (pipelineBuilder.hasUserStencilSettings() || appliedClip.hasStencilClip()) {
- if (!fResourceProvider->attachStencilAttachment(drawContext->accessRenderTarget())) {
+ if (!fResourceProvider->attachStencilAttachment(
+ renderTargetContext->accessRenderTarget())) {
SkDebugf("ERROR creating stencil attachment. Draw skipped.\n");
return;
}
@@ -305,15 +306,15 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
GrPipeline::CreateArgs args;
args.fPipelineBuilder = &pipelineBuilder;
- args.fDrawContext = drawContext;
+ args.fRenderTargetContext = renderTargetContext;
args.fCaps = this->caps();
batch->getPipelineOptimizations(&args.fOpts);
if (args.fOpts.fOverrides.fUsePLSDstRead || fClipBatchToBounds) {
GrGLIRect viewport;
viewport.fLeft = 0;
viewport.fBottom = 0;
- viewport.fWidth = drawContext->width();
- viewport.fHeight = drawContext->height();
+ viewport.fWidth = renderTargetContext->width();
+ viewport.fHeight = renderTargetContext->height();
SkIRect ibounds;
ibounds.fLeft = SkTPin(SkScalarFloorToInt(batch->bounds().fLeft), viewport.fLeft,
viewport.fWidth);
@@ -336,7 +337,7 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
args.fScissor = &appliedClip.scissorState();
args.fWindowRectsState = &appliedClip.windowRectsState();
args.fHasStencilClip = appliedClip.hasStencilClip();
- if (!this->setupDstReadIfNecessary(pipelineBuilder, drawContext->accessRenderTarget(),
+ if (!this->setupDstReadIfNecessary(pipelineBuilder, renderTargetContext->accessRenderTarget(),
clip, args.fOpts,
&args.fDstTexture, batch->bounds())) {
return;
@@ -353,7 +354,7 @@ void GrRenderTargetOpList::drawBatch(const GrPipelineBuilder& pipelineBuilder,
this->recordBatch(batch, appliedClip.clippedDrawBounds());
}
-void GrRenderTargetOpList::stencilPath(GrDrawContext* drawContext,
+void GrRenderTargetOpList::stencilPath(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
bool useHWAA,
const SkMatrix& viewMatrix,
@@ -364,11 +365,11 @@ void GrRenderTargetOpList::stencilPath(GrDrawContext* drawContext,
// FIXME: Use path bounds instead of this WAR once
// https://bugs.chromium.org/p/skia/issues/detail?id=5640 is resolved.
- SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext->height());
+ SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(), renderTargetContext->height());
// Setup clip
GrAppliedClip appliedClip(bounds);
- if (!clip.apply(fContext, drawContext, useHWAA, true, &appliedClip)) {
+ if (!clip.apply(fContext, renderTargetContext, useHWAA, true, &appliedClip)) {
return;
}
// TODO: respect fClipBatchToBounds if we ever start computing bounds here.
@@ -378,7 +379,7 @@ void GrRenderTargetOpList::stencilPath(GrDrawContext* drawContext,
SkASSERT(!appliedClip.clipCoverageFragmentProcessor());
GrStencilAttachment* stencilAttachment = fResourceProvider->attachStencilAttachment(
- drawContext->accessRenderTarget());
+ renderTargetContext->accessRenderTarget());
if (!stencilAttachment) {
SkDebugf("ERROR creating stencil attachment. Draw skipped.\n");
return;
@@ -390,7 +391,7 @@ void GrRenderTargetOpList::stencilPath(GrDrawContext* drawContext,
appliedClip.hasStencilClip(),
stencilAttachment->bits(),
appliedClip.scissorState(),
- drawContext->accessRenderTarget(),
+ renderTargetContext->accessRenderTarget(),
path);
this->recordBatch(batch, appliedClip.clippedDrawBounds());
batch->unref();
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index e93a34a30d..c321d99a61 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -84,7 +84,7 @@ public:
*/
const GrCaps* caps() const { return fGpu->caps(); }
- void drawBatch(const GrPipelineBuilder&, GrDrawContext*, const GrClip&, GrDrawBatch*);
+ void drawBatch(const GrPipelineBuilder&, GrRenderTargetContext*, const GrClip&, GrDrawBatch*);
void addBatch(sk_sp<GrBatch>);
@@ -95,7 +95,7 @@ public:
* possible in the 3D API). Note, we will never have an inverse fill with
* stencil path.
*/
- void stencilPath(GrDrawContext*,
+ void stencilPath(GrRenderTargetContext*,
const GrClip&,
bool useHWAA,
const SkMatrix& viewMatrix,
@@ -130,7 +130,7 @@ public:
SkDEBUGCODE(void dump() const override;)
private:
- friend class GrDrawContextPriv; // for clearStencilClip
+ friend class GrRenderTargetContextPriv; // for clearStencilClip
// Returns the batch that the input batch was combined with or the input batch if it wasn't
// combined.
@@ -147,7 +147,7 @@ private:
GrXferProcessor::DstTexture*,
const SkRect& batchBounds);
- // Used only by drawContextPriv.
+ // Used only by renderTargetContextPriv.
void clearStencilClip(const GrFixedClip&, bool insideStencilMask, GrRenderTarget*);
struct RecordedBatch {
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 7bc26af145..267163035e 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -10,7 +10,7 @@
#include "GrCaps.h"
#include "GrContext.h"
#include "batches/GrDrawBatch.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrPipelineBuilder.h"
#include "GrShape.h"
@@ -163,7 +163,7 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider
}
void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
@@ -185,7 +185,7 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
maskMatrix.preTranslate(SkIntToScalar(-textureOriginInDeviceSpace.fX),
SkIntToScalar(-textureOriginInDeviceSpace.fY));
maskMatrix.preConcat(viewMatrix);
- GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(&userStencilSettings);
pipelineBuilder.addCoverageFragmentProcessor(
@@ -197,5 +197,5 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
SkMatrix::I(),
dstRect, nullptr, &invert));
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
}
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index 46520a91be..1846733dd9 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -86,7 +86,7 @@ public:
// The rectangle is drawn in device space. The 'viewMatrix' will be used to ensure the correct
// local coords are provided to any fragment processors in the paint.
static void DrawToTargetWithShapeMask(GrTexture* texture,
- GrDrawContext*,
+ GrRenderTargetContext*,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip&,
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index c22ce66005..ec4bfe0c6a 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -60,7 +60,7 @@ static bool get_shape_and_clip_bounds(int width, int height,
////////////////////////////////////////////////////////////////////////////////
-void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext,
+void GrSoftwarePathRenderer::DrawNonAARect(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
@@ -71,13 +71,13 @@ void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext,
viewMatrix, rect,
nullptr, &localMatrix));
- GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(&userStencilSettings);
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
}
-void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext,
+void GrSoftwarePathRenderer::DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
@@ -93,25 +93,25 @@ void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext,
if (devClipBounds.fTop < devPathBounds.fTop) {
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
- DrawNonAARect(drawContext, paint, userStencilSettings, clip,
+ DrawNonAARect(renderTargetContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
- DrawNonAARect(drawContext, paint, userStencilSettings, clip,
+ DrawNonAARect(renderTargetContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
- DrawNonAARect(drawContext, paint, userStencilSettings, clip,
+ DrawNonAARect(renderTargetContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
- DrawNonAARect(drawContext, paint, userStencilSettings, clip,
+ DrawNonAARect(renderTargetContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
}
@@ -119,7 +119,7 @@ void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext,
////////////////////////////////////////////////////////////////////////////////
// return true on success; false on failure
bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrSoftwarePathRenderer::onDrawPath");
if (!fTexProvider) {
return false;
@@ -137,13 +137,14 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
bool useCache = fAllowCaching && !inverseFilled && args.fViewMatrix->preservesAxisAlignment() &&
args.fShape->hasUnstyledKey() && args.fAntiAlias;
- if (!get_shape_and_clip_bounds(args.fDrawContext->width(), args.fDrawContext->height(),
+ if (!get_shape_and_clip_bounds(args.fRenderTargetContext->width(),
+ args.fRenderTargetContext->height(),
*args.fClip, *args.fShape,
*args.fViewMatrix, &unclippedDevShapeBounds,
&clippedDevShapeBounds,
&devClipBounds)) {
if (inverseFilled) {
- DrawAroundInvPath(args.fDrawContext, *args.fPaint, *args.fUserStencilSettings,
+ DrawAroundInvPath(args.fRenderTargetContext, *args.fPaint, *args.fUserStencilSettings,
*args.fClip,
*args.fViewMatrix, devClipBounds, unclippedDevShapeBounds);
@@ -158,7 +159,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
int unclippedHeight = unclippedDevShapeBounds.height();
int unclippedArea = unclippedWidth * unclippedHeight;
int clippedArea = clippedDevShapeBounds.width() * clippedDevShapeBounds.height();
- int maxTextureSize = args.fDrawContext->caps()->maxTextureSize();
+ int maxTextureSize = args.fRenderTargetContext->caps()->maxTextureSize();
if (unclippedArea > 2 * clippedArea || unclippedWidth > maxTextureSize ||
unclippedHeight > maxTextureSize) {
useCache = false;
@@ -212,14 +213,14 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
}
}
- GrSWMaskHelper::DrawToTargetWithShapeMask(texture.get(), args.fDrawContext, *args.fPaint,
- *args.fUserStencilSettings,
+ GrSWMaskHelper::DrawToTargetWithShapeMask(texture.get(), args.fRenderTargetContext,
+ *args.fPaint, *args.fUserStencilSettings,
*args.fClip, *args.fViewMatrix,
SkIPoint {boundsForMask->fLeft, boundsForMask->fTop},
*boundsForMask);
if (inverseFilled) {
- DrawAroundInvPath(args.fDrawContext, *args.fPaint, *args.fUserStencilSettings,
+ DrawAroundInvPath(args.fRenderTargetContext, *args.fPaint, *args.fUserStencilSettings,
*args.fClip,
*args.fViewMatrix, devClipBounds, unclippedDevShapeBounds);
}
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index 72d967323e..64ecfb6538 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -22,14 +22,14 @@ public:
: fTexProvider(texProvider)
, fAllowCaching(allowCaching) {}
private:
- static void DrawNonAARect(GrDrawContext* drawContext,
+ static void DrawNonAARect(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix);
- static void DrawAroundInvPath(GrDrawContext* drawContext,
+ static void DrawAroundInvPath(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp
index f51cc54aba..902d1c3b21 100644
--- a/src/gpu/GrTextureParamsAdjuster.cpp
+++ b/src/gpu/GrTextureParamsAdjuster.cpp
@@ -10,7 +10,7 @@
#include "GrCaps.h"
#include "GrColorSpaceXform.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpu.h"
#include "GrGpuResourcePriv.h"
#include "GrResourceKey.h"
@@ -36,10 +36,8 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset,
GrPixelConfig config = GrMakePixelConfigUncompressed(inputTexture->config());
- sk_sp<GrDrawContext> copyDC = context->makeDrawContextWithFallback(SkBackingFit::kExact,
- copyParams.fWidth,
- copyParams.fHeight,
- config, nullptr);
+ sk_sp<GrRenderTargetContext> copyDC = context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kExact, copyParams.fWidth, copyParams.fHeight, config, nullptr);
if (!copyDC) {
return nullptr;
}
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index 93a62d2643..16aa55b1d5 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -10,7 +10,7 @@
#include "effects/GrYUVEffect.h"
#include "GrClip.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrPaint.h"
#include "GrTextureProvider.h"
@@ -19,7 +19,7 @@ namespace {
SkYUVColorSpace colorSpace);
};
-static bool convert_texture(GrTexture* src, GrDrawContext* dst, int dstW, int dstH,
+static bool convert_texture(GrTexture* src, GrRenderTargetContext* dst, int dstW, int dstH,
SkYUVColorSpace colorSpace, MakeFPProc proc) {
SkScalar xScale = SkIntToScalar(src->width()) / dstW / src->width();
@@ -52,88 +52,93 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
if (GrContext* context = texture->getContext()) {
// Depending on the relative sizes of the y, u, and v planes we may do 1 to 3 draws/
// readbacks.
- sk_sp<GrDrawContext> yuvDrawContext;
- sk_sp<GrDrawContext> yDrawContext;
- sk_sp<GrDrawContext> uvDrawContext;
- sk_sp<GrDrawContext> uDrawContext;
- sk_sp<GrDrawContext> vDrawContext;
+ sk_sp<GrRenderTargetContext> yuvRenderTargetContext;
+ sk_sp<GrRenderTargetContext> yRenderTargetContext;
+ sk_sp<GrRenderTargetContext> uvRenderTargetContext;
+ sk_sp<GrRenderTargetContext> uRenderTargetContext;
+ sk_sp<GrRenderTargetContext> vRenderTargetContext;
// We issue draw(s) to convert from RGBA to Y, U, and V. All three planes may have different
// sizes however we optimize for two other cases - all planes are the same (1 draw to YUV),
// and U and V are the same but Y differs (2 draws, one for Y, one for UV).
if (sizes[0] == sizes[1] && sizes[1] == sizes[2]) {
- yuvDrawContext = context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- sizes[0].fWidth,
- sizes[0].fHeight,
- kRGBA_8888_GrPixelConfig,
- nullptr);
- if (!yuvDrawContext) {
+ yuvRenderTargetContext = context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ sizes[0].fWidth,
+ sizes[0].fHeight,
+ kRGBA_8888_GrPixelConfig,
+ nullptr);
+ if (!yuvRenderTargetContext) {
return false;
}
} else {
- yDrawContext = context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- sizes[0].fWidth,
- sizes[0].fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr);
- if (!yDrawContext) {
+ yRenderTargetContext = context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ sizes[0].fWidth,
+ sizes[0].fHeight,
+ kAlpha_8_GrPixelConfig,
+ nullptr);
+ if (!yRenderTargetContext) {
return false;
}
if (sizes[1] == sizes[2]) {
// TODO: Add support for GL_RG when available.
- uvDrawContext = context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- sizes[1].fWidth,
- sizes[1].fHeight,
- kRGBA_8888_GrPixelConfig,
- nullptr);
- if (!uvDrawContext) {
+ uvRenderTargetContext = context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ sizes[1].fWidth,
+ sizes[1].fHeight,
+ kRGBA_8888_GrPixelConfig,
+ nullptr);
+ if (!uvRenderTargetContext) {
return false;
}
} else {
- uDrawContext = context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- sizes[1].fWidth,
- sizes[1].fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr);
- vDrawContext = context->makeDrawContextWithFallback(SkBackingFit::kApprox,
- sizes[2].fWidth,
- sizes[2].fHeight,
- kAlpha_8_GrPixelConfig,
- nullptr);
- if (!uDrawContext || !vDrawContext) {
+ uRenderTargetContext = context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ sizes[1].fWidth,
+ sizes[1].fHeight,
+ kAlpha_8_GrPixelConfig,
+ nullptr);
+ vRenderTargetContext = context->makeRenderTargetContextWithFallback(
+ SkBackingFit::kApprox,
+ sizes[2].fWidth,
+ sizes[2].fHeight,
+ kAlpha_8_GrPixelConfig,
+ nullptr);
+ if (!uRenderTargetContext || !vRenderTargetContext) {
return false;
}
}
}
// Do all the draws before any readback.
- if (yuvDrawContext) {
- if (!convert_texture(texture, yuvDrawContext.get(),
+ if (yuvRenderTargetContext) {
+ if (!convert_texture(texture, yuvRenderTargetContext.get(),
sizes[0].fWidth, sizes[0].fHeight,
colorSpace, GrYUVEffect::MakeRGBToYUV)) {
return false;
}
} else {
- SkASSERT(yDrawContext);
- if (!convert_texture(texture, yDrawContext.get(),
+ SkASSERT(yRenderTargetContext);
+ if (!convert_texture(texture, yRenderTargetContext.get(),
sizes[0].fWidth, sizes[0].fHeight,
colorSpace, GrYUVEffect::MakeRGBToY)) {
return false;
}
- if (uvDrawContext) {
- if (!convert_texture(texture, uvDrawContext.get(),
+ if (uvRenderTargetContext) {
+ if (!convert_texture(texture, uvRenderTargetContext.get(),
sizes[1].fWidth, sizes[1].fHeight,
colorSpace, GrYUVEffect::MakeRGBToUV)) {
return false;
}
} else {
- SkASSERT(uDrawContext && vDrawContext);
- if (!convert_texture(texture, uDrawContext.get(),
+ SkASSERT(uRenderTargetContext && vRenderTargetContext);
+ if (!convert_texture(texture, uRenderTargetContext.get(),
sizes[1].fWidth, sizes[1].fHeight,
colorSpace, GrYUVEffect::MakeRGBToU)) {
return false;
}
- if (!convert_texture(texture, vDrawContext.get(),
+ if (!convert_texture(texture, vRenderTargetContext.get(),
sizes[2].fWidth, sizes[2].fHeight,
colorSpace, GrYUVEffect::MakeRGBToV)) {
return false;
@@ -141,9 +146,9 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
}
}
- if (yuvDrawContext) {
+ if (yuvRenderTargetContext) {
SkASSERT(sizes[0] == sizes[1] && sizes[1] == sizes[2]);
- sk_sp<GrTexture> yuvTex(yuvDrawContext->asTexture());
+ sk_sp<GrTexture> yuvTex(yuvRenderTargetContext->asTexture());
SkASSERT(yuvTex);
SkISize yuvSize = sizes[0];
// We have no kRGB_888 pixel format, so readback rgba and then copy three channels.
@@ -175,16 +180,16 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
}
return true;
} else {
- SkASSERT(yDrawContext);
- sk_sp<GrTexture> yTex(yDrawContext->asTexture());
+ SkASSERT(yRenderTargetContext);
+ sk_sp<GrTexture> yTex(yRenderTargetContext->asTexture());
SkASSERT(yTex);
if (!yTex->readPixels(0, 0, sizes[0].fWidth, sizes[0].fHeight,
kAlpha_8_GrPixelConfig, planes[0], rowBytes[0])) {
return false;
}
- if (uvDrawContext) {
+ if (uvRenderTargetContext) {
SkASSERT(sizes[1].fWidth == sizes[2].fWidth);
- sk_sp<GrTexture> uvTex(uvDrawContext->asTexture());
+ sk_sp<GrTexture> uvTex(uvRenderTargetContext->asTexture());
SkASSERT(uvTex);
SkISize uvSize = sizes[1];
// We have no kRG_88 pixel format, so readback rgba and then copy two channels.
@@ -212,14 +217,14 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
}
return true;
} else {
- SkASSERT(uDrawContext && vDrawContext);
- sk_sp<GrTexture> tex(uDrawContext->asTexture());
+ SkASSERT(uRenderTargetContext && vRenderTargetContext);
+ sk_sp<GrTexture> tex(uRenderTargetContext->asTexture());
SkASSERT(tex);
if (!tex->readPixels(0, 0, sizes[1].fWidth, sizes[1].fHeight,
kAlpha_8_GrPixelConfig, planes[1], rowBytes[1])) {
return false;
}
- tex = vDrawContext->asTexture();
+ tex = vRenderTargetContext->asTexture();
SkASSERT(tex);
if (!tex->readPixels(0, 0, sizes[2].fWidth, sizes[2].fHeight,
kAlpha_8_GrPixelConfig, planes[2], rowBytes[2])) {
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index db58e0afed..e12e26872c 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -6,7 +6,7 @@
*/
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrYUVProvider.h"
#include "effects/GrGammaEffect.h"
#include "effects/GrYUVEffect.h"
@@ -114,11 +114,12 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
}
// We never want to perform color-space conversion during the decode
- sk_sp<GrDrawContext> drawContext(ctx->makeDrawContext(SkBackingFit::kExact,
- desc.fWidth, desc.fHeight,
- desc.fConfig, nullptr,
- desc.fSampleCnt));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeRenderTargetContext(
+ SkBackingFit::kExact,
+ desc.fWidth, desc.fHeight,
+ desc.fConfig, nullptr,
+ desc.fSampleCnt));
+ if (!renderTargetContext) {
return nullptr;
}
@@ -146,7 +147,7 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
const SkRect r = SkRect::MakeIWH(yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fWidth,
yuvInfo.fSizeInfo.fSizes[SkYUVSizeInfo::kY].fHeight);
- drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), r);
+ renderTargetContext->drawRect(GrNoClip(), paint, SkMatrix::I(), r);
- return drawContext->asTexture();
+ return renderTargetContext->asTexture();
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 8164f4a247..68fcded959 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -9,7 +9,7 @@
#include "GrBlurUtils.h"
#include "GrContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrGpu.h"
#include "GrImageIDTextureAdjuster.h"
#include "GrStyle.h"
@@ -87,17 +87,18 @@ bool SkGpuDevice::CheckAlphaTypeAndGetFlags(
return true;
}
-sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrDrawContext> drawContext,
+sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTargetContext> renderTargetContext,
int width, int height,
InitContents init) {
- if (!drawContext || drawContext->wasAbandoned()) {
+ if (!renderTargetContext || renderTargetContext->wasAbandoned()) {
return nullptr;
}
unsigned flags;
if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) {
return nullptr;
}
- return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags));
+ return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(renderTargetContext), width, height,
+ flags));
}
sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted,
@@ -109,17 +110,18 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted,
return nullptr;
}
- sk_sp<GrDrawContext> drawContext(MakeDrawContext(context, budgeted, info,
- sampleCount, origin, props));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(MakeRenderTargetContext(context, budgeted,
+ info, sampleCount,
+ origin, props));
+ if (!renderTargetContext) {
return nullptr;
}
- return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext),
+ return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(renderTargetContext),
info.width(), info.height(), flags));
}
-static SkImageInfo make_info(GrDrawContext* context, int w, int h, bool opaque) {
+static SkImageInfo make_info(GrRenderTargetContext* context, int w, int h, bool opaque) {
SkColorType colorType;
if (!GrPixelConfigToColorType(context->config(), &colorType)) {
colorType = kUnknown_SkColorType;
@@ -129,11 +131,12 @@ static SkImageInfo make_info(GrDrawContext* context, int w, int h, bool opaque)
sk_ref_sp(context->getColorSpace()));
}
-SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height, unsigned flags)
- : INHERITED(make_info(drawContext.get(), width, height, SkToBool(flags & kIsOpaque_Flag)),
- drawContext->surfaceProps())
- , fContext(SkRef(drawContext->accessRenderTarget()->getContext()))
- , fDrawContext(std::move(drawContext))
+SkGpuDevice::SkGpuDevice(sk_sp<GrRenderTargetContext> renderTargetContext, int width, int height,
+ unsigned flags)
+ : INHERITED(make_info(renderTargetContext.get(), width, height,
+ SkToBool(flags & kIsOpaque_Flag)), renderTargetContext->surfaceProps())
+ , fContext(SkRef(renderTargetContext->accessRenderTarget()->getContext()))
+ , fRenderTargetContext(std::move(renderTargetContext))
{
fSize.set(width, height);
fOpaque = SkToBool(flags & kIsOpaque_Flag);
@@ -143,12 +146,13 @@ SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height
}
}
-sk_sp<GrDrawContext> SkGpuDevice::MakeDrawContext(GrContext* context,
- SkBudgeted budgeted,
- const SkImageInfo& origInfo,
- int sampleCount,
- GrSurfaceOrigin origin,
- const SkSurfaceProps* surfaceProps) {
+sk_sp<GrRenderTargetContext> SkGpuDevice::MakeRenderTargetContext(
+ GrContext* context,
+ SkBudgeted budgeted,
+ const SkImageInfo& origInfo,
+ int sampleCount,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps) {
if (kUnknown_SkColorType == origInfo.colorType() ||
origInfo.width() < 0 || origInfo.height() < 0) {
return nullptr;
@@ -170,7 +174,7 @@ sk_sp<GrDrawContext> SkGpuDevice::MakeDrawContext(GrContext* context,
GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps());
- return context->makeDrawContext(SkBackingFit::kExact, // Why exact?
+ return context->makeRenderTargetContext(SkBackingFit::kExact, // Why exact?
origInfo.width(), origInfo.height(),
config, sk_ref_sp(cs), sampleCount,
origin, surfaceProps, budgeted);
@@ -188,7 +192,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(const SkDraw& draw,
matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-left, -top);
SkAutoTUnref<SkImageFilterCache> cache(this->getImageFilterCache());
- SkImageFilter::OutputProperties outputProperties(fDrawContext->getColorSpace());
+ SkImageFilter::OutputProperties outputProperties(fRenderTargetContext->getColorSpace());
SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), outputProperties);
return filter->filterImage(srcImg, ctx, offset);
@@ -200,14 +204,14 @@ bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
int x, int y) {
ASSERT_SINGLE_OWNER
- return fDrawContext->readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
+ return fRenderTargetContext->readPixels(dstInfo, dstPixels, dstRowBytes, x, y);
}
bool SkGpuDevice::onWritePixels(const SkImageInfo& srcInfo, const void* srcPixels,
size_t srcRowBytes, int x, int y) {
ASSERT_SINGLE_OWNER
- return fDrawContext->writePixels(srcInfo, srcPixels, srcRowBytes, x, y);
+ return fRenderTargetContext->writePixels(srcInfo, srcPixels, srcRowBytes, x, y);
}
bool SkGpuDevice::onAccessPixels(SkPixmap* pmap) {
@@ -223,9 +227,9 @@ void SkGpuDevice::prepareDraw(const SkDraw& draw) {
fClip.reset(draw.fClipStack, &this->getOrigin());
}
-GrDrawContext* SkGpuDevice::accessDrawContext() {
+GrRenderTargetContext* SkGpuDevice::accessRenderTargetContext() {
ASSERT_SINGLE_OWNER
- return fDrawContext.get();
+ return fRenderTargetContext.get();
}
void SkGpuDevice::clearAll() {
@@ -233,34 +237,35 @@ void SkGpuDevice::clearAll() {
GrColor color = 0;
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "clearAll", fContext);
SkIRect rect = SkIRect::MakeWH(this->width(), this->height());
- fDrawContext->clear(&rect, color, true);
+ fRenderTargetContext->clear(&rect, color, true);
}
-void SkGpuDevice::replaceDrawContext(bool shouldRetainContent) {
+void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) {
ASSERT_SINGLE_OWNER
- SkBudgeted budgeted = fDrawContext->drawContextPriv().isBudgeted();
+ SkBudgeted budgeted = fRenderTargetContext->renderTargetContextPriv().isBudgeted();
- sk_sp<GrDrawContext> newDC(MakeDrawContext(this->context(),
- budgeted,
- this->imageInfo(),
- fDrawContext->numColorSamples(),
- fDrawContext->origin(),
- &this->surfaceProps()));
+ sk_sp<GrRenderTargetContext> newDC(MakeRenderTargetContext(
+ this->context(),
+ budgeted,
+ this->imageInfo(),
+ fRenderTargetContext->numColorSamples(),
+ fRenderTargetContext->origin(),
+ &this->surfaceProps()));
if (!newDC) {
return;
}
if (shouldRetainContent) {
- if (fDrawContext->wasAbandoned()) {
+ if (fRenderTargetContext->wasAbandoned()) {
return;
}
- newDC->copySurface(fDrawContext->asTexture().get(),
+ newDC->copySurface(fRenderTargetContext->asTexture().get(),
SkIRect::MakeWH(this->width(), this->height()),
SkIPoint::Make(0, 0));
}
- fDrawContext = newDC;
+ fRenderTargetContext = newDC;
}
///////////////////////////////////////////////////////////////////////////////
@@ -271,11 +276,12 @@ void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPaint", fContext);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
- fDrawContext->drawPaint(fClip, grPaint, *draw.fMatrix);
+ fRenderTargetContext->drawPaint(fClip, grPaint, *draw.fMatrix);
}
// must be in SkCanvas::PointMode order
@@ -321,7 +327,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
if (paint.getPathEffect() && 2 == count && SkCanvas::kLines_PointMode == mode) {
GrStyle style(paint, SkPaint::kStroke_Style);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
&grPaint)) {
return;
}
@@ -329,7 +335,7 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
path.setIsVolatile(true);
path.moveTo(pts[0]);
path.lineTo(pts[1]);
- fDrawContext->drawPath(fClip, grPaint, *draw.fMatrix, path, style);
+ fRenderTargetContext->drawPath(fClip, grPaint, *draw.fMatrix, path, style);
return;
}
@@ -361,20 +367,21 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode,
#endif
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *viewMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *viewMatrix,
+ &grPaint)) {
return;
}
- fDrawContext->drawVertices(fClip,
- grPaint,
- *viewMatrix,
- primitiveType,
- SkToS32(count),
- (SkPoint*)pts,
- nullptr,
- nullptr,
- nullptr,
- 0);
+ fRenderTargetContext->drawVertices(fClip,
+ grPaint,
+ *viewMatrix,
+ primitiveType,
+ SkToS32(count),
+ (SkPoint*)pts,
+ nullptr,
+ nullptr,
+ nullptr,
+ 0);
}
///////////////////////////////////////////////////////////////////////////////
@@ -390,7 +397,7 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
SkPath path;
path.setIsVolatile(true);
path.addRect(rect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -398,12 +405,13 @@ void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, const SkPaint
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
GrStyle style(paint);
- fDrawContext->drawRect(fClip, grPaint, *draw.fMatrix, rect, &style);
+ fRenderTargetContext->drawRect(fClip, grPaint, *draw.fMatrix, rect, &style);
}
///////////////////////////////////////////////////////////////////////////////
@@ -415,7 +423,8 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
CHECK_SHOULD_DRAW(draw);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
@@ -440,8 +449,8 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
// clipped out
return;
}
- if (mf->directFilterRRectMaskGPU(fContext, fDrawContext.get(), &grPaint, fClip,
- *draw.fMatrix, style.strokeRec(), rrect,
+ if (mf->directFilterRRectMaskGPU(fContext, fRenderTargetContext.get(), &grPaint,
+ fClip, *draw.fMatrix, style.strokeRec(), rrect,
devRRect)) {
return;
}
@@ -458,7 +467,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
SkPath path;
path.setIsVolatile(true);
path.addRRect(rrect);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -467,7 +476,7 @@ void SkGpuDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect,
SkASSERT(!style.pathEffect());
- fDrawContext->drawRRect(fClip, grPaint, *draw.fMatrix, rrect, style);
+ fRenderTargetContext->drawRRect(fClip, grPaint, *draw.fMatrix, rrect, style);
}
@@ -489,12 +498,12 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
if (stroke.isFillStyle() && !paint.getMaskFilter() && !paint.getPathEffect()) {
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
&grPaint)) {
return;
}
- fDrawContext->drawDRRect(fClip, grPaint, *draw.fMatrix, outer, inner);
+ fRenderTargetContext->drawDRRect(fClip, grPaint, *draw.fMatrix, outer, inner);
return;
}
@@ -504,7 +513,7 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
path.addRRect(inner);
path.setFillType(SkPath::kEvenOdd_FillType);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
fClip, path, paint,
*draw.fMatrix, nullptr,
draw.fRC->getBounds(), true);
@@ -521,11 +530,12 @@ void SkGpuDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const S
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
- fDrawContext->drawRegion(fClip, grPaint, *draw.fMatrix, region, GrStyle(paint));
+ fRenderTargetContext->drawRegion(fClip, grPaint, *draw.fMatrix, region, GrStyle(paint));
}
void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
@@ -549,11 +559,12 @@ void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
- fDrawContext->drawOval(fClip, grPaint, *draw.fMatrix, oval, GrStyle(paint));
+ fRenderTargetContext->drawOval(fClip, grPaint, *draw.fMatrix, oval, GrStyle(paint));
}
void SkGpuDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar startAngle,
@@ -567,12 +578,13 @@ void SkGpuDevice::drawArc(const SkDraw& draw, const SkRect& oval, SkScalar start
return;
}
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
- fDrawContext->drawArc(fClip, grPaint, *draw.fMatrix, oval, startAngle, sweepAngle, useCenter,
- GrStyle(paint));
+ fRenderTargetContext->drawArc(fClip, grPaint, *draw.fMatrix, oval, startAngle, sweepAngle,
+ useCenter, GrStyle(paint));
}
#include "SkMaskFilter.h"
@@ -585,8 +597,8 @@ void SkGpuDevice::drawStrokedLine(const SkPoint points[2],
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawStrokedLine", fContext);
CHECK_SHOULD_DRAW(draw);
- // Adding support for round capping would require a GrDrawContext::fillRRectWithLocalMatrix
- // entry point
+ // Adding support for round capping would require a
+ // GrRenderTargetContext::fillRRectWithLocalMatrix entry point
SkASSERT(SkPaint::kRound_Cap != origPaint.getStrokeCap());
SkASSERT(SkPaint::kStroke_Style == origPaint.getStyle());
SkASSERT(!origPaint.getPathEffect());
@@ -624,11 +636,11 @@ void SkGpuDevice::drawStrokedLine(const SkPoint points[2],
m.postConcat(*draw.fMatrix);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), newPaint, m, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), newPaint, m, &grPaint)) {
return;
}
- fDrawContext->fillRectWithLocalMatrix(fClip, grPaint, m, rect, local);
+ fRenderTargetContext->fillRectWithLocalMatrix(fClip, grPaint, m, rect, local);
}
void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
@@ -669,7 +681,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
CHECK_SHOULD_DRAW(draw);
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawPath", fContext);
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext.get(),
+ GrBlurUtils::drawPathWithMaskFilter(fContext, fRenderTargetContext.get(),
fClip, origSrcPath, paint,
*draw.fMatrix, prePathMatrix,
draw.fRC->getBounds(), pathIsMutable);
@@ -742,8 +754,9 @@ bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
ASSERT_SINGLE_OWNER
// if it's larger than the max tile size, then we have no choice but tiling.
if (imageRect.width() > maxTileSize || imageRect.height() > maxTileSize) {
- determine_clipped_src_rect(fDrawContext->width(), fDrawContext->height(), fClip, viewMatrix,
- srcToDstRect, imageRect.size(), srcRectPtr, clippedSubset);
+ determine_clipped_src_rect(fRenderTargetContext->width(), fRenderTargetContext->height(),
+ fClip, viewMatrix, srcToDstRect, imageRect.size(), srcRectPtr,
+ clippedSubset);
*tileSize = determine_tile_size(*clippedSubset, maxTileSize);
return true;
}
@@ -770,8 +783,9 @@ bool SkGpuDevice::shouldTileImageID(uint32_t imageID, const SkIRect& imageRect,
// Figure out how much of the src we will need based on the src rect and clipping. Reject if
// tiling memory savings would be < 50%.
- determine_clipped_src_rect(fDrawContext->width(), fDrawContext->height(), fClip, viewMatrix,
- srcToDstRect, imageRect.size(), srcRectPtr, clippedSubset);
+ determine_clipped_src_rect(fRenderTargetContext->width(), fRenderTargetContext->height(), fClip,
+ viewMatrix, srcToDstRect, imageRect.size(), srcRectPtr,
+ clippedSubset);
*tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
size_t usedTileBytes = get_tile_count(*clippedSubset, kBmpSmallTileSize) *
kBmpSmallTileSize * kBmpSmallTileSize;
@@ -828,7 +842,7 @@ void SkGpuDevice::drawBitmap(const SkDraw& origDraw,
// The tile code path doesn't currently support AA, so if the paint asked for aa and we could
// draw untiled, then we bypass checking for tiling purely for optimization reasons.
- bool drawAA = !fDrawContext->isUnifiedMultisampled() &&
+ bool drawAA = !fRenderTargetContext->isUnifiedMultisampled() &&
paint.isAntiAlias() &&
bitmap.width() <= maxTileSize &&
bitmap.height() <= maxTileSize;
@@ -931,7 +945,7 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
const SkPaint* paint = &origPaint;
SkPaint tempPaint;
- if (origPaint.isAntiAlias() && !fDrawContext->isUnifiedMultisampled()) {
+ if (origPaint.isAntiAlias() && !fRenderTargetContext->isUnifiedMultisampled()) {
// Drop antialiasing to avoid seams at tile boundaries.
tempPaint = origPaint;
tempPaint.setAntiAlias(false);
@@ -1018,13 +1032,13 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
SkASSERT(bitmap.width() <= fContext->caps()->maxTileSize() &&
bitmap.height() <= fContext->caps()->maxTileSize());
- sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(fContext, bitmap, params,
- fDrawContext->sourceGammaTreatment());
+ sk_sp<GrTexture> texture = GrMakeCachedBitmapTexture(
+ fContext, bitmap, params, fRenderTargetContext->sourceGammaTreatment());
if (nullptr == texture) {
return;
}
sk_sp<GrColorSpaceXform> colorSpaceXform =
- GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace());
+ GrColorSpaceXform::Make(bitmap.colorSpace(), fRenderTargetContext->getColorSpace());
SkScalar iw = 1.f / texture->width();
SkScalar ih = 1.f / texture->height();
@@ -1070,13 +1084,13 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
}
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(this->context(), fDrawContext.get(), paint, viewMatrix,
+ if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext.get(), paint, viewMatrix,
std::move(fp), kAlpha_8_SkColorType == bitmap.colorType(),
&grPaint)) {
return;
}
- fDrawContext->drawRect(fClip, grPaint, viewMatrix, dstRect);
+ fRenderTargetContext->drawRect(fClip, grPaint, viewMatrix, dstRect);
}
void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
@@ -1149,7 +1163,7 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw,
tmpUnfiltered.setImageFilter(nullptr);
sk_sp<GrColorSpaceXform> colorSpaceXform =
- GrColorSpaceXform::Make(result->getColorSpace(), fDrawContext->getColorSpace());
+ GrColorSpaceXform::Make(result->getColorSpace(), fRenderTargetContext->getColorSpace());
GrPaint grPaint;
sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(texture.get(),
std::move(colorSpaceXform),
@@ -1159,22 +1173,25 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw,
} else {
fp = GrFragmentProcessor::MulOutputByInputAlpha(std::move(fp));
}
- if (!SkPaintToGrPaintReplaceShader(this->context(), fDrawContext.get(), tmpUnfiltered,
+ if (!SkPaintToGrPaintReplaceShader(this->context(), fRenderTargetContext.get(), tmpUnfiltered,
std::move(fp), &grPaint)) {
return;
}
const SkIRect& subset = result->subset();
- fDrawContext->fillRectToRect(fClip,
- grPaint,
- SkMatrix::I(),
- SkRect::Make(SkIRect::MakeXYWH(left + offset.fX, top + offset.fY,
- subset.width(), subset.height())),
- SkRect::MakeXYWH(SkIntToScalar(subset.fLeft) / texture->width(),
- SkIntToScalar(subset.fTop) / texture->height(),
- SkIntToScalar(subset.width()) / texture->width(),
- SkIntToScalar(subset.height()) / texture->height()));
+ fRenderTargetContext->fillRectToRect(fClip,
+ grPaint,
+ SkMatrix::I(),
+ SkRect::Make(SkIRect::MakeXYWH(left + offset.fX,
+ top + offset.fY,
+ subset.width(),
+ subset.height())),
+ SkRect::MakeXYWH(
+ SkIntToScalar(subset.fLeft) / texture->width(),
+ SkIntToScalar(subset.fTop) / texture->height(),
+ SkIntToScalar(subset.width()) / texture->width(),
+ SkIntToScalar(subset.height()) / texture->height()));
}
void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
@@ -1215,7 +1232,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
// The tile code path doesn't currently support AA, so if the paint asked for aa and we could
// draw untiled, then we bypass checking for tiling purely for optimization reasons.
- bool drawAA = !fDrawContext->isUnifiedMultisampled() &&
+ bool drawAA = !fRenderTargetContext->isUnifiedMultisampled() &&
paint.isAntiAlias() &&
bitmap.width() <= maxTileSize &&
bitmap.height() <= maxTileSize;
@@ -1297,18 +1314,19 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkImage* image) {
}
sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
- sk_sp<GrTexture> texture(this->accessDrawContext()->asTexture());
+ sk_sp<GrTexture> texture(this->accessRenderTargetContext()->asTexture());
if (!texture) {
// When the device doesn't have a texture, we create a temporary texture.
// TODO: we should actually only copy the portion of the source needed to apply the image
// filter
- texture.reset(fContext->textureProvider()->createTexture(this->accessDrawContext()->desc(),
- SkBudgeted::kYes));
+ texture.reset(fContext->textureProvider()->createTexture(
+ this->accessRenderTargetContext()->desc(), SkBudgeted::kYes));
if (!texture) {
return nullptr;
}
- if (!fContext->copySurface(texture.get(), this->accessDrawContext()->accessRenderTarget())){
+ if (!fContext->copySurface(texture.get(),
+ this->accessRenderTargetContext()->accessRenderTarget())) {
return nullptr;
}
}
@@ -1415,7 +1433,7 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc
CHECK_SHOULD_DRAW(draw);
bool useFallback = paint.getMaskFilter() || paint.isAntiAlias() ||
- fDrawContext->isUnifiedMultisampled();
+ fRenderTargetContext->isUnifiedMultisampled();
bool doBicubic;
GrTextureParams::FilterMode textureFilterMode =
GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), *draw.fMatrix, SkMatrix::I(),
@@ -1436,18 +1454,19 @@ void SkGpuDevice::drawProducerNine(const SkDraw& draw, GrTextureProducer* produc
producer->createFragmentProcessor(SkMatrix::I(),
SkRect::MakeIWH(producer->width(), producer->height()),
GrTextureProducer::kNo_FilterConstraint, true,
- &kMode, fDrawContext->getColorSpace(),
- fDrawContext->sourceGammaTreatment()));
+ &kMode, fRenderTargetContext->getColorSpace(),
+ fRenderTargetContext->sourceGammaTreatment()));
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(this->context(), fDrawContext.get(), paint, *draw.fMatrix,
- std::move(fp), producer->isAlphaOnly(), &grPaint)) {
+ if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext.get(), paint,
+ *draw.fMatrix, std::move(fp), producer->isAlphaOnly(),
+ &grPaint)) {
return;
}
std::unique_ptr<SkLatticeIter> iter(
new SkLatticeIter(producer->width(), producer->height(), center, dst));
- fDrawContext->drawImageLattice(fClip, grPaint, *draw.fMatrix, producer->width(),
- producer->height(), std::move(iter), dst);
+ fRenderTargetContext->drawImageLattice(fClip, grPaint, *draw.fMatrix, producer->width(),
+ producer->height(), std::move(iter), dst);
}
void SkGpuDevice::drawImageNine(const SkDraw& draw, const SkImage* image,
@@ -1489,18 +1508,19 @@ void SkGpuDevice::drawProducerLattice(const SkDraw& draw, GrTextureProducer* pro
producer->createFragmentProcessor(SkMatrix::I(),
SkRect::MakeIWH(producer->width(), producer->height()),
GrTextureProducer::kNo_FilterConstraint, true,
- &kMode, fDrawContext->getColorSpace(),
- fDrawContext->sourceGammaTreatment()));
+ &kMode, fRenderTargetContext->getColorSpace(),
+ fRenderTargetContext->sourceGammaTreatment()));
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(this->context(), fDrawContext.get(), paint, *draw.fMatrix,
- std::move(fp), producer->isAlphaOnly(), &grPaint)) {
+ if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext.get(), paint,
+ *draw.fMatrix, std::move(fp), producer->isAlphaOnly(),
+ &grPaint)) {
return;
}
std::unique_ptr<SkLatticeIter> iter(
new SkLatticeIter(lattice, dst));
- fDrawContext->drawImageLattice(fClip, grPaint, *draw.fMatrix, producer->width(),
- producer->height(), std::move(iter), dst);
+ fRenderTargetContext->drawImageLattice(fClip, grPaint, *draw.fMatrix, producer->width(),
+ producer->height(), std::move(iter), dst);
}
void SkGpuDevice::drawImageLattice(const SkDraw& draw, const SkImage* image,
@@ -1562,7 +1582,8 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
GrPaint grPaint;
// we ignore the shader if texs is null.
- if (!SkPaintToGrPaintNoShader(this->context(), fDrawContext.get(), copy, &grPaint)) {
+ if (!SkPaintToGrPaintNoShader(this->context(), fRenderTargetContext.get(), copy,
+ &grPaint)) {
return;
}
@@ -1595,16 +1616,16 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
lineIndices[i + 5] = state.f0;
i += 6;
}
- fDrawContext->drawVertices(fClip,
- grPaint,
- *draw.fMatrix,
- kLines_GrPrimitiveType,
- vertexCount,
- vertices,
- texs,
- colors,
- lineIndices.get(),
- indexCount);
+ fRenderTargetContext->drawVertices(fClip,
+ grPaint,
+ *draw.fMatrix,
+ kLines_GrPrimitiveType,
+ vertexCount,
+ vertices,
+ texs,
+ colors,
+ lineIndices.get(),
+ indexCount);
return;
}
@@ -1633,13 +1654,13 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
} else {
colorMode = SkXfermode::kModulate_Mode;
}
- if (!SkPaintToGrPaintWithXfermode(this->context(), fDrawContext.get(), paint,
+ if (!SkPaintToGrPaintWithXfermode(this->context(), fRenderTargetContext.get(), paint,
*draw.fMatrix, colorMode, false, &grPaint)) {
return;
}
} else {
// We have a shader, but no colors to blend it against.
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix,
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
&grPaint)) {
return;
}
@@ -1648,28 +1669,29 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
if (colors) {
// We have colors, but either have no shader or no texture coords (which implies that
// we should ignore the shader).
- if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), fDrawContext.get(), paint,
- &grPaint)) {
+ if (!SkPaintToGrPaintWithPrimitiveColor(this->context(), fRenderTargetContext.get(),
+ paint, &grPaint)) {
return;
}
} else {
// No colors and no shaders. Just draw with the paint color.
- if (!SkPaintToGrPaintNoShader(this->context(), fDrawContext.get(), paint, &grPaint)) {
+ if (!SkPaintToGrPaintNoShader(this->context(), fRenderTargetContext.get(), paint,
+ &grPaint)) {
return;
}
}
}
- fDrawContext->drawVertices(fClip,
- grPaint,
- *draw.fMatrix,
- primType,
- vertexCount,
- vertices,
- texs,
- colors,
- indices,
- indexCount);
+ fRenderTargetContext->drawVertices(fClip,
+ grPaint,
+ *draw.fMatrix,
+ primType,
+ vertexCount,
+ vertices,
+ texs,
+ colors,
+ indices,
+ indexCount);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1691,18 +1713,19 @@ void SkGpuDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkRS
GrPaint grPaint;
if (colors) {
- if (!SkPaintToGrPaintWithXfermode(this->context(), fDrawContext.get(), p, *draw.fMatrix,
- mode, true, &grPaint)) {
+ if (!SkPaintToGrPaintWithXfermode(this->context(), fRenderTargetContext.get(), p,
+ *draw.fMatrix, mode, true, &grPaint)) {
return;
}
} else {
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), p, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), p, *draw.fMatrix,
+ &grPaint)) {
return;
}
}
SkDEBUGCODE(this->validate();)
- fDrawContext->drawAtlas(fClip, grPaint, *draw.fMatrix, count, xform, texRect, colors);
+ fRenderTargetContext->drawAtlas(fClip, grPaint, *draw.fMatrix, count, xform, texRect, colors);
}
///////////////////////////////////////////////////////////////////////////////
@@ -1715,14 +1738,15 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawText", fContext);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
SkDEBUGCODE(this->validate();)
- fDrawContext->drawText(fClip, grPaint, paint, *draw.fMatrix,
- (const char *)text, byteLength, x, y, draw.fRC->getBounds());
+ fRenderTargetContext->drawText(fClip, grPaint, paint, *draw.fMatrix,
+ (const char *)text, byteLength, x, y, draw.fRC->getBounds());
}
void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteLength,
@@ -1733,15 +1757,16 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL
CHECK_SHOULD_DRAW(draw);
GrPaint grPaint;
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, *draw.fMatrix,
+ &grPaint)) {
return;
}
SkDEBUGCODE(this->validate();)
- fDrawContext->drawPosText(fClip, grPaint, paint, *draw.fMatrix,
- (const char *)text, byteLength, pos, scalarsPerPos, offset,
- draw.fRC->getBounds());
+ fRenderTargetContext->drawPosText(fClip, grPaint, paint, *draw.fMatrix,
+ (const char *)text, byteLength, pos, scalarsPerPos, offset,
+ draw.fRC->getBounds());
}
void SkGpuDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkScalar x, SkScalar y,
@@ -1752,8 +1777,8 @@ void SkGpuDevice::drawTextBlob(const SkDraw& draw, const SkTextBlob* blob, SkSca
SkDEBUGCODE(this->validate();)
- fDrawContext->drawTextBlob(fClip, paint, *draw.fMatrix,
- blob, x, y, drawFilter, draw.fRC->getBounds());
+ fRenderTargetContext->drawTextBlob(fClip, paint, *draw.fMatrix,
+ blob, x, y, drawFilter, draw.fRC->getBounds());
}
///////////////////////////////////////////////////////////////////////////////
@@ -1765,7 +1790,7 @@ bool SkGpuDevice::onShouldDisableLCD(const SkPaint& paint) const {
void SkGpuDevice::flush() {
ASSERT_SINGLE_OWNER
- fDrawContext->prepareForExternalIO();
+ fRenderTargetContext->prepareForExternalIO();
}
///////////////////////////////////////////////////////////////////////////////
@@ -1780,21 +1805,22 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox
: SkBackingFit::kExact;
- sk_sp<GrDrawContext> dc(fContext->makeDrawContext(fit,
- cinfo.fInfo.width(), cinfo.fInfo.height(),
- fDrawContext->config(),
- sk_ref_sp(fDrawContext->getColorSpace()),
- fDrawContext->desc().fSampleCnt,
- kDefault_GrSurfaceOrigin,
- &props));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(fContext->makeRenderTargetContext(
+ fit,
+ cinfo.fInfo.width(), cinfo.fInfo.height(),
+ fRenderTargetContext->config(),
+ sk_ref_sp(fRenderTargetContext->getColorSpace()),
+ fRenderTargetContext->desc().fSampleCnt,
+ kDefault_GrSurfaceOrigin,
+ &props));
+ if (!rtc) {
return nullptr;
}
// Skia's convention is to only clear a device if it is non-opaque.
InitContents init = cinfo.fInfo.isOpaque() ? kUninit_InitContents : kClear_InitContents;
- return SkGpuDevice::Make(std::move(dc),
+ return SkGpuDevice::Make(std::move(rtc),
cinfo.fInfo.width(), cinfo.fInfo.height(),
init).release();
}
@@ -1803,8 +1829,9 @@ sk_sp<SkSurface> SkGpuDevice::makeSurface(const SkImageInfo& info, const SkSurfa
ASSERT_SINGLE_OWNER
// TODO: Change the signature of newSurface to take a budgeted parameter.
static const SkBudgeted kBudgeted = SkBudgeted::kNo;
- return SkSurface::MakeRenderTarget(fContext, kBudgeted, info, fDrawContext->desc().fSampleCnt,
- fDrawContext->origin(), &props);
+ return SkSurface::MakeRenderTarget(fContext, kBudgeted, info,
+ fRenderTargetContext->desc().fSampleCnt,
+ fRenderTargetContext->origin(), &props);
}
SkImageFilterCache* SkGpuDevice::getImageFilterCache() {
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index a49d160732..0b50deef17 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -16,7 +16,7 @@
#include "SkRegion.h"
#include "SkSurface.h"
#include "GrClipStackClip.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrContext.h"
#include "GrSurfacePriv.h"
#include "GrTypes.h"
@@ -39,10 +39,10 @@ public:
};
/**
- * Creates an SkGpuDevice from a GrDrawContext whose backing width/height is
+ * Creates an SkGpuDevice from a GrRenderTargetContext whose backing width/height is
* different than its actual width/height (e.g., approx-match scratch texture).
*/
- static sk_sp<SkGpuDevice> Make(sk_sp<GrDrawContext> drawContext,
+ static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTargetContext> renderTargetContext,
int width, int height,
InitContents);
@@ -62,9 +62,9 @@ public:
// set all pixels to 0
void clearAll();
- void replaceDrawContext(bool shouldRetainContent);
+ void replaceRenderTargetContext(bool shouldRetainContent);
- GrDrawContext* accessDrawContext() override;
+ GrRenderTargetContext* accessRenderTargetContext() override;
void drawPaint(const SkDraw&, const SkPaint& paint) override;
void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count, const SkPoint[],
@@ -131,9 +131,9 @@ protected:
bool onShouldDisableLCD(const SkPaint&) const final;
private:
- // We want these unreffed in DrawContext, GrContext order.
+ // We want these unreffed in RenderTargetContext, GrContext order.
SkAutoTUnref<GrContext> fContext;
- sk_sp<GrDrawContext> fDrawContext;
+ sk_sp<GrRenderTargetContext> fRenderTargetContext;
SkIPoint fClipOrigin;
GrClipStackClip fClip;
@@ -148,7 +148,7 @@ private:
static bool CheckAlphaTypeAndGetFlags(const SkImageInfo* info, InitContents init,
unsigned* flags);
- SkGpuDevice(sk_sp<GrDrawContext>, int width, int height, unsigned flags);
+ SkGpuDevice(sk_sp<GrRenderTargetContext>, int width, int height, unsigned flags);
SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
@@ -239,12 +239,12 @@ private:
bool drawDashLine(const SkPoint pts[2], const SkPaint& paint);
void drawStrokedLine(const SkPoint pts[2], const SkDraw&, const SkPaint&);
- static sk_sp<GrDrawContext> MakeDrawContext(GrContext*,
- SkBudgeted,
- const SkImageInfo&,
- int sampleCount,
- GrSurfaceOrigin,
- const SkSurfaceProps*);
+ static sk_sp<GrRenderTargetContext> MakeRenderTargetContext(GrContext*,
+ SkBudgeted,
+ const SkImageInfo&,
+ int sampleCount,
+ GrSurfaceOrigin,
+ const SkSurfaceProps*);
friend class GrAtlasTextContext;
friend class SkSurface_Gpu; // for access to surfaceProps
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 46a3699bb0..a0574260b5 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -9,7 +9,7 @@
#include "GrBlurUtils.h"
#include "GrCaps.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrStyle.h"
#include "GrTextureParamsAdjuster.h"
#include "SkDraw.h"
@@ -186,7 +186,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
SkMatrix combinedMatrix;
combinedMatrix.setConcat(viewMatrix, srcToDstMatrix);
if (can_ignore_bilerp_constraint(*producer, clippedSrcRect, combinedMatrix,
- fDrawContext->isUnifiedMultisampled())) {
+ fRenderTargetContext->isUnifiedMultisampled())) {
constraintMode = GrTextureAdjuster::kNo_FilterConstraint;
}
}
@@ -203,24 +203,25 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
}
sk_sp<GrFragmentProcessor> fp(producer->createFragmentProcessor(
*textureMatrix, clippedSrcRect, constraintMode, coordsAllInsideSrcRect, filterMode,
- fDrawContext->getColorSpace(), fDrawContext->sourceGammaTreatment()));
+ fRenderTargetContext->getColorSpace(), fRenderTargetContext->sourceGammaTreatment()));
if (!fp) {
return;
}
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(fContext, fDrawContext.get(), paint, viewMatrix, fp,
+ if (!SkPaintToGrPaintWithTexture(fContext, fRenderTargetContext.get(), paint, viewMatrix, fp,
producer->isAlphaOnly(), &grPaint)) {
return;
}
if (canUseTextureCoordsAsLocalCoords) {
- fDrawContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect, clippedSrcRect);
+ fRenderTargetContext->fillRectToRect(clip, grPaint, viewMatrix, clippedDstRect,
+ clippedSrcRect);
return;
}
if (!mf) {
- fDrawContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect);
+ fRenderTargetContext->drawRect(clip, grPaint, viewMatrix, clippedDstRect);
return;
}
@@ -231,7 +232,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
if (mf->directFilterRRectMaskGPU(fContext,
- fDrawContext.get(),
+ fRenderTargetContext.get(),
&grPaint,
clip,
viewMatrix,
@@ -245,7 +246,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
SkPath rectPath;
rectPath.addRect(clippedDstRect);
rectPath.setIsVolatile(true);
- GrBlurUtils::drawPathWithMaskFilter(this->context(), fDrawContext.get(), fClip,
+ GrBlurUtils::drawPathWithMaskFilter(this->context(), fRenderTargetContext.get(), fClip,
rectPath, &grPaint, viewMatrix, mf, GrStyle::SimpleFill(),
true);
}
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index ed974a7bbe..95bd30c5e5 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -11,7 +11,7 @@
#include "GrCaps.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpuResourcePriv.h"
#include "GrImageIDTextureAdjuster.h"
#include "GrTextureParamsAdjuster.h"
@@ -575,7 +575,7 @@ static inline bool blend_requires_shader(const SkXfermode::Mode mode, bool primi
}
static inline bool skpaint_to_grpaint_impl(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& skPaint,
const SkMatrix& viewM,
sk_sp<GrFragmentProcessor>* shaderProcessor,
@@ -583,11 +583,11 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
bool primitiveIsSrc,
GrPaint* grPaint) {
grPaint->setAntiAlias(skPaint.isAntiAlias());
- grPaint->setAllowSRGBInputs(dc->isGammaCorrect());
+ grPaint->setAllowSRGBInputs(rtc->isGammaCorrect());
// Convert SkPaint color to 4f format, including optional linearizing and gamut conversion.
- GrColor4f origColor = SkColorToUnpremulGrColor4f(skPaint.getColor(), dc->isGammaCorrect(),
- dc->getColorXformFromSRGB());
+ GrColor4f origColor = SkColorToUnpremulGrColor4f(skPaint.getColor(), rtc->isGammaCorrect(),
+ rtc->getColorXformFromSRGB());
// Setup the initial color considering the shader, the SkPaint color, and the presence or not
// of per-vertex colors.
@@ -598,8 +598,8 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
} else if (const SkShader* shader = skPaint.getShader()) {
shaderFP = shader->asFragmentProcessor(SkShader::AsFPArgs(context, &viewM, nullptr,
skPaint.getFilterQuality(),
- dc->getColorSpace(),
- dc->sourceGammaTreatment()));
+ rtc->getColorSpace(),
+ rtc->sourceGammaTreatment()));
if (!shaderFP) {
return false;
}
@@ -688,7 +688,7 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
if (applyColorFilterToPaintColor) {
// If we're in legacy mode, we *must* avoid using the 4f version of the color filter,
// because that will combine with the linearized version of the stored color.
- if (dc->isGammaCorrect()) {
+ if (rtc->isGammaCorrect()) {
grPaint->setColor4f(GrColor4f::FromSkColor4f(
colorFilter->filterColor4f(origColor.toSkColor4f())).premul());
} else {
@@ -697,7 +697,7 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
}
} else {
sk_sp<GrFragmentProcessor> cfFP(colorFilter->asFragmentProcessor(context,
- dc->getColorSpace()));
+ rtc->getColorSpace()));
if (cfFP) {
grPaint->addColorFragmentProcessor(std::move(cfFP));
} else {
@@ -722,58 +722,58 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
}
#ifndef SK_IGNORE_GPU_DITHER
- if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0 && !dc->isGammaCorrect()) {
+ if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0 && !rtc->isGammaCorrect()) {
grPaint->addColorFragmentProcessor(GrDitherEffect::Make());
}
#endif
return true;
}
-bool SkPaintToGrPaint(GrContext* context, GrDrawContext* dc, const SkPaint& skPaint,
+bool SkPaintToGrPaint(GrContext* context, GrRenderTargetContext* rtc, const SkPaint& skPaint,
const SkMatrix& viewM, GrPaint* grPaint) {
- return skpaint_to_grpaint_impl(context, dc, skPaint, viewM, nullptr, nullptr, false, grPaint);
+ return skpaint_to_grpaint_impl(context, rtc, skPaint, viewM, nullptr, nullptr, false, grPaint);
}
/** Replaces the SkShader (if any) on skPaint with the passed in GrFragmentProcessor. */
bool SkPaintToGrPaintReplaceShader(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& skPaint,
sk_sp<GrFragmentProcessor> shaderFP,
GrPaint* grPaint) {
if (!shaderFP) {
return false;
}
- return skpaint_to_grpaint_impl(context, dc, skPaint, SkMatrix::I(), &shaderFP, nullptr, false,
+ return skpaint_to_grpaint_impl(context, rtc, skPaint, SkMatrix::I(), &shaderFP, nullptr, false,
grPaint);
}
/** Ignores the SkShader (if any) on skPaint. */
bool SkPaintToGrPaintNoShader(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& skPaint,
GrPaint* grPaint) {
// Use a ptr to a nullptr to to indicate that the SkShader is ignored and not replaced.
static sk_sp<GrFragmentProcessor> kNullShaderFP(nullptr);
static sk_sp<GrFragmentProcessor>* kIgnoreShader = &kNullShaderFP;
- return skpaint_to_grpaint_impl(context, dc, skPaint, SkMatrix::I(), kIgnoreShader, nullptr,
+ return skpaint_to_grpaint_impl(context, rtc, skPaint, SkMatrix::I(), kIgnoreShader, nullptr,
false, grPaint);
}
/** Blends the SkPaint's shader (or color if no shader) with a per-primitive color which must
be setup as a vertex attribute using the specified SkXfermode::Mode. */
bool SkPaintToGrPaintWithXfermode(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& skPaint,
const SkMatrix& viewM,
SkXfermode::Mode primColorMode,
bool primitiveIsSrc,
GrPaint* grPaint) {
- return skpaint_to_grpaint_impl(context, dc, skPaint, viewM, nullptr, &primColorMode,
+ return skpaint_to_grpaint_impl(context, rtc, skPaint, viewM, nullptr, &primColorMode,
primitiveIsSrc, grPaint);
}
bool SkPaintToGrPaintWithTexture(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& paint,
const SkMatrix& viewM,
sk_sp<GrFragmentProcessor> fp,
@@ -786,8 +786,8 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
&viewM,
nullptr,
paint.getFilterQuality(),
- dc->getColorSpace(),
- dc->sourceGammaTreatment()));
+ rtc->getColorSpace(),
+ rtc->sourceGammaTreatment()));
if (!shaderFP) {
return false;
}
@@ -800,7 +800,7 @@ bool SkPaintToGrPaintWithTexture(GrContext* context,
shaderFP = GrFragmentProcessor::MulOutputByInputAlpha(fp);
}
- return SkPaintToGrPaintReplaceShader(context, dc, paint, std::move(shaderFP), grPaint);
+ return SkPaintToGrPaintReplaceShader(context, rtc, paint, std::move(shaderFP), grPaint);
}
diff --git a/src/gpu/SkGrPriv.h b/src/gpu/SkGrPriv.h
index b658389ba2..1a976f1275 100644
--- a/src/gpu/SkGrPriv.h
+++ b/src/gpu/SkGrPriv.h
@@ -16,7 +16,7 @@
class GrCaps;
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrFragmentProcessor;
class GrPaint;
class GrTexture;
@@ -47,14 +47,14 @@ void GrInstallBitmapUniqueKeyInvalidator(const GrUniqueKey& key, SkPixelRef* pix
/** Converts an SkPaint to a GrPaint for a given GrContext. The matrix is required in order
to convert the SkShader (if any) on the SkPaint. The primitive itself has no color. */
bool SkPaintToGrPaint(GrContext*,
- GrDrawContext*,
+ GrRenderTargetContext*,
const SkPaint& skPaint,
const SkMatrix& viewM,
GrPaint* grPaint);
/** Same as above but ignores the SkShader (if any) on skPaint. */
bool SkPaintToGrPaintNoShader(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& skPaint,
GrPaint* grPaint);
@@ -62,7 +62,7 @@ bool SkPaintToGrPaintNoShader(GrContext* context,
should expect an unpremul input color and produce a premultiplied output color. There is
no primitive color. */
bool SkPaintToGrPaintReplaceShader(GrContext*,
- GrDrawContext*,
+ GrRenderTargetContext*,
const SkPaint& skPaint,
sk_sp<GrFragmentProcessor> shaderFP,
GrPaint* grPaint);
@@ -72,7 +72,7 @@ bool SkPaintToGrPaintReplaceShader(GrContext*,
primitive color is the dst or src color to the blend in order to work around differences between
drawVertices and drawAtlas. */
bool SkPaintToGrPaintWithXfermode(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& skPaint,
const SkMatrix& viewM,
SkXfermode::Mode primColorMode,
@@ -83,16 +83,16 @@ bool SkPaintToGrPaintWithXfermode(GrContext* context,
the expectation is that the primitive color will be premultiplied, though it really should be
unpremultiplied so that interpolation is done in unpremul space. The paint's alpha will be
applied to the primitive color after interpolation. */
-inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, GrDrawContext* dc,
+inline bool SkPaintToGrPaintWithPrimitiveColor(GrContext* context, GrRenderTargetContext* rtc,
const SkPaint& skPaint, GrPaint* grPaint) {
- return SkPaintToGrPaintWithXfermode(context, dc, skPaint, SkMatrix::I(), SkXfermode::kDst_Mode,
+ return SkPaintToGrPaintWithXfermode(context, rtc, skPaint, SkMatrix::I(), SkXfermode::kDst_Mode,
false, grPaint);
}
/** This is used when there may or may not be a shader, and the caller wants to plugin a texture
lookup. If there is a shader, then its output will only be used if the texture is alpha8. */
bool SkPaintToGrPaintWithTexture(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkPaint& paint,
const SkMatrix& viewM,
sk_sp<GrFragmentProcessor> fp,
@@ -105,9 +105,10 @@ GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo&, const GrCaps&);
bool GrPixelConfigToColorType(GrPixelConfig, SkColorType*);
-/** When image filter code needs to construct a draw context to do intermediate rendering, we need
- a renderable pixel config. The source (SkSpecialImage) may not be in a renderable format, but
- we want to preserve the color space of that source. This picks an appropriate format to use. */
+/** When image filter code needs to construct a render target context to do intermediate rendering,
+ we need a renderable pixel config. The source (SkSpecialImage) may not be in a renderable
+ format, but we want to preserve the color space of that source. This picks an appropriate format
+ to use. */
GrPixelConfig GrRenderableConfigForColorSpace(const SkColorSpace*);
/**
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index f02be4c0ec..c761e4e211 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -982,9 +982,9 @@ private:
};
bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrAAConvexPathRenderer::onDrawPath");
- SkASSERT(!args.fDrawContext->isUnifiedMultisampled());
+ SkASSERT(!args.fRenderTargetContext->isUnifiedMultisampled());
SkASSERT(!args.fShape->isEmpty());
SkPath path;
@@ -996,7 +996,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
return true;
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index 36a9ff01e7..c009b8f6a5 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -507,9 +507,9 @@ private:
};
bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrAADistanceFieldPathRenderer::onDrawPath");
- SkASSERT(!args.fDrawContext->isUnifiedMultisampled());
+ SkASSERT(!args.fRenderTargetContext->isUnifiedMultisampled());
SkASSERT(args.fShape->style().isSimpleFill());
// we've already bailed on inverse filled paths, so this is safe
@@ -535,7 +535,7 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
return true;
}
diff --git a/src/gpu/batches/GrAAHairLinePathRenderer.cpp b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
index 9d73cf4f17..d026906744 100644
--- a/src/gpu/batches/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/batches/GrAAHairLinePathRenderer.cpp
@@ -956,12 +956,13 @@ static GrDrawBatch* create_hairline_batch(GrColor color,
}
bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrAAHairlinePathRenderer::onDrawPath");
- SkASSERT(!args.fDrawContext->isUnifiedMultisampled());
+ SkASSERT(!args.fRenderTargetContext->isUnifiedMultisampled());
SkIRect devClipBounds;
- args.fClip->getConservativeBounds(args.fDrawContext->width(), args.fDrawContext->height(),
+ args.fClip->getConservativeBounds(args.fRenderTargetContext->width(),
+ args.fRenderTargetContext->height(),
&devClipBounds);
SkPath path;
@@ -972,7 +973,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
return true;
}
diff --git a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
index c2873b6a40..4d870389c1 100644
--- a/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp
@@ -329,9 +329,9 @@ private:
};
bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrAALinearizingConvexPathRenderer::onDrawPath");
- SkASSERT(!args.fDrawContext->isUnifiedMultisampled());
+ SkASSERT(!args.fRenderTargetContext->isUnifiedMultisampled());
SkASSERT(!args.fShape->isEmpty());
SkASSERT(!args.fShape->style().pathEffect());
@@ -352,7 +352,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
return true;
}
diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp
index f2b75be108..ec4a51ede7 100644
--- a/src/gpu/batches/GrDashLinePathRenderer.cpp
+++ b/src/gpu/batches/GrDashLinePathRenderer.cpp
@@ -24,9 +24,9 @@ bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
}
bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrDashLinePathRenderer::onDrawPath");
- bool useHWAA = args.fDrawContext->isUnifiedMultisampled();
+ bool useHWAA = args.fRenderTargetContext->isUnifiedMultisampled();
GrDashingEffect::AAMode aaMode;
if (useHWAA) {
// We ignore args.fAntiAlias here and force anti aliasing when using MSAA. Otherwise,
@@ -51,6 +51,6 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint, useHWAA);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
return true;
}
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index 7dbdd4b48f..6c677e7e00 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -412,7 +412,7 @@ private:
typedef GrVertexBatch INHERITED;
};
-bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
+bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
@@ -528,7 +528,8 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, path.getBounds());
SkRect devBounds;
- GetPathDevBounds(path, drawContext->width(), drawContext->height(), viewMatrix, &devBounds);
+ GetPathDevBounds(path, renderTargetContext->width(), renderTargetContext->height(), viewMatrix,
+ &devBounds);
for (int p = 0; p < passCount; ++p) {
if (lastPassIsBounds && (p == passCount-1)) {
@@ -556,25 +557,25 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
&localMatrix));
SkASSERT(GrDrawFace::kBoth == drawFace[p]);
- GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
} else {
SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(), path,
srcSpaceTol,
newCoverage, viewMatrix,
isHairline, devBounds));
- GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setDrawFace(drawFace[p]);
pipelineBuilder.setUserStencil(passes[p]);
if (passCount > 1) {
pipelineBuilder.setDisableColorXPFactory();
}
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
}
}
return true;
@@ -588,9 +589,9 @@ bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
}
bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrDefaultPathRenderer::onDrawPath");
- return this->internalDrawPath(args.fDrawContext,
+ return this->internalDrawPath(args.fRenderTargetContext,
*args.fPaint,
*args.fUserStencilSettings,
*args.fClip,
@@ -600,7 +601,7 @@ bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrDefaultPathRenderer::onStencilPath");
SkASSERT(!args.fShape->inverseFilled());
@@ -608,8 +609,8 @@ void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
paint.setXPFactory(GrDisableColorXPFactory::Make());
paint.setAntiAlias(args.fIsAA);
- this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnused, *args.fClip,
- *args.fViewMatrix, *args.fShape, true);
+ this->internalDrawPath(args.fRenderTargetContext, paint, GrUserStencilSettings::kUnused,
+ *args.fClip, *args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/batches/GrDefaultPathRenderer.h b/src/gpu/batches/GrDefaultPathRenderer.h
index 9ae23e48d9..243d4e7d92 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.h
+++ b/src/gpu/batches/GrDefaultPathRenderer.h
@@ -30,7 +30,7 @@ private:
void onStencilPath(const StencilPathArgs&) override;
- bool internalDrawPath(GrDrawContext*,
+ bool internalDrawPath(GrRenderTargetContext*,
const GrPaint&,
const GrUserStencilSettings&,
const GrClip&,
diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp
index d013235357..85970825d5 100644
--- a/src/gpu/batches/GrMSAAPathRenderer.cpp
+++ b/src/gpu/batches/GrMSAAPathRenderer.cpp
@@ -549,7 +549,7 @@ private:
typedef GrVertexBatch INHERITED;
};
-bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
+bool GrMSAAPathRenderer::internalDrawPath(GrRenderTargetContext* renderTargetContext,
const GrPaint& paint,
const GrUserStencilSettings& userStencilSettings,
const GrClip& clip,
@@ -621,7 +621,8 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
}
SkRect devBounds;
- GetPathDevBounds(path, drawContext->width(), drawContext->height(), viewMatrix, &devBounds);
+ GetPathDevBounds(path, renderTargetContext->width(), renderTargetContext->height(), viewMatrix,
+ &devBounds);
SkASSERT(passCount <= kMaxNumPasses);
@@ -650,10 +651,10 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
- GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(passes[p]);
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
} else {
SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor(), path,
viewMatrix, devBounds));
@@ -661,13 +662,13 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
return false;
}
- GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(passes[p]);
if (passCount > 1) {
pipelineBuilder.setDisableColorXPFactory();
}
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
}
}
return true;
@@ -681,7 +682,7 @@ bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
}
bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrMSAAPathRenderer::onDrawPath");
SkTLazy<GrShape> tmpShape;
const GrShape* shape = args.fShape;
@@ -690,7 +691,7 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
tmpShape.init(args.fShape->applyStyle(GrStyle::Apply::kPathEffectAndStrokeRec, styleScale));
shape = tmpShape.get();
}
- return this->internalDrawPath(args.fDrawContext,
+ return this->internalDrawPath(args.fRenderTargetContext,
*args.fPaint,
*args.fUserStencilSettings,
*args.fClip,
@@ -700,7 +701,7 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrMSAAPathRenderer::onStencilPath");
SkASSERT(args.fShape->style().isSimpleFill());
SkASSERT(!args.fShape->mayBeInverseFilledAfterStyling());
@@ -709,8 +710,8 @@ void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
paint.setXPFactory(GrDisableColorXPFactory::Make());
paint.setAntiAlias(args.fIsAA);
- this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnused, *args.fClip,
- *args.fViewMatrix, *args.fShape, true);
+ this->internalDrawPath(args.fRenderTargetContext, paint, GrUserStencilSettings::kUnused,
+ *args.fClip, *args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/batches/GrMSAAPathRenderer.h b/src/gpu/batches/GrMSAAPathRenderer.h
index 3bc4ee6f7b..3a70bcb059 100644
--- a/src/gpu/batches/GrMSAAPathRenderer.h
+++ b/src/gpu/batches/GrMSAAPathRenderer.h
@@ -21,7 +21,7 @@ private:
void onStencilPath(const StencilPathArgs&) override;
- bool internalDrawPath(GrDrawContext*,
+ bool internalDrawPath(GrRenderTargetContext*,
const GrPaint&,
const GrUserStencilSettings&,
const GrClip&,
diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp
index f20fb1337e..1c98f6ada2 100644
--- a/src/gpu/batches/GrPLSPathRenderer.cpp
+++ b/src/gpu/batches/GrPLSPathRenderer.cpp
@@ -930,10 +930,11 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkAutoTUnref<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(),
path, *args.fViewMatrix));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHWAA(*args.fPaint));
+ GrPipelineBuilder pipelineBuilder(*args.fPaint,
+ args.fRenderTargetContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
SkDEBUGCODE(inPLSDraw = false;)
return true;
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 3bbd1574a9..1aaebbf01d 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -9,7 +9,7 @@
#include "GrStencilAndCoverPathRenderer.h"
#include "GrCaps.h"
#include "GrContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrDrawPathBatch.h"
#include "GrFixedClip.h"
#include "GrGpu.h"
@@ -78,18 +78,20 @@ static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const GrShape&
}
void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onStencilPath");
- SkASSERT(!args.fIsAA || args.fDrawContext->isStencilBufferMultisampled());
+ SkASSERT(!args.fIsAA || args.fRenderTargetContext->isStencilBufferMultisampled());
SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
- args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, args.fIsAA, *args.fViewMatrix, p);
+ args.fRenderTargetContext->renderTargetContextPriv().stencilPath(*args.fClip, args.fIsAA,
+ *args.fViewMatrix, p);
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrStencilAndCoverPathRenderer::onDrawPath");
- SkASSERT(!args.fPaint->isAntiAlias() || args.fDrawContext->isStencilBufferMultisampled());
+ SkASSERT(!args.fPaint->isAntiAlias() ||
+ args.fRenderTargetContext->isStencilBufferMultisampled());
SkASSERT(!args.fShape->style().strokeRec().isHairlineStyle());
const SkMatrix& viewMatrix = *args.fViewMatrix;
@@ -101,8 +103,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkMatrix invert = SkMatrix::I();
SkRect bounds =
SkRect::MakeLTRB(0, 0,
- SkIntToScalar(args.fDrawContext->width()),
- SkIntToScalar(args.fDrawContext->height()));
+ SkIntToScalar(args.fRenderTargetContext->width()),
+ SkIntToScalar(args.fRenderTargetContext->height()));
SkMatrix vmi;
// mapRect through persp matrix may not be correct
if (!viewMatrix.hasPerspective() && viewMatrix.invert(&vmi)) {
@@ -123,8 +125,9 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
nullptr, &invert));
// fake inverse with a stencil and cover
- args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, args.fPaint->isAntiAlias(),
- viewMatrix, path);
+ args.fRenderTargetContext->renderTargetContextPriv().stencilPath(*args.fClip,
+ args.fPaint->isAntiAlias(),
+ viewMatrix, path);
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@@ -142,10 +145,10 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint,
args.fPaint->isAntiAlias() &&
- !args.fDrawContext->hasMixedSamples());
+ !args.fRenderTargetContext->hasMixedSamples());
pipelineBuilder.setUserStencil(&kInvertedCoverPass);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, coverBatch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, coverBatch);
}
} else {
static constexpr GrUserStencilSettings kCoverPass(
@@ -164,11 +167,11 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
if (args.fAntiAlias) {
- SkASSERT(args.fDrawContext->isStencilBufferMultisampled());
+ SkASSERT(args.fRenderTargetContext->isStencilBufferMultisampled());
pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag);
}
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
}
return true;
diff --git a/src/gpu/batches/GrTessellatingPathRenderer.cpp b/src/gpu/batches/GrTessellatingPathRenderer.cpp
index cb4f2c79ed..b50cdb08bf 100644
--- a/src/gpu/batches/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/batches/GrTessellatingPathRenderer.cpp
@@ -350,10 +350,11 @@ private:
};
bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
- GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
+ GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
"GrTessellatingPathRenderer::onDrawPath");
SkIRect clipBoundsI;
- args.fClip->getConservativeBounds(args.fDrawContext->width(), args.fDrawContext->height(),
+ args.fClip->getConservativeBounds(args.fRenderTargetContext->width(),
+ args.fRenderTargetContext->height(),
&clipBoundsI);
SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->getColor(),
*args.fShape,
@@ -361,10 +362,11 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
clipBoundsI,
args.fAntiAlias));
- GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHWAA(*args.fPaint));
+ GrPipelineBuilder pipelineBuilder(*args.fPaint,
+ args.fRenderTargetContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
- args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
+ args.fRenderTargetContext->drawBatch(pipelineBuilder, *args.fClip, batch);
return true;
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 80a0314ac2..079fd0da02 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -7,7 +7,7 @@
#include "GrConfigConversionEffect.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrInvariantOutput.h"
#include "GrSimpleTextureEffect.h"
#include "SkMatrix.h"
@@ -184,10 +184,12 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
}
}
- sk_sp<GrDrawContext> readDC(context->makeDrawContext(SkBackingFit::kExact, kSize, kSize,
- kConfig, nullptr));
- sk_sp<GrDrawContext> tempDC(context->makeDrawContext(SkBackingFit::kExact, kSize, kSize,
- kConfig, nullptr));
+ sk_sp<GrRenderTargetContext> readDC(context->makeRenderTargetContext(SkBackingFit::kExact,
+ kSize, kSize,
+ kConfig, nullptr));
+ sk_sp<GrRenderTargetContext> tempDC(context->makeRenderTargetContext(SkBackingFit::kExact,
+ kSize, kSize,
+ kConfig, nullptr));
if (!readDC || !tempDC) {
return;
}
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index c6abc696c2..78192c8b9b 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -8,7 +8,7 @@
#include "effects/GrCoverageSetOpXP.h"
#include "GrCaps.h"
#include "GrColor.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrPipeline.h"
#include "GrProcessor.h"
#include "GrProcOptInfo.h"
@@ -339,6 +339,6 @@ GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory);
sk_sp<GrXPFactory> GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) {
SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLastOp + 1));
- bool invertCoverage = !d->fDrawContext->hasMixedSamples() && d->fRandom->nextBool();
+ bool invertCoverage = !d->fRenderTargetContext->hasMixedSamples() && d->fRandom->nextBool();
return GrCoverageSetOpXPFactory::Make(regionOp, invertCoverage);
}
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 12f35a38c8..a28f638a2c 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -9,7 +9,7 @@
#include "GrBlurUtils.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrPipelineBuilder.h"
#include "GrTextUtils.h"
#include "SkColorFilter.h"
@@ -303,7 +303,7 @@ inline GrDrawBatch* GrAtlasTextBlob::createBatch(
}
inline
-void GrAtlasTextBlob::flushRun(GrDrawContext* dc, const GrPaint& grPaint,
+void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrPaint& grPaint,
const GrClip& clip, int run, const SkMatrix& viewMatrix, SkScalar x,
SkScalar y,
const SkPaint& skPaint, const SkSurfaceProps& props,
@@ -321,12 +321,13 @@ void GrAtlasTextBlob::flushRun(GrDrawContext* dc, const GrPaint& grPaint,
SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run,
subRun, viewMatrix, x, y, color,
skPaint, props,
- distanceAdjustTable, dc->isGammaCorrect(),
+ distanceAdjustTable,
+ rtc->isGammaCorrect(),
cache));
- GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint));
+ GrPipelineBuilder pipelineBuilder(grPaint, rtc->mustUseHWAA(grPaint));
- dc->drawBatch(pipelineBuilder, clip, batch);
+ rtc->drawBatch(pipelineBuilder, clip, batch);
}
}
@@ -351,7 +352,7 @@ static void calculate_translation(bool applyVM,
}
-void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrDrawContext* dc,
+void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
const SkIRect& clipBounds) {
@@ -367,12 +368,12 @@ void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrDrawContext* dc,
ctm.postConcat(viewMatrix);
}
- GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, bigGlyph.fPath,
+ GrBlurUtils::drawPathWithMaskFilter(context, rtc, clip, bigGlyph.fPath,
skPaint, ctm, nullptr, clipBounds, false);
}
}
-void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrDrawContext* dc,
+void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrRenderTargetContext* rtc,
const SkSurfaceProps& props,
const SkTextBlobRunIterator& it,
const GrClip& clip, const SkPaint& skPaint,
@@ -393,18 +394,18 @@ void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrDrawContext* dc,
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning:
- GrTextUtils::DrawTextAsPath(context, dc, clip, runPaint, viewMatrix,
+ GrTextUtils::DrawTextAsPath(context, rtc, clip, runPaint, viewMatrix,
(const char *)it.glyphs(),
textLen, x + offset.x(), y + offset.y(), clipBounds);
break;
case SkTextBlob::kHorizontal_Positioning:
- GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, runPaint, viewMatrix,
+ GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, runPaint, viewMatrix,
(const char*)it.glyphs(),
textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()),
clipBounds);
break;
case SkTextBlob::kFull_Positioning:
- GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, runPaint, viewMatrix,
+ GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, runPaint, viewMatrix,
(const char*)it.glyphs(),
textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds);
break;
@@ -412,7 +413,7 @@ void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrDrawContext* dc,
}
void GrAtlasTextBlob::flushCached(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkTextBlob* blob,
const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
@@ -428,20 +429,20 @@ void GrAtlasTextBlob::flushCached(GrContext* context,
SkTextBlobRunIterator it(blob);
for (int run = 0; !it.done(); it.next(), run++) {
if (fRuns[run].fDrawAsPaths) {
- this->flushRunAsPaths(context, dc, props, it, clip, skPaint,
+ this->flushRunAsPaths(context, rtc, props, it, clip, skPaint,
drawFilter, viewMatrix, clipBounds, x, y);
continue;
}
- this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
+ this->flushRun(rtc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
distanceAdjustTable, context->getBatchFontCache());
}
// Now flush big glyphs
- this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBounds);
+ this->flushBigGlyphs(context, rtc, clip, skPaint, viewMatrix, x, y, clipBounds);
}
void GrAtlasTextBlob::flushThrowaway(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
const SkPaint& skPaint,
@@ -451,12 +452,12 @@ void GrAtlasTextBlob::flushThrowaway(GrContext* context,
const SkIRect& clipBounds,
SkScalar x, SkScalar y) {
for (int run = 0; run < fRunCount; run++) {
- this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
+ this->flushRun(rtc, grPaint, clip, run, viewMatrix, x, y, skPaint, props,
distanceAdjustTable, context->getBatchFontCache());
}
// Now flush big glyphs
- this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBounds);
+ this->flushBigGlyphs(context, rtc, clip, skPaint, viewMatrix, x, y, clipBounds);
}
GrDrawBatch* GrAtlasTextBlob::test_createBatch(
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index afc11a9bd4..5aaf2100c2 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -182,7 +182,7 @@ public:
// flush a GrAtlasTextBlob associated with a SkTextBlob
void flushCached(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkTextBlob* blob,
const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
@@ -196,7 +196,7 @@ public:
// flush a throwaway GrAtlasTextBlob *not* associated with an SkTextBlob
void flushThrowaway(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
const SkPaint& skPaint,
@@ -294,19 +294,19 @@ private:
void appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph,
SkScalar x, SkScalar y, SkScalar scale, bool applyVM);
- inline void flushRun(GrDrawContext* dc, const GrPaint&, const GrClip&,
+ inline void flushRun(GrRenderTargetContext* rtc, const GrPaint&, const GrClip&,
int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
const SkPaint& skPaint, const SkSurfaceProps& props,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
GrBatchFontCache* cache);
- void flushBigGlyphs(GrContext* context, GrDrawContext* dc,
+ void flushBigGlyphs(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
const SkIRect& clipBounds);
void flushRunAsPaths(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkSurfaceProps& props,
const SkTextBlobRunIterator& it,
const GrClip& clip, const SkPaint& skPaint,
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 83c34dfca8..1d6cef0bbf 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -7,7 +7,7 @@
#include "GrAtlasTextContext.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrTextBlobCache.h"
#include "GrTextUtils.h"
@@ -53,10 +53,10 @@ GrColor GrAtlasTextContext::ComputeCanonicalColor(const SkPaint& paint, bool lcd
return canonicalColor;
}
-uint32_t GrAtlasTextContext::ComputeScalerContextFlags(GrDrawContext* dc) {
+uint32_t GrAtlasTextContext::ComputeScalerContextFlags(GrRenderTargetContext* rtc) {
// If we're doing gamma-correct rendering, then we can disable the gamma hacks.
// Otherwise, leave them on. In either case, we still want the contrast boost:
- if (dc->isGammaCorrect()) {
+ if (rtc->isGammaCorrect()) {
return SkPaint::kBoostContrast_ScalerContextFlag;
} else {
return SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags;
@@ -76,7 +76,7 @@ bool GrAtlasTextContext::HasLCD(const SkTextBlob* blob) {
return false;
}
-void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
+void GrAtlasTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props, const SkTextBlob* blob,
@@ -96,7 +96,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
bool canCache = !(skPaint.getPathEffect() ||
(mf && !mf->asABlur(&blurRec)) ||
drawFilter);
- uint32_t scalerContextFlags = ComputeScalerContextFlags(dc);
+ uint32_t scalerContextFlags = ComputeScalerContextFlags(rtc);
GrTextBlobCache* cache = context->getTextBlobCache();
if (canCache) {
@@ -124,7 +124,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
// Though for the time being runs in the textblob can override the paint, they only touch font
// info.
GrPaint grPaint;
- if (!SkPaintToGrPaint(context, dc, skPaint, viewMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(context, rtc, skPaint, viewMatrix, &grPaint)) {
return;
}
@@ -167,7 +167,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
blob, x, y, drawFilter);
}
- cacheBlob->flushCached(context, dc, blob, props, fDistanceAdjustTable, skPaint,
+ cacheBlob->flushCached(context, rtc, blob, props, fDistanceAdjustTable, skPaint,
grPaint, drawFilter, clip, viewMatrix, clipBounds, x, y);
}
@@ -313,7 +313,7 @@ GrAtlasTextContext::CreateDrawPosTextBlob(GrTextBlobCache* blobCache, GrBatchFon
}
void GrAtlasTextContext::drawText(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const GrClip& clip,
const GrPaint& paint, const SkPaint& skPaint,
const SkMatrix& viewMatrix,
@@ -327,21 +327,21 @@ void GrAtlasTextContext::drawText(GrContext* context,
CreateDrawTextBlob(context->getTextBlobCache(), context->getBatchFontCache(),
*context->caps()->shaderCaps(),
paint, skPaint,
- ComputeScalerContextFlags(dc),
+ ComputeScalerContextFlags(rtc),
viewMatrix, props,
text, byteLength, x, y));
- blob->flushThrowaway(context, dc, props, fDistanceAdjustTable, skPaint, paint,
+ blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable, skPaint, paint,
clip, viewMatrix, regionClipBounds, x, y);
return;
}
// fall back to drawing as a path
- GrTextUtils::DrawTextAsPath(context, dc, clip, skPaint, viewMatrix, text, byteLength, x, y,
+ GrTextUtils::DrawTextAsPath(context, rtc, clip, skPaint, viewMatrix, text, byteLength, x, y,
regionClipBounds);
}
void GrAtlasTextContext::drawPosText(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const GrClip& clip,
const GrPaint& paint, const SkPaint& skPaint,
const SkMatrix& viewMatrix,
@@ -357,18 +357,18 @@ void GrAtlasTextContext::drawPosText(GrContext* context,
context->getBatchFontCache(),
*context->caps()->shaderCaps(),
paint, skPaint,
- ComputeScalerContextFlags(dc),
+ ComputeScalerContextFlags(rtc),
viewMatrix, props,
text, byteLength,
pos, scalarsPerPosition,
offset));
- blob->flushThrowaway(context, dc, props, fDistanceAdjustTable, skPaint, paint,
+ blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable, skPaint, paint,
clip, viewMatrix, regionClipBounds, offset.fX, offset.fY);
return;
}
// fall back to drawing as a path
- GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, skPaint, viewMatrix, text,
+ GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, skPaint, viewMatrix, text,
byteLength, pos, scalarsPerPosition, offset, regionClipBounds);
}
@@ -388,9 +388,9 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
gTextContext = GrAtlasTextContext::Create();
}
- // Setup dummy SkPaint / GrPaint / GrDrawContext
- sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApprox, 1024, 1024,
- kRGBA_8888_GrPixelConfig, nullptr));
+ // Setup dummy SkPaint / GrPaint / GrRenderTargetContext
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox, 1024, 1024, kRGBA_8888_GrPixelConfig, nullptr));
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
@@ -401,7 +401,7 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
skPaint.setSubpixelText(random->nextBool());
GrPaint grPaint;
- if (!SkPaintToGrPaint(context, drawContext.get(), skPaint, viewMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(context, renderTargetContext.get(), skPaint, viewMatrix, &grPaint)) {
SkFAIL("couldn't convert paint\n");
}
diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h
index 5bf7662c48..20da8be1d1 100644
--- a/src/gpu/text/GrAtlasTextContext.h
+++ b/src/gpu/text/GrAtlasTextContext.h
@@ -18,7 +18,7 @@
#endif
class GrDrawBatch;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrPipelineBuilder;
class GrTextBlobCache;
class SkGlyph;
@@ -32,16 +32,16 @@ public:
bool canDraw(const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&,
const GrShaderCaps&);
- void drawText(GrContext*, GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint&,
+ void drawText(GrContext*, GrRenderTargetContext*, const GrClip&, const GrPaint&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[],
size_t byteLength, SkScalar x, SkScalar y,
const SkIRect& regionClipBounds);
- void drawPosText(GrContext*, GrDrawContext*, const GrClip&, const GrPaint&,
+ void drawPosText(GrContext*, GrRenderTargetContext*, const GrClip&, const GrPaint&,
const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&,
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkIRect& regionClipBounds);
- void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&,
+ void drawTextBlob(GrContext*, GrRenderTargetContext*, const GrClip&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*,
SkScalar x, SkScalar y,
SkDrawFilter*, const SkIRect& clipBounds);
@@ -52,7 +52,7 @@ private:
// sets up the descriptor on the blob and returns a detached cache. Client must attach
inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd);
// Determines if we need to use fake gamma (and contrast boost):
- inline static uint32_t ComputeScalerContextFlags(GrDrawContext*);
+ inline static uint32_t ComputeScalerContextFlags(GrRenderTargetContext*);
static void RegenerateTextBlob(GrAtlasTextBlob* bmp,
GrBatchFontCache*,
const GrShaderCaps&,
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 32d80218d3..1d46fc6d62 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -8,7 +8,7 @@
#include "GrStencilAndCoverTextContext.h"
#include "GrAtlasTextContext.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrPath.h"
#include "GrPathRange.h"
#include "GrPipelineBuilder.h"
@@ -68,7 +68,7 @@ bool GrStencilAndCoverTextContext::internalCanDraw(const SkPaint& skPaint) {
return SkPaint::kStroke_Style != skPaint.getStyle() || 0 != skPaint.getStrokeWidth();
}
-void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* dc,
+void GrStencilAndCoverTextContext::drawText(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip, const GrPaint& paint,
const SkPaint& skPaint, const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
@@ -80,23 +80,23 @@ void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* d
if (skPaint.getTextSize() > 0) {
TextRun run(skPaint);
run.setText(text, byteLength, x, y);
- run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0,
+ run.draw(context, rtc, paint, clip, viewMatrix, props, 0, 0,
clipBounds, fFallbackTextContext, skPaint);
}
return;
} else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props,
*context->caps()->shaderCaps())) {
- fFallbackTextContext->drawText(context, dc, clip, paint, skPaint, viewMatrix, props, text,
+ fFallbackTextContext->drawText(context, rtc, clip, paint, skPaint, viewMatrix, props, text,
byteLength, x, y, clipBounds);
return;
}
// fall back to drawing as a path
- GrTextUtils::DrawTextAsPath(context, dc, clip, skPaint, viewMatrix, text, byteLength, x, y,
+ GrTextUtils::DrawTextAsPath(context, rtc, clip, skPaint, viewMatrix, text, byteLength, x, y,
clipBounds);
}
-void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext* dc,
+void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip,
const GrPaint& paint,
const SkPaint& skPaint,
@@ -114,25 +114,25 @@ void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext
if (skPaint.getTextSize() > 0) {
TextRun run(skPaint);
run.setPosText(text, byteLength, pos, scalarsPerPosition, offset);
- run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0,
+ run.draw(context, rtc, paint, clip, viewMatrix, props, 0, 0,
clipBounds, fFallbackTextContext, skPaint);
}
return;
} else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props,
*context->caps()->shaderCaps())) {
- fFallbackTextContext->drawPosText(context, dc, clip, paint, skPaint, viewMatrix, props,
+ fFallbackTextContext->drawPosText(context, rtc, clip, paint, skPaint, viewMatrix, props,
text, byteLength, pos,
scalarsPerPosition, offset, clipBounds);
return;
}
// fall back to drawing as a path
- GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, skPaint, viewMatrix, text,
+ GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, skPaint, viewMatrix, text,
byteLength, pos, scalarsPerPosition, offset, clipBounds);
}
void GrStencilAndCoverTextContext::uncachedDrawTextBlob(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const GrClip& clip,
const SkPaint& skPaint,
const SkMatrix& viewMatrix,
@@ -161,24 +161,24 @@ void GrStencilAndCoverTextContext::uncachedDrawTextBlob(GrContext* context,
runPaint.setFlags(GrTextUtils::FilterTextFlags(props, runPaint));
GrPaint grPaint;
- if (!SkPaintToGrPaint(context, dc, runPaint, viewMatrix, &grPaint)) {
+ if (!SkPaintToGrPaint(context, rtc, runPaint, viewMatrix, &grPaint)) {
return;
}
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning:
- this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix, props,
+ this->drawText(context, rtc, clip, grPaint, runPaint, viewMatrix, props,
(const char *)it.glyphs(),
textLen, x + offset.x(), y + offset.y(), clipBounds);
break;
case SkTextBlob::kHorizontal_Positioning:
- this->drawPosText(context, dc, clip, grPaint, runPaint, viewMatrix, props,
+ this->drawPosText(context, rtc, clip, grPaint, runPaint, viewMatrix, props,
(const char*)it.glyphs(),
textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()),
clipBounds);
break;
case SkTextBlob::kFull_Positioning:
- this->drawPosText(context, dc, clip, grPaint, runPaint, viewMatrix, props,
+ this->drawPosText(context, rtc, clip, grPaint, runPaint, viewMatrix, props,
(const char*)it.glyphs(),
textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds);
break;
@@ -191,7 +191,7 @@ void GrStencilAndCoverTextContext::uncachedDrawTextBlob(GrContext* context,
}
}
-void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
+void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
@@ -203,20 +203,20 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex
}
if (!this->internalCanDraw(skPaint)) {
- fFallbackTextContext->drawTextBlob(context, dc, clip, skPaint, viewMatrix, props, skBlob,
+ fFallbackTextContext->drawTextBlob(context, rtc, clip, skPaint, viewMatrix, props, skBlob,
x, y, drawFilter, clipBounds);
return;
}
if (drawFilter || skPaint.getPathEffect()) {
// This draw can't be cached.
- this->uncachedDrawTextBlob(context, dc, clip, skPaint, viewMatrix, props, skBlob, x, y,
+ this->uncachedDrawTextBlob(context, rtc, clip, skPaint, viewMatrix, props, skBlob, x, y,
drawFilter, clipBounds);
return;
}
GrPaint paint;
- if (!SkPaintToGrPaint(context, dc, skPaint, viewMatrix, &paint)) {
+ if (!SkPaintToGrPaint(context, rtc, skPaint, viewMatrix, &paint)) {
return;
}
@@ -226,7 +226,7 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex
for (TextRun* run = iter.get(); run; run = iter.next()) {
// The run's "font" overrides the anti-aliasing of the passed in paint!
paint.setAntiAlias(run->isAntiAlias());
- run->draw(context, dc, paint, clip, viewMatrix, props, x, y,
+ run->draw(context, rtc, paint, clip, viewMatrix, props, x, y,
clipBounds, fFallbackTextContext, skPaint);
run->releaseGlyphCache();
}
@@ -596,7 +596,7 @@ inline void GrStencilAndCoverTextContext::TextRun::appendGlyph(const SkGlyph& gl
}
void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
- GrDrawContext* drawContext,
+ GrRenderTargetContext* renderTargetContext,
const GrPaint& grPaint,
const GrClip& clip,
const SkMatrix& viewMatrix,
@@ -606,7 +606,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
GrAtlasTextContext* fallbackTextContext,
const SkPaint& originalSkPaint) const {
SkASSERT(fInstanceData);
- SkASSERT(drawContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias());
+ SkASSERT(renderTargetContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias());
if (fInstanceData->count()) {
static constexpr GrUserStencilSettings kCoverPass(
@@ -631,7 +631,8 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
// NV_path_rendering will also support NV_blend_equation_advanced.
// For clipping we'll just skip any optimizations based on the bounds. This does, however,
// hurt batching.
- const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext->height());
+ const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(),
+ renderTargetContext->height());
SkAutoTUnref<GrDrawBatch> batch(
GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x,
@@ -643,7 +644,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);
- drawContext->drawBatch(pipelineBuilder, clip, batch);
+ renderTargetContext->drawBatch(pipelineBuilder, clip, batch);
}
if (fFallbackTextBlob) {
@@ -653,8 +654,8 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fTextRatio);
}
- fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPaint, viewMatrix,
- props, fFallbackTextBlob.get(), x, y, nullptr,
+ fallbackTextContext->drawTextBlob(ctx, renderTargetContext, clip, fallbackSkPaint,
+ viewMatrix, props, fFallbackTextBlob.get(), x, y, nullptr,
clipBounds);
}
}
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h
index c87041a9e4..470e1e49c3 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.h
+++ b/src/gpu/text/GrStencilAndCoverTextContext.h
@@ -8,7 +8,7 @@
#ifndef GrStencilAndCoverTextContext_DEFINED
#define GrStencilAndCoverTextContext_DEFINED
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrStyle.h"
#include "SkDrawFilter.h"
#include "SkOpts.h"
@@ -31,18 +31,18 @@ class GrStencilAndCoverTextContext {
public:
static GrStencilAndCoverTextContext* Create(GrAtlasTextContext* fallbackTextContext);
- void drawText(GrContext*, GrDrawContext* dc,
+ void drawText(GrContext*, GrRenderTargetContext* rtc,
const GrClip&, const GrPaint&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[],
size_t byteLength, SkScalar x,
SkScalar y, const SkIRect& clipBounds);
- void drawPosText(GrContext*, GrDrawContext*,
+ void drawPosText(GrContext*, GrRenderTargetContext*,
const GrClip&, const GrPaint&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&,
const char text[], size_t byteLength,
const SkScalar pos[], int scalarsPerPosition,
const SkPoint& offset, const SkIRect& clipBounds);
- void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&,
+ void drawTextBlob(GrContext*, GrRenderTargetContext*, const GrClip&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*,
SkScalar x, SkScalar y,
SkDrawFilter*, const SkIRect& clipBounds);
@@ -58,7 +58,7 @@ private:
bool internalCanDraw(const SkPaint&);
- void uncachedDrawTextBlob(GrContext*, GrDrawContext* dc,
+ void uncachedDrawTextBlob(GrContext*, GrRenderTargetContext* rtc,
const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix,
const SkSurfaceProps&,
@@ -79,7 +79,7 @@ private:
void setPosText(const char text[], size_t byteLength, const SkScalar pos[],
int scalarsPerPosition, const SkPoint& offset);
- void draw(GrContext*, GrDrawContext*, const GrPaint&, const GrClip&,
+ void draw(GrContext*, GrRenderTargetContext*, const GrPaint&, const GrClip&,
const SkMatrix&, const SkSurfaceProps&,
SkScalar x, SkScalar y, const SkIRect& clipBounds,
GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const;
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index a5685f0381..14c4e8d3ac 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -12,7 +12,7 @@
#include "GrBlurUtils.h"
#include "GrCaps.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "SkDistanceFieldGen.h"
#include "SkDrawProcs.h"
@@ -468,7 +468,7 @@ bool GrTextUtils::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, GrBatchFont
return true;
}
-void GrTextUtils::DrawTextAsPath(GrContext* context, GrDrawContext* dc,
+void GrTextUtils::DrawTextAsPath(GrContext* context, GrRenderTargetContext* rtc,
const GrClip& clip,
const SkPaint& skPaint, const SkMatrix& viewMatrix,
const char text[], size_t byteLength, SkScalar x, SkScalar y,
@@ -486,7 +486,7 @@ void GrTextUtils::DrawTextAsPath(GrContext* context, GrDrawContext* dc,
matrix.postTranslate(xpos - prevXPos, 0);
if (iterPath) {
const SkPaint& pnt = iter.getPaint();
- GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, *iterPath,
+ GrBlurUtils::drawPathWithMaskFilter(context, rtc, clip, *iterPath,
pnt, viewMatrix, &matrix, clipBounds, false);
}
prevXPos = xpos;
@@ -494,7 +494,7 @@ void GrTextUtils::DrawTextAsPath(GrContext* context, GrDrawContext* dc,
}
void GrTextUtils::DrawPosTextAsPath(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkSurfaceProps& props,
const GrClip& clip,
const SkPaint& origPaint, const SkMatrix& viewMatrix,
@@ -538,7 +538,7 @@ void GrTextUtils::DrawPosTextAsPath(GrContext* context,
matrix[SkMatrix::kMTransX] = loc.fX;
matrix[SkMatrix::kMTransY] = loc.fY;
- GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, *path, paint,
+ GrBlurUtils::drawPathWithMaskFilter(context, rtc, clip, *path, paint,
viewMatrix, &matrix, clipBounds, false);
}
}
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h
index c218ab7da1..9529c540f4 100644
--- a/src/gpu/text/GrTextUtils.h
+++ b/src/gpu/text/GrTextUtils.h
@@ -17,7 +17,7 @@ class GrBatchFontCache;
class GrBatchTextStrike;
class GrClip;
class GrContext;
-class GrDrawContext;
+class GrRenderTargetContext;
class GrShaderCaps;
class SkGlyph;
class SkMatrix;
@@ -68,13 +68,13 @@ public:
const SkPoint& offset);
// Functions for drawing text as paths
- static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip,
+ static void DrawTextAsPath(GrContext*, GrRenderTargetContext*, const GrClip& clip,
const SkPaint& origPaint, const SkMatrix& viewMatrix,
const char text[], size_t byteLength, SkScalar x, SkScalar y,
const SkIRect& clipBounds);
static void DrawPosTextAsPath(GrContext* context,
- GrDrawContext* dc,
+ GrRenderTargetContext* rtc,
const SkSurfaceProps& props,
const GrClip& clip,
const SkPaint& origPaint, const SkMatrix& viewMatrix,
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 6af8491e73..cd26c8bf16 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -12,7 +12,7 @@
#include "SkAutoPixmapStorage.h"
#include "GrCaps.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrImageIDTextureAdjuster.h"
#include "GrTexturePriv.h"
#include "effects/GrYUVEffect.h"
@@ -251,13 +251,14 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
const int height = yuvSizes[0].fHeight;
// Needs to be a render target in order to draw to it for the yuv->rgb conversion.
- sk_sp<GrDrawContext> drawContext(ctx->makeDrawContext(SkBackingFit::kExact,
- width, height,
- kRGBA_8888_GrPixelConfig,
- std::move(imageColorSpace),
- 0,
- origin));
- if (!drawContext) {
+ sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeRenderTargetContext(
+ SkBackingFit::kExact,
+ width, height,
+ kRGBA_8888_GrPixelConfig,
+ std::move(imageColorSpace),
+ 0,
+ origin));
+ if (!renderTargetContext) {
return nullptr;
}
@@ -268,11 +269,11 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
- drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect);
- ctx->flushSurfaceWrites(drawContext->accessRenderTarget());
+ renderTargetContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect);
+ ctx->flushSurfaceWrites(renderTargetContext->accessRenderTarget());
return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
- kOpaque_SkAlphaType, drawContext->asTexture(),
- sk_ref_sp(drawContext->getColorSpace()), budgeted);
+ kOpaque_SkAlphaType, renderTargetContext->asTexture(),
+ sk_ref_sp(renderTargetContext->getColorSpace()), budgeted);
}
sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace colorSpace,
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 37e8eeb2e9..e83d474424 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -40,8 +40,8 @@ static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
// Grab the render target *after* firing notifications, as it may get switched if CoW kicks in.
surface->getDevice()->flush();
- GrDrawContext* dc = surface->getDevice()->accessDrawContext();
- return dc->accessRenderTarget();
+ GrRenderTargetContext* rtc = surface->getDevice()->accessRenderTargetContext();
+ return rtc->accessRenderTarget();
}
GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) {
@@ -67,8 +67,8 @@ SkCanvas* SkSurface_Gpu::onNewCanvas() {
}
sk_sp<SkSurface> SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
- int sampleCount = fDevice->accessDrawContext()->numColorSamples();
- GrSurfaceOrigin origin = fDevice->accessDrawContext()->origin();
+ int sampleCount = fDevice->accessRenderTargetContext()->numColorSamples();
+ GrSurfaceOrigin origin = fDevice->accessRenderTargetContext()->origin();
// TODO: Make caller specify this (change virtual signature of onNewSurface).
static const SkBudgeted kBudgeted = SkBudgeted::kNo;
return SkSurface::MakeRenderTarget(fDevice->context(), kBudgeted, info, sampleCount,
@@ -76,7 +76,7 @@ sk_sp<SkSurface> SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
}
sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, SkCopyPixelsMode cpm) {
- GrRenderTarget* rt = fDevice->accessDrawContext()->accessRenderTarget();
+ GrRenderTarget* rt = fDevice->accessRenderTargetContext()->accessRenderTarget();
SkASSERT(rt);
GrTexture* tex = rt->asTexture();
sk_sp<GrTexture> copy;
@@ -84,7 +84,7 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, SkCopyPixe
// want to ever retarget the SkSurface at another buffer we create. Force a copy now to avoid
// copy-on-write.
if (kAlways_SkCopyPixelsMode == cpm || !tex || rt->resourcePriv().refsWrappedObjects()) {
- GrSurfaceDesc desc = fDevice->accessDrawContext()->desc();
+ GrSurfaceDesc desc = fDevice->accessRenderTargetContext()->desc();
GrContext* ctx = fDevice->context();
desc.fFlags = desc.fFlags & ~kRenderTarget_GrSurfaceFlag;
copy.reset(ctx->textureProvider()->createTexture(desc, budgeted));
@@ -110,13 +110,13 @@ sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, SkCopyPixe
// render target into it. Note that this flushes the SkGpuDevice but
// doesn't force an OpenGL flush.
void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
- GrRenderTarget* rt = fDevice->accessDrawContext()->accessRenderTarget();
+ GrRenderTarget* rt = fDevice->accessRenderTargetContext()->accessRenderTarget();
// are we sharing our render target with the image? Note this call should never create a new
// image because onCopyOnWrite is only called when there is a cached image.
sk_sp<SkImage> image(this->refCachedImage(SkBudgeted::kNo, kNo_ForceUnique));
SkASSERT(image);
if (rt->asTexture() == as_IB(image)->peekTexture()) {
- this->fDevice->replaceDrawContext(SkSurface::kRetain_ContentChangeMode == mode);
+ this->fDevice->replaceRenderTargetContext(SkSurface::kRetain_ContentChangeMode == mode);
SkTextureImageApplyBudgetedDecision(image.get());
} else if (kDiscard_ContentChangeMode == mode) {
this->SkSurface_Gpu::onDiscard();
@@ -124,7 +124,7 @@ void SkSurface_Gpu::onCopyOnWrite(ContentChangeMode mode) {
}
void SkSurface_Gpu::onDiscard() {
- fDevice->accessDrawContext()->discard();
+ fDevice->accessRenderTargetContext()->discard();
}
void SkSurface_Gpu::onPrepareForExternalIO() {
@@ -192,16 +192,16 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
return nullptr;
}
- sk_sp<GrDrawContext> dc(context->contextPriv().makeBackendTextureDrawContext(
+ sk_sp<GrRenderTargetContext> rtc(context->contextPriv().makeBackendTextureRenderTargetContext(
desc,
std::move(colorSpace),
props,
kBorrow_GrWrapOwnership));
- if (!dc) {
+ if (!rtc) {
return nullptr;
}
- sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(dc), desc.fWidth, desc.fHeight,
+ sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rtc), desc.fWidth, desc.fHeight,
SkGpuDevice::kUninit_InitContents));
if (!device) {
return nullptr;
@@ -220,15 +220,15 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
return nullptr;
}
- sk_sp<GrDrawContext> dc(context->contextPriv().makeBackendRenderTargetDrawContext(
- desc,
- std::move(colorSpace),
- props));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(
+ context->contextPriv().makeBackendRenderTargetRenderTargetContext(desc,
+ std::move(colorSpace),
+ props));
+ if (!rtc) {
return nullptr;
}
- sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(dc), desc.fWidth, desc.fHeight,
+ sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rtc), desc.fWidth, desc.fHeight,
SkGpuDevice::kUninit_InitContents));
if (!device) {
return nullptr;
@@ -248,15 +248,16 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
return nullptr;
}
- sk_sp<GrDrawContext> dc(context->contextPriv().makeBackendTextureAsRenderTargetDrawContext(
- desc,
- std::move(colorSpace),
- props));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(
+ context->contextPriv().makeBackendTextureAsRenderTargetRenderTargetContext(
+ desc,
+ std::move(colorSpace),
+ props));
+ if (!rtc) {
return nullptr;
}
- sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(dc), desc.fWidth, desc.fHeight,
+ sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rtc), desc.fWidth, desc.fHeight,
SkGpuDevice::kUninit_InitContents));
if (!device) {
return nullptr;
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index b9ece6bce3..4a6e26c86a 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -9,15 +9,15 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpu.h"
#include "GrRenderTarget.h"
#include "GrTexture.h"
#include "GrTextureProvider.h"
-static bool check_rect(GrDrawContext* dc, const SkIRect& rect, uint32_t expectedValue,
+static bool check_rect(GrRenderTargetContext* rtc, const SkIRect& rect, uint32_t expectedValue,
uint32_t* actualValue, int* failX, int* failY) {
- GrRenderTarget* rt = dc->accessRenderTarget();
+ GrRenderTarget* rt = rtc->accessRenderTarget();
int w = rect.width();
int h = rect.height();
SkAutoTDeleteArray<uint32_t> pixels(new uint32_t[w * h]);
@@ -37,19 +37,20 @@ static bool check_rect(GrDrawContext* dc, const SkIRect& rect, uint32_t expected
return true;
}
-static bool reset_dc(sk_sp<GrDrawContext>* dc, GrContext* context, int w, int h) {
+static bool reset_rtc(sk_sp<GrRenderTargetContext>* rtc, GrContext* context, int w, int h) {
SkDEBUGCODE(uint32_t oldID = 0;)
- if (*dc) {
- SkDEBUGCODE(oldID = (*dc)->accessRenderTarget()->uniqueID();)
- dc->reset(nullptr);
+ if (*rtc) {
+ SkDEBUGCODE(oldID = (*rtc)->accessRenderTarget()->uniqueID();)
+ rtc->reset(nullptr);
}
context->freeGpuResources();
- *dc = context->makeDrawContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig, nullptr);
+ *rtc = context->makeRenderTargetContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig,
+ nullptr);
- SkASSERT((*dc)->accessRenderTarget()->uniqueID() != oldID);
+ SkASSERT((*rtc)->accessRenderTarget()->uniqueID() != oldID);
- return *dc != nullptr;
+ return *rtc != nullptr;
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
@@ -58,7 +59,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
static const int kH = 10;
SkIRect fullRect = SkIRect::MakeWH(kW, kH);
- sk_sp<GrDrawContext> drawContext;
+ sk_sp<GrRenderTargetContext> rtContext;
// A rectangle that is inset by one on all sides and the 1-pixel wide rectangles that surround
// it.
@@ -82,140 +83,140 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearBatch, reporter, ctxInfo) {
static const GrColor kColor1 = 0xABCDEF01;
static const GrColor kColor2 = ~kColor1;
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Check a full clear
- drawContext->clear(&fullRect, kColor1, false);
- if (!check_rect(drawContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Check two full clears, same color
- drawContext->clear(&fullRect, kColor1, false);
- drawContext->clear(&fullRect, kColor1, false);
- if (!check_rect(drawContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ rtContext->clear(&fullRect, kColor1, false);
+ if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Check two full clears, different colors
- drawContext->clear(&fullRect, kColor1, false);
- drawContext->clear(&fullRect, kColor2, false);
- if (!check_rect(drawContext.get(), fullRect, kColor2, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ rtContext->clear(&fullRect, kColor2, false);
+ if (!check_rect(rtContext.get(), fullRect, kColor2, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Test a full clear followed by a same color inset clear
- drawContext->clear(&fullRect, kColor1, false);
- drawContext->clear(&mid1Rect, kColor1, false);
- if (!check_rect(drawContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ rtContext->clear(&mid1Rect, kColor1, false);
+ if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Test a inset clear followed by same color full clear
- drawContext->clear(&mid1Rect, kColor1, false);
- drawContext->clear(&fullRect, kColor1, false);
- if (!check_rect(drawContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
+ rtContext->clear(&mid1Rect, kColor1, false);
+ rtContext->clear(&fullRect, kColor1, false);
+ if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Test a full clear followed by a different color inset clear
- drawContext->clear(&fullRect, kColor1, false);
- drawContext->clear(&mid1Rect, kColor2, false);
- if (!check_rect(drawContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ rtContext->clear(&mid1Rect, kColor2, false);
+ if (!check_rect(rtContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue,
failX, failY);
}
- if (!check_rect(drawContext.get(), outerLeftEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerTopEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerRightEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerBottomEdge, kColor1, &actualValue, &failX, &failY)) {
+ if (!check_rect(rtContext.get(), outerLeftEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerTopEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerRightEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerBottomEdge, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Test a inset clear followed by a different full clear
- drawContext->clear(&mid1Rect, kColor2, false);
- drawContext->clear(&fullRect, kColor1, false);
- if (!check_rect(drawContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
+ rtContext->clear(&mid1Rect, kColor2, false);
+ rtContext->clear(&fullRect, kColor1, false);
+ if (!check_rect(rtContext.get(), fullRect, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Check three nested clears from largest to smallest where outermost and innermost are same
// color.
- drawContext->clear(&fullRect, kColor1, false);
- drawContext->clear(&mid1Rect, kColor2, false);
- drawContext->clear(&mid2Rect, kColor1, false);
- if (!check_rect(drawContext.get(), mid2Rect, kColor1, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ rtContext->clear(&mid1Rect, kColor2, false);
+ rtContext->clear(&mid2Rect, kColor1, false);
+ if (!check_rect(rtContext.get(), mid2Rect, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!check_rect(drawContext.get(), innerLeftEdge, kColor2, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), innerTopEdge, kColor2, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), innerRightEdge, kColor2, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), innerBottomEdge, kColor2, &actualValue, &failX, &failY)) {
+ if (!check_rect(rtContext.get(), innerLeftEdge, kColor2, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), innerTopEdge, kColor2, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), innerRightEdge, kColor2, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), innerBottomEdge, kColor2, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue,
failX, failY);
}
- if (!check_rect(drawContext.get(), outerLeftEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerTopEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerRightEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerBottomEdge, kColor1, &actualValue, &failX, &failY)) {
+ if (!check_rect(rtContext.get(), outerLeftEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerTopEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerRightEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerBottomEdge, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
- if (!reset_dc(&drawContext, context, kW, kH)) {
- ERRORF(reporter, "Could not create draw context.");
+ if (!reset_rtc(&rtContext, context, kW, kH)) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
// Swap the order of the second two clears in the above test.
- drawContext->clear(&fullRect, kColor1, false);
- drawContext->clear(&mid2Rect, kColor1, false);
- drawContext->clear(&mid1Rect, kColor2, false);
- if (!check_rect(drawContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) {
+ rtContext->clear(&fullRect, kColor1, false);
+ rtContext->clear(&mid2Rect, kColor1, false);
+ rtContext->clear(&mid1Rect, kColor2, false);
+ if (!check_rect(rtContext.get(), mid1Rect, kColor2, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor2, actualValue,
failX, failY);
}
- if (!check_rect(drawContext.get(), outerLeftEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerTopEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerRightEdge, kColor1, &actualValue, &failX, &failY) ||
- !check_rect(drawContext.get(), outerBottomEdge, kColor1, &actualValue, &failX, &failY)) {
+ if (!check_rect(rtContext.get(), outerLeftEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerTopEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerRightEdge, kColor1, &actualValue, &failX, &failY) ||
+ !check_rect(rtContext.get(), outerBottomEdge, kColor1, &actualValue, &failX, &failY)) {
ERRORF(reporter, "Expected 0x%08x but got 0x%08x at (%d, %d).", kColor1, actualValue,
failX, failY);
}
diff --git a/tests/DFPathRendererTest.cpp b/tests/DFPathRendererTest.cpp
index 30ca17d346..25c8f82839 100644
--- a/tests/DFPathRendererTest.cpp
+++ b/tests/DFPathRendererTest.cpp
@@ -17,7 +17,7 @@
// Because of inaccuracies in large floating point values this causes the
// the path renderer to attempt to add a path DF to its atlas that is larger
// than the plot size which used to crash rather than fail gracefully.
-static void test_far_from_origin(GrDrawContext* drawContext, GrPathRenderer* pr,
+static void test_far_from_origin(GrRenderTargetContext* renderTargetContext, GrPathRenderer* pr,
GrResourceProvider* rp) {
SkPath path;
path.lineTo(49.0255089839f, 0.473541f);
@@ -48,7 +48,7 @@ static void test_far_from_origin(GrDrawContext* drawContext, GrPathRenderer* pr,
GrPathRenderer::DrawPathArgs args;
args.fPaint = &paint;
args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
- args.fDrawContext = drawContext;
+ args.fRenderTargetContext = renderTargetContext;
args.fClip = &noClip;
args.fResourceProvider = rp;
args.fViewMatrix = &matrix;
@@ -63,22 +63,23 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(AADistanceFieldPathRenderer, reporter, ctxInfo)
if (!ctxInfo.grContext()->caps()->shaderCaps()->shaderDerivativeSupport()) {
return;
}
- sk_sp<GrDrawContext> dc(ctxInfo.grContext()->makeDrawContext(SkBackingFit::kApprox,
- 800, 800,
- kRGBA_8888_GrPixelConfig,
- nullptr,
- 0,
- kTopLeft_GrSurfaceOrigin));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(ctxInfo.grContext()->makeRenderTargetContext(
+ SkBackingFit::kApprox,
+ 800, 800,
+ kRGBA_8888_GrPixelConfig,
+ nullptr,
+ 0,
+ kTopLeft_GrSurfaceOrigin));
+ if (!rtc) {
return;
}
GrAADistanceFieldPathRenderer dfpr;
GrTestTarget tt;
- ctxInfo.grContext()->getTestTarget(&tt, dc);
+ ctxInfo.grContext()->getTestTarget(&tt, rtc);
GrResourceProvider* rp = tt.resourceProvider();
- test_far_from_origin(dc.get(), &dfpr, rp);
+ test_far_from_origin(rtc.get(), &dfpr, rp);
ctxInfo.grContext()->flush();
}
#endif
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 9e501cb4b5..fc490614c1 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -15,7 +15,7 @@
#include "GrBatchTest.h"
#include "GrContextFactory.h"
#include "GrContextPriv.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrDrawingManager.h"
#include "GrInvariantOutput.h"
#include "GrPipeline.h"
@@ -148,21 +148,22 @@ private:
static const int kRenderTargetHeight = 1;
static const int kRenderTargetWidth = 1;
-static sk_sp<GrDrawContext> random_draw_context(GrContext* context,
- SkRandom* random,
- const GrCaps* caps) {
+static sk_sp<GrRenderTargetContext> random_render_target_context(GrContext* context,
+ SkRandom* random,
+ const GrCaps* caps) {
GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin
: kBottomLeft_GrSurfaceOrigin;
int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0;
- sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kExact,
- kRenderTargetWidth,
- kRenderTargetHeight,
- kRGBA_8888_GrPixelConfig,
- nullptr,
- sampleCnt,
- origin));
- return drawContext;
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kExact,
+ kRenderTargetWidth,
+ kRenderTargetHeight,
+ kRGBA_8888_GrPixelConfig,
+ nullptr,
+ sampleCnt,
+ origin));
+ return renderTargetContext;
}
static void set_random_xpf(GrPaint* paint, GrProcessorTestData* d) {
@@ -320,9 +321,10 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
static const int NUM_TESTS = 1024;
for (int t = 0; t < NUM_TESTS; t++) {
// setup random render target(can fail)
- sk_sp<GrDrawContext> drawContext(random_draw_context(context, &random, context->caps()));
- if (!drawContext) {
- SkDebugf("Could not allocate drawContext");
+ sk_sp<GrRenderTargetContext> renderTargetContext(random_render_target_context(
+ context, &random, context->caps()));
+ if (!renderTargetContext) {
+ SkDebugf("Could not allocate renderTargetContext");
return false;
}
@@ -332,25 +334,27 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
SkASSERT(batch);
GrProcessorTestData ptd(&random, context, context->caps(),
- drawContext.get(), dummyTextures);
+ renderTargetContext.get(), dummyTextures);
set_random_color_coverage_stages(&grPaint, &ptd, maxStages);
set_random_xpf(&grPaint, &ptd);
bool snapToCenters = set_random_state(&grPaint, &random);
const GrUserStencilSettings* uss = get_random_stencil(&random);
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch, uss, snapToCenters);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint, batch, uss,
+ snapToCenters);
}
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)
drawingManager->flush();
// Validate that GrFPs work correctly without an input.
- sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kExact,
- kRenderTargetWidth,
- kRenderTargetHeight,
- kRGBA_8888_GrPixelConfig,
- nullptr));
- if (!drawContext) {
- SkDebugf("Could not allocate a drawContext");
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kExact,
+ kRenderTargetWidth,
+ kRenderTargetHeight,
+ kRGBA_8888_GrPixelConfig,
+ nullptr));
+ if (!renderTargetContext) {
+ SkDebugf("Could not allocate a renderTargetContext");
return false;
}
@@ -361,7 +365,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
GrProcessorTestData ptd(&random, context, context->caps(),
- drawContext.get(), dummyTextures);
+ renderTargetContext.get(), dummyTextures);
GrPaint grPaint;
grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
@@ -371,7 +375,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
BlockInputFragmentProcessor::Make(std::move(fp)));
grPaint.addColorFragmentProcessor(std::move(blockFP));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint, batch);
drawingManager->flush();
}
}
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index aeaa36f3e5..48a7cfd0a5 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -12,8 +12,8 @@
#if SK_SUPPORT_GPU
#include "GrBatchFlushState.h"
-#include "GrDrawContext.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContext.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrContext.h"
#include "GrGeometryProcessor.h"
#include "GrGpu.h"
@@ -104,11 +104,12 @@ private:
DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
- sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApprox,
- 1, 1, kRGBA_8888_GrPixelConfig,
- nullptr));
- if (!drawContext) {
- ERRORF(reporter, "Could not create draw context.");
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+ SkBackingFit::kApprox,
+ 1, 1, kRGBA_8888_GrPixelConfig,
+ nullptr));
+ if (!renderTargetContext) {
+ ERRORF(reporter, "Could not create render target context.");
return;
}
int attribCnt = context->caps()->maxVertexAttributes();
@@ -126,7 +127,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
GrPaint grPaint;
// This one should succeed.
batch.reset(new Batch(attribCnt));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint, batch);
context->flush();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1);
@@ -135,7 +136,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
context->resetGpuStats();
// This one should fail.
batch.reset(new Batch(attribCnt+1));
- drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch);
+ renderTargetContext->renderTargetContextPriv().testingOnly_drawBatch(grPaint, batch);
context->flush();
#if GR_GPU_STATS
REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0);
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 1491326236..8bdcbb3013 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -9,7 +9,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextPriv.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "gl/GrGLGpu.h"
#include "gl/GrGLUtil.h"
#include "gl/GLTestContext.h"
@@ -90,17 +90,17 @@ static void test_copy_surface_dst(skiatest::Reporter* reporter, GrContext* conte
static void test_clear(skiatest::Reporter* reporter, GrContext* context,
GrTexture* rectangleTexture) {
if (rectangleTexture->asRenderTarget()) {
- sk_sp<GrDrawContext> dc(context->contextPriv().makeWrappedDrawContext(
+ sk_sp<GrRenderTargetContext> rtc(context->contextPriv().makeWrappedRenderTargetContext(
sk_ref_sp(rectangleTexture->asRenderTarget()),
nullptr));
- if (!dc) {
- ERRORF(reporter, "Could not get GrDrawContext for rectangle texture.");
+ if (!rtc) {
+ ERRORF(reporter, "Could not get GrRenderTargetContext for rectangle texture.");
return;
}
// Clear the whole thing.
GrColor color0 = GrColorPackRGBA(0xA, 0xB, 0xC, 0xD);
- dc->clear(nullptr, color0, false);
+ rtc->clear(nullptr, color0, false);
int w = rectangleTexture->width();
int h = rectangleTexture->height();
@@ -121,7 +121,7 @@ static void test_clear(skiatest::Reporter* reporter, GrContext* context,
// Clear the the top to a different color.
GrColor color1 = GrColorPackRGBA(0x1, 0x2, 0x3, 0x4);
SkIRect rect = SkIRect::MakeWH(w, h/2);
- dc->clear(&rect, color1, false);
+ rtc->clear(&rect, color1, false);
uint32_t expectedColor1 = 0;
uint8_t* expectedBytes1 = SkTCast<uint8_t*>(&expectedColor1);
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 8855c3d15f..a7f846cbe5 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -9,7 +9,7 @@
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "SkCanvas.h"
#include "SkSurface.h"
@@ -121,12 +121,10 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// Create two draw contexts (L32 and S32)
sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
- sk_sp<GrDrawContext> l32DrawContext = context->makeDrawContext(SkBackingFit::kExact, rtS, rtS,
- kRGBA_8888_GrPixelConfig,
- nullptr);
- sk_sp<GrDrawContext> s32DrawContext = context->makeDrawContext(SkBackingFit::kExact, rtS, rtS,
- kSRGBA_8888_GrPixelConfig,
- std::move(srgbColorSpace));
+ sk_sp<GrRenderTargetContext> l32RenderTargetContext = context->makeRenderTargetContext(
+ SkBackingFit::kExact, rtS, rtS, kRGBA_8888_GrPixelConfig, nullptr);
+ sk_sp<GrRenderTargetContext> s32RenderTargetContext = context->makeRenderTargetContext(
+ SkBackingFit::kExact, rtS, rtS, kSRGBA_8888_GrPixelConfig, std::move(srgbColorSpace));
SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS));
GrNoClip noClip;
@@ -137,20 +135,20 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
// 1) Draw texture to S32 surface (should generate/use sRGB mips)
paint.setGammaCorrect(true);
- s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, s32DrawContext->asTexture().get(), expectedSRGB, error,
+ s32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect);
+ read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), expectedSRGB, error,
"first render of sRGB");
// 2) Draw texture to L32 surface (should generate/use linear mips)
paint.setGammaCorrect(false);
- l32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, l32DrawContext->asTexture().get(), expectedLinear, error,
- "re-render as linear");
+ l32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect);
+ read_and_check_pixels(reporter, l32RenderTargetContext->asTexture().get(), expectedLinear,
+ error, "re-render as linear");
// 3) Go back to sRGB
paint.setGammaCorrect(true);
- s32DrawContext->drawRect(noClip, paint, SkMatrix::I(), rect);
- read_and_check_pixels(reporter, s32DrawContext->asTexture().get(), expectedSRGB, error,
+ s32RenderTargetContext->drawRect(noClip, paint, SkMatrix::I(), rect);
+ read_and_check_pixels(reporter, s32RenderTargetContext->asTexture().get(), expectedSRGB, error,
"re-render as sRGB");
}
#endif
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 0ccf51f040..a12630389e 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -19,7 +19,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
#include "GrGpu.h"
#include "GrResourceProvider.h"
#include <vector>
@@ -314,8 +314,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, ctxInfo) {
};
auto surfaceBackingStore = [reporter](SkSurface* surface) {
- GrDrawContext* dc = surface->getCanvas()->internal_private_accessTopLayerDrawContext();
- GrRenderTarget* rt = dc->accessRenderTarget();
+ GrRenderTargetContext* rtc =
+ surface->getCanvas()->internal_private_accessTopLayerRenderTargetContext();
+ GrRenderTarget* rt = rtc->accessRenderTarget();
if (!rt) {
ERRORF(reporter, "Not render target backed.");
return static_cast<intptr_t>(0);
@@ -566,7 +567,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) {
static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) {
SkSurface_Gpu* gsurf = (SkSurface_Gpu*)surf.get();
- return gsurf->getDevice()->accessDrawContext()->accessRenderTarget()->resourcePriv().isBudgeted();
+ return gsurf->getDevice()->accessRenderTargetContext()
+ ->accessRenderTarget()->resourcePriv().isBudgeted();
}
static SkBudgeted is_budgeted(SkImage* image) {
@@ -793,8 +795,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
std::function<GrSurface*(SkSurface*)> grSurfaceGetters[] = {
[] (SkSurface* s){
- GrDrawContext* dc = s->getCanvas()->internal_private_accessTopLayerDrawContext();
- return dc->accessRenderTarget(); },
+ GrRenderTargetContext* rtc =
+ s->getCanvas()->internal_private_accessTopLayerRenderTargetContext();
+ return rtc->accessRenderTarget(); },
[] (SkSurface* s){ sk_sp<SkImage> i(s->makeImageSnapshot());
return as_IB(i)->peekTexture(); }
};
@@ -903,8 +906,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf
// Validate that we can attach a stencil buffer to an SkSurface created by either of
// our surface functions.
- GrRenderTarget* rt = surface->getCanvas()->internal_private_accessTopLayerDrawContext()
- ->accessRenderTarget();
+ GrRenderTarget* rt = surface->getCanvas()
+ ->internal_private_accessTopLayerRenderTargetContext()->accessRenderTarget();
REPORTER_ASSERT(reporter,
ctxInfo.grContext()->resourceProvider()->attachStencilAttachment(rt));
gpu->deleteTestingOnlyBackendTexture(textureObject);
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index 5160124b2f..324ea4bce5 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -249,7 +249,8 @@ static SkPath create_path_16() {
return path;
}
-static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const SkPath& path) {
+static void test_path(GrRenderTargetContext* renderTargetContext, GrResourceProvider* rp,
+ const SkPath& path) {
GrTessellatingPathRenderer tess;
GrPaint paint;
@@ -260,7 +261,7 @@ static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const
GrPathRenderer::DrawPathArgs args;
args.fPaint = &paint;
args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
- args.fDrawContext = drawContext;
+ args.fRenderTargetContext = renderTargetContext;
args.fClip = &noClip;
args.fResourceProvider = rp;
args.fViewMatrix = &SkMatrix::I();
@@ -271,36 +272,37 @@ static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
- sk_sp<GrDrawContext> dc(ctxInfo.grContext()->makeDrawContext(SkBackingFit::kApprox,
- 800, 800,
- kRGBA_8888_GrPixelConfig,
- nullptr,
- 0,
- kTopLeft_GrSurfaceOrigin));
- if (!dc) {
+ sk_sp<GrRenderTargetContext> rtc(ctxInfo.grContext()->makeRenderTargetContext(
+ SkBackingFit::kApprox,
+ 800, 800,
+ kRGBA_8888_GrPixelConfig,
+ nullptr,
+ 0,
+ kTopLeft_GrSurfaceOrigin));
+ if (!rtc) {
return;
}
GrTestTarget tt;
- ctxInfo.grContext()->getTestTarget(&tt, dc);
+ ctxInfo.grContext()->getTestTarget(&tt, rtc);
GrResourceProvider* rp = tt.resourceProvider();
- test_path(dc.get(), rp, create_path_0());
- test_path(dc.get(), rp, create_path_1());
- test_path(dc.get(), rp, create_path_2());
- test_path(dc.get(), rp, create_path_3());
- test_path(dc.get(), rp, create_path_4());
- test_path(dc.get(), rp, create_path_5());
- test_path(dc.get(), rp, create_path_6());
- test_path(dc.get(), rp, create_path_7());
- test_path(dc.get(), rp, create_path_8());
- test_path(dc.get(), rp, create_path_9());
- test_path(dc.get(), rp, create_path_10());
- test_path(dc.get(), rp, create_path_11());
- test_path(dc.get(), rp, create_path_12());
- test_path(dc.get(), rp, create_path_13());
- test_path(dc.get(), rp, create_path_14());
- test_path(dc.get(), rp, create_path_15());
- test_path(dc.get(), rp, create_path_16());
+ test_path(rtc.get(), rp, create_path_0());
+ test_path(rtc.get(), rp, create_path_1());
+ test_path(rtc.get(), rp, create_path_2());
+ test_path(rtc.get(), rp, create_path_3());
+ test_path(rtc.get(), rp, create_path_4());
+ test_path(rtc.get(), rp, create_path_5());
+ test_path(rtc.get(), rp, create_path_6());
+ test_path(rtc.get(), rp, create_path_7());
+ test_path(rtc.get(), rp, create_path_8());
+ test_path(rtc.get(), rp, create_path_9());
+ test_path(rtc.get(), rp, create_path_10());
+ test_path(rtc.get(), rp, create_path_11());
+ test_path(rtc.get(), rp, create_path_12());
+ test_path(rtc.get(), rp, create_path_13());
+ test_path(rtc.get(), rp, create_path_14());
+ test_path(rtc.get(), rp, create_path_15());
+ test_path(rtc.get(), rp, create_path_16());
}
#endif
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 74e65daa94..ee3427dff1 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -349,7 +349,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
// get the render target of the top device so we can ignore batches drawn offscreen
SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_testing();
SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd);
- uint32_t rtID = gbd->accessDrawContext()->accessRenderTarget()->uniqueID();
+ uint32_t rtID = gbd->accessRenderTargetContext()->accessRenderTarget()->uniqueID();
// get the bounding boxes to draw
SkTArray<GrAuditTrail::BatchInfo> childrenBounds;
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 387ef32ffd..e844ce5713 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -9,7 +9,7 @@
#include "GrBatchAtlas.h"
#include "GrContextOptions.h"
-#include "GrDrawContextPriv.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrDrawingManager.h"
#include "GrGpuResourceCacheAccess.h"
#include "GrPipelineBuilder.h"
@@ -55,21 +55,21 @@ void SetupAlwaysEvictAtlas(GrContext* context) {
}
};
-void GrTestTarget::init(GrContext* ctx, sk_sp<GrDrawContext> drawContext) {
+void GrTestTarget::init(GrContext* ctx, sk_sp<GrRenderTargetContext> renderTargetContext) {
SkASSERT(!fContext);
fContext.reset(SkRef(ctx));
- fDrawContext = drawContext;
+ fRenderTargetContext = renderTargetContext;
}
-void GrContext::getTestTarget(GrTestTarget* tar, sk_sp<GrDrawContext> drawContext) {
+void GrContext::getTestTarget(GrTestTarget* tar, sk_sp<GrRenderTargetContext> renderTargetContext) {
this->flush();
- SkASSERT(drawContext);
+ SkASSERT(renderTargetContext);
// We could create a proxy GrOpList that passes through to fGpu until ~GrTextTarget() and
// then disconnects. This would help prevent test writers from mixing using the returned
// GrOpList and regular drawing. We could also assert or fail in GrContext drawing methods
// until ~GrTestTarget().
- tar->init(this, std::move(drawContext));
+ tar->init(this, std::move(renderTargetContext));
}
void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) {
@@ -140,7 +140,7 @@ void SkGpuDevice::drawTexture(GrTexture* tex, const SkRect& dst, const SkPaint&
GrPaint grPaint;
SkMatrix mat;
mat.reset();
- if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, mat, &grPaint)) {
+ if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, mat, &grPaint)) {
return;
}
SkMatrix textureMat;
@@ -152,7 +152,7 @@ void SkGpuDevice::drawTexture(GrTexture* tex, const SkRect& dst, const SkPaint&
grPaint.addColorTextureProcessor(tex, nullptr, textureMat);
- fDrawContext->drawRect(GrNoClip(), grPaint, mat, dst);
+ fRenderTargetContext->drawRect(GrNoClip(), grPaint, mat, dst);
}
@@ -232,19 +232,20 @@ void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT
///////////////////////////////////////////////////////////////////////////////
#define ASSERT_SINGLE_OWNER \
- SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fDrawContext->fSingleOwner);)
-#define RETURN_IF_ABANDONED if (fDrawContext->fDrawingManager->wasAbandoned()) { return; }
+ SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->fSingleOwner);)
+#define RETURN_IF_ABANDONED if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return; }
-void GrDrawContextPriv::testingOnly_drawBatch(const GrPaint& paint,
- GrDrawBatch* batch,
- const GrUserStencilSettings* uss,
- bool snapToCenters) {
+void GrRenderTargetContextPriv::testingOnly_drawBatch(const GrPaint& paint,
+ GrDrawBatch* batch,
+ const GrUserStencilSettings* uss,
+ bool snapToCenters) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
- SkDEBUGCODE(fDrawContext->validate();)
- GR_AUDIT_TRAIL_AUTO_FRAME(fDrawContext->fAuditTrail, "GrDrawContext::testingOnly_drawBatch");
+ SkDEBUGCODE(fRenderTargetContext->validate();)
+ GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
+ "GrRenderTargetContext::testingOnly_drawBatch");
- GrPipelineBuilder pipelineBuilder(paint, fDrawContext->mustUseHWAA(paint));
+ GrPipelineBuilder pipelineBuilder(paint, fRenderTargetContext->mustUseHWAA(paint));
if (uss) {
pipelineBuilder.setUserStencil(uss);
}
@@ -252,7 +253,8 @@ void GrDrawContextPriv::testingOnly_drawBatch(const GrPaint& paint,
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag, true);
}
- fDrawContext->getOpList()->drawBatch(pipelineBuilder, fDrawContext, GrNoClip(), batch);
+ fRenderTargetContext->getOpList()->drawBatch(pipelineBuilder, fRenderTargetContext, GrNoClip(),
+ batch);
}
#undef ASSERT_SINGLE_OWNER
diff --git a/tools/gpu/GrTest.h b/tools/gpu/GrTest.h
index 86333b4f6c..a991c21bb2 100644
--- a/tools/gpu/GrTest.h
+++ b/tools/gpu/GrTest.h
@@ -9,7 +9,7 @@
#define GrTest_DEFINED
#include "GrContext.h"
-#include "GrDrawContext.h"
+#include "GrRenderTargetContext.h"
namespace GrTest {
/**
@@ -27,13 +27,13 @@ class GrTestTarget {
public:
GrTestTarget() {}
- void init(GrContext*, sk_sp<GrDrawContext>);
+ void init(GrContext*, sk_sp<GrRenderTargetContext>);
GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
private:
SkAutoTUnref<GrContext> fContext;
- sk_sp<GrDrawContext> fDrawContext;
+ sk_sp<GrRenderTargetContext> fRenderTargetContext;
};
#endif