Cruft leftover from GrSurfaceContext hierarchy v1/v2 split
Non-substantive changes that didn't fit any earlier CL in the chain.
Bug: skia:11837
Change-Id: Ic9b7c05c014b03ab5b30532098fb8cd2da846d9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428958
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/fp_sample_chaining.cpp b/gm/fp_sample_chaining.cpp
index 10ea191..ea24a60 100644
--- a/gm/fp_sample_chaining.cpp
+++ b/gm/fp_sample_chaining.cpp
@@ -12,6 +12,7 @@
#include "src/gpu/GrDirectContextPriv.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/SkGr.h"
+#include "src/gpu/effects/GrMatrixEffect.h"
#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index adccfeb..c844c8c 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -32,6 +32,7 @@
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrThreadSafeCache.h"
#include "src/gpu/SkGr.h"
+#include "src/gpu/effects/GrMatrixEffect.h"
#include "src/gpu/effects/GrSkSLFP.h"
#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/geometry/GrStyledShape.h"
diff --git a/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp b/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp
index 0d11c989f..fc0d856 100644
--- a/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapImageFilter.cpp
@@ -282,10 +282,10 @@
#if SK_SUPPORT_GPU
if (ctx.gpuBacked()) {
- auto context = ctx.getContext();
+ auto rContext = ctx.getContext();
- GrSurfaceProxyView colorView = color->view(context);
- GrSurfaceProxyView displView = displ->view(context);
+ GrSurfaceProxyView colorView = color->view(rContext);
+ GrSurfaceProxyView displView = displ->view(rContext);
if (!colorView.proxy() || !displView.proxy()) {
return nullptr;
}
@@ -303,7 +303,7 @@
offsetMatrix,
std::move(colorView),
color->subset(),
- *context->priv().caps());
+ *rContext->priv().caps());
fp = GrColorSpaceXformEffect::Make(std::move(fp),
color->getColorSpace(), color->alphaType(),
ctx.colorSpace(), kPremul_SkAlphaType);
@@ -311,12 +311,12 @@
kPremul_SkAlphaType,
ctx.refColorSpace(),
bounds.size());
- auto sfc = context->priv().makeSFC(info,
- SkBackingFit::kApprox,
- 1,
- GrMipmapped::kNo,
- isProtected,
- kBottomLeft_GrSurfaceOrigin);
+ auto sfc = rContext->priv().makeSFC(info,
+ SkBackingFit::kApprox,
+ 1,
+ GrMipmapped::kNo,
+ isProtected,
+ kBottomLeft_GrSurfaceOrigin);
if (!sfc) {
return nullptr;
}
@@ -327,7 +327,7 @@
offset->fX = bounds.left();
offset->fY = bounds.top();
- return SkSpecialImage::MakeDeferredFromGpu(context,
+ return SkSpecialImage::MakeDeferredFromGpu(rContext,
SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
sfc->readSurfaceView(),
diff --git a/src/gpu/BaseDevice.h b/src/gpu/BaseDevice.h
index ce99343..fe88870 100644
--- a/src/gpu/BaseDevice.h
+++ b/src/gpu/BaseDevice.h
@@ -13,16 +13,15 @@
#include "src/core/SkDevice.h"
class GrRenderTargetProxy;
-namespace skgpu {
- class SurfaceFillContext;
-#if SK_GPU_V1
- namespace v1 { class SurfaceDrawContext; }
-#endif // SK_GPU_V1
-}
class GrSurfaceProxyView;
namespace skgpu {
+class SurfaceFillContext;
+#if SK_GPU_V1
+namespace v1 { class SurfaceDrawContext; }
+#endif // SK_GPU_V1
+
class BaseDevice : public SkBaseDevice {
public:
enum InitContents {
@@ -37,10 +36,10 @@
BaseDevice* asGpuDevice() override { return this; }
#if SK_GPU_V1
- virtual skgpu::v1::SurfaceDrawContext* surfaceDrawContext() { return nullptr; }
+ virtual v1::SurfaceDrawContext* surfaceDrawContext() { return nullptr; }
#endif
- virtual skgpu::SurfaceFillContext* surfaceFillContext() = 0;
+ virtual SurfaceFillContext* surfaceFillContext() = 0;
GrRenderTargetProxy* targetProxy();
GrRecordingContext* recordingContext() const { return fContext.get(); }
diff --git a/src/gpu/GrBlurUtils.h b/src/gpu/GrBlurUtils.h
index aae1b42..f0e7c86 100644
--- a/src/gpu/GrBlurUtils.h
+++ b/src/gpu/GrBlurUtils.h
@@ -14,7 +14,6 @@
class GrPaint;
class GrRecordingContext;
class GrRenderTarget;
-namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
class GrStyledShape;
class GrStyle;
struct SkIRect;
@@ -24,7 +23,7 @@
class SkPaint;
class SkPath;
class SkPathEffect;
-
+namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
/**
* Blur utilities.
diff --git a/src/gpu/GrRecordingContextPriv.cpp b/src/gpu/GrRecordingContextPriv.cpp
index 1a3e3fb..2237e67 100644
--- a/src/gpu/GrRecordingContextPriv.cpp
+++ b/src/gpu/GrRecordingContextPriv.cpp
@@ -16,10 +16,12 @@
#if SK_GPU_V1
#include "src/gpu/v1/Device_v1.h"
#include "src/gpu/v1/SurfaceDrawContext_v1.h"
+#include "src/gpu/v1/SurfaceFillContext_v1.h"
#endif
#if SK_GPU_V2
-#include "src/gpu/SurfaceFillContext.h"
#include "src/gpu/v2/Device_v2.h"
+#include "src/gpu/v2/SurfaceDrawContext_v2.h"
+#include "src/gpu/v2/SurfaceFillContext_v2.h"
#endif
void GrRecordingContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index ec47bc3..3e0a79f 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -175,11 +175,11 @@
dstRect, invert);
}
-static GrSurfaceProxyView make_deferred_mask_texture_view(GrRecordingContext* context,
+static GrSurfaceProxyView make_deferred_mask_texture_view(GrRecordingContext* rContext,
SkBackingFit fit,
SkISize dimensions) {
- GrProxyProvider* proxyProvider = context->priv().proxyProvider();
- const GrCaps* caps = context->priv().caps();
+ GrProxyProvider* proxyProvider = rContext->priv().proxyProvider();
+ const GrCaps* caps = rContext->priv().caps();
const GrBackendFormat format = caps->getDefaultBackendFormat(GrColorType::kAlpha_8,
GrRenderable::kNo);
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index b4c5230..af8d63a 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -180,11 +180,11 @@
std::unique_ptr<PathGlyph[], GrSubRunAllocator::ArrayDestroyer> pathData);
#if SK_GPU_V1
- void draw(const GrClip* clip,
+ void draw(const GrClip*,
const SkMatrixProvider& viewMatrix,
- const SkGlyphRunList& glyphRunList,
- const SkPaint& paint,
- skgpu::v1::SurfaceDrawContext* sdc) const override;
+ const SkGlyphRunList&,
+ const SkPaint&,
+ skgpu::v1::SurfaceDrawContext*) const override;
#endif
bool canReuse(const SkPaint& paint, const SkMatrix& drawMatrix) const override;
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index c4f4be8..e4b2491 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -38,6 +38,7 @@
class SkTextBlob;
class SkTextBlobRunIterator;
+namespace skgpu { namespace v1 { class SurfaceDrawContext; }}
// -- GrAtlasSubRun --------------------------------------------------------------------------------
// GrAtlasSubRun is the API that GrAtlasTextOp uses to generate vertex data for drawing.
diff --git a/src/gpu/v1/Device_drawTexture.cpp b/src/gpu/v1/Device_drawTexture.cpp
index f7e084e..3325b73 100644
--- a/src/gpu/v1/Device_drawTexture.cpp
+++ b/src/gpu/v1/Device_drawTexture.cpp
@@ -410,7 +410,7 @@
}
// Assumes srcRect and dstRect have already been optimized to fit the proxy.
-void draw_image(GrRecordingContext* context,
+void draw_image(GrRecordingContext* rContext,
skgpu::v1::SurfaceDrawContext* sdc,
const GrClip* clip,
const SkMatrixProvider& matrixProvider,
@@ -431,7 +431,7 @@
can_use_draw_texture(paint, sampling.useCubic, sampling.mipmap)) {
// We've done enough checks above to allow us to pass ClampNearest() and not check for
// scaling adjustments.
- auto [view, ct] = image.asView(context, GrMipmapped::kNo);
+ auto [view, ct] = image.asView(rContext, GrMipmapped::kNo);
if (!view) {
return;
}
@@ -501,7 +501,7 @@
const SkRect* subset = restrictToSubset ? &src : nullptr;
const SkRect* domain = coordsAllInsideSrcRect ? &src : nullptr;
SkTileMode tileModes[] = {tm, tm};
- std::unique_ptr<GrFragmentProcessor> fp = image.asFragmentProcessor(context,
+ std::unique_ptr<GrFragmentProcessor> fp = image.asFragmentProcessor(rContext,
sampling,
tileModes,
textureMatrix,
@@ -517,7 +517,7 @@
}
GrPaint grPaint;
- if (!SkPaintToGrPaintWithTexture(context,
+ if (!SkPaintToGrPaintWithTexture(rContext,
sdc->colorInfo(),
paint,
matrixProvider,
@@ -558,7 +558,7 @@
}
GrBlurUtils::drawShapeWithMaskFilter(
- context, sdc, clip, shape, std::move(grPaint), ctm, mf);
+ rContext, sdc, clip, shape, std::move(grPaint), ctm, mf);
}
}
diff --git a/src/gpu/v1/SurfaceDrawContext.cpp b/src/gpu/v1/SurfaceDrawContext.cpp
index 20f8d7c..47e8d40 100644
--- a/src/gpu/v1/SurfaceDrawContext.cpp
+++ b/src/gpu/v1/SurfaceDrawContext.cpp
@@ -1509,7 +1509,7 @@
}
void SurfaceDrawContext::drawDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable,
- const SkRect& bounds) {
+ const SkRect& bounds) {
GrOp::Owner op(GrDrawableOp::Make(fContext, std::move(drawable), bounds));
SkASSERT(op);
this->addOp(std::move(op));
@@ -1922,7 +1922,7 @@
aaType,
this->colorInfo().isLinearlyBlended()};
pr->drawPath(args);
-#endif
+#endif // SK_GPU_V1
}
void SurfaceDrawContext::addDrawOp(const GrClip* clip,
diff --git a/src/gpu/v1/SurfaceFillContext_v1.h b/src/gpu/v1/SurfaceFillContext_v1.h
index 8961584..eb7a1b3 100644
--- a/src/gpu/v1/SurfaceFillContext_v1.h
+++ b/src/gpu/v1/SurfaceFillContext_v1.h
@@ -14,7 +14,6 @@
#include "src/gpu/GrOpsTask.h"
#include "src/gpu/GrSwizzle.h"
#include "src/gpu/SurfaceFillContext.h"
-#include "src/gpu/effects/GrMatrixEffect.h"
#include <array>
#include <tuple>
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index bed740a..60183b8 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -327,14 +327,15 @@
kPremul_SkAlphaType,
/*color space*/ nullptr,
this->dimensions());
- auto surfaceFillContext = ctx->priv().makeSFC(info,
- SkBackingFit::kExact,
- 1,
- GrMipmapped::kNo,
- GrProtected::kNo,
- kTopLeft_GrSurfaceOrigin,
- budgeted);
- if (!surfaceFillContext) {
+
+ auto sfc = ctx->priv().makeSFC(info,
+ SkBackingFit::kExact,
+ 1,
+ GrMipmapped::kNo,
+ GrProtected::kNo,
+ kTopLeft_GrSurfaceOrigin,
+ budgeted);
+ if (!sfc) {
return {};
}
@@ -362,9 +363,9 @@
fp = GrColorSpaceXformEffect::Make(std::move(fp),
srcColorSpace, kOpaque_SkAlphaType,
dstColorSpace, kOpaque_SkAlphaType);
- surfaceFillContext->fillWithFP(std::move(fp));
+ sfc->fillWithFP(std::move(fp));
- return surfaceFillContext->readSurfaceView();
+ return sfc->readSurfaceView();
}
sk_sp<SkCachedData> SkImage_Lazy::getPlanes(
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 5664a2c..59b0418 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -60,11 +60,11 @@
continue;
}
- auto sContext = dContext->priv().makeSC(std::move(fpView), info.colorInfo());
- REPORTER_ASSERT(reporter, sContext);
+ auto sc = dContext->priv().makeSC(std::move(fpView), info.colorInfo());
+ REPORTER_ASSERT(reporter, sc);
GrPixmap readPixmap(info, readBuffer.begin(), info.minRowBytes());
- bool result = sContext->readPixels(dContext, readPixmap, {0, 0});
+ bool result = sc->readPixels(dContext, readPixmap, {0, 0});
REPORTER_ASSERT(reporter, result);
REPORTER_ASSERT(reporter,
!memcmp(readBuffer.begin(), controlPixelData.begin(), readBuffer.bytes()));
diff --git a/tests/ReadWritePixelsGpuTest.cpp b/tests/ReadWritePixelsGpuTest.cpp
index 20d417e..9264c9c 100644
--- a/tests/ReadWritePixelsGpuTest.cpp
+++ b/tests/ReadWritePixelsGpuTest.cpp
@@ -502,12 +502,12 @@
for (GrSurfaceOrigin origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
auto factory = std::function<GpuSrcFactory<Surface>>(
[direct, origin, renderable](const SkPixmap& src) {
- auto surfContext = skgpu::SurfaceContext::Make(
+ auto sc = skgpu::SurfaceContext::Make(
direct, src.info(), SkBackingFit::kExact, origin, renderable);
- if (surfContext) {
- surfContext->writePixels(direct, src, {0, 0});
+ if (sc) {
+ sc->writePixels(direct, src, {0, 0});
}
- return surfContext;
+ return sc;
});
auto label = SkStringPrintf("Renderable: %d, Origin: %d", (int)renderable, origin);
gpu_read_pixels_test_driver(reporter, rules, factory, reader, label);
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index c07dd9e..bd106e2 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -121,7 +121,7 @@
void read_and_check_pixels(skiatest::Reporter* reporter,
GrDirectContext* dContext,
- skgpu::SurfaceContext* sContext,
+ skgpu::SurfaceContext* sc,
uint32_t* origData,
const SkImageInfo& dstInfo, CheckFn checker, float error,
const char* subtestName) {
@@ -129,7 +129,7 @@
GrPixmap readPM = GrPixmap::Allocate(dstInfo);
memset(readPM.addr(), 0, sizeof(uint32_t)*w*h);
- if (!sContext->readPixels(dContext, readPM, {0, 0})) {
+ if (!sc->readPixels(dContext, readPM, {0, 0})) {
ERRORF(reporter, "Could not read pixels for %s.", subtestName);
return;
}
@@ -195,7 +195,8 @@
encoding_as_color_space(contextEncoding),
kW, kH);
- auto sc = skgpu::SurfaceContext::Make(rContext, info,
+ auto sc = skgpu::SurfaceContext::Make(rContext,
+ info,
SkBackingFit::kExact,
kBottomLeft_GrSurfaceOrigin,
GrRenderable::kYes);
diff --git a/tests/TestUtils.h b/tests/TestUtils.h
index 104885c..91b058e 100644
--- a/tests/TestUtils.h
+++ b/tests/TestUtils.h
@@ -17,12 +17,12 @@
typedef uint32_t GrColor;
// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues
-void TestReadPixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext* srcContext,
+void TestReadPixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext*,
uint32_t expectedPixelValues[], const char* testName);
// See if trying to write RGBA 8888 pixels to 'dstContext' matches matches the
// expectation ('expectedToWork')
-void TestWritePixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext* srcContext,
+void TestWritePixels(skiatest::Reporter*, GrDirectContext*, skgpu::SurfaceContext*,
bool expectedToWork, const char* testName);
// Ensure that the pixels can be copied from 'proxy' viewed as colorType, to an RGBA 8888
diff --git a/tests/WrappedSurfaceCopyOnWriteTest.cpp b/tests/WrappedSurfaceCopyOnWriteTest.cpp
index 91ec489..7478872 100644
--- a/tests/WrappedSurfaceCopyOnWriteTest.cpp
+++ b/tests/WrappedSurfaceCopyOnWriteTest.cpp
@@ -20,10 +20,6 @@
#include "tools/gpu/BackendSurfaceFactory.h"
#include "tools/gpu/ProxyUtils.h"
-#if SK_GPU_V1
-#include "src/gpu/v1/SurfaceDrawContext_v1.h"
-#endif
-
DEF_GPUTEST_FOR_ALL_CONTEXTS(WrappedSurfaceCopyOnWrite, reporter, ctxInfo) {
GrDirectContext* dContext = ctxInfo.directContext();
@@ -91,13 +87,15 @@
/*color space*/ nullptr,
10, 10);
- auto dstSC = skgpu::SurfaceContext::Make(dContext, info,
+ auto dstSC = skgpu::SurfaceContext::Make(dContext,
+ info,
SkBackingFit::kExact,
kBottomLeft_GrSurfaceOrigin,
GrRenderable::kYes);
dstSC->asFillContext()->clear(SkPMColor4f{1, 0, 0, 1});
- auto srcSC = skgpu::SurfaceContext::Make(dContext, info,
+ auto srcSC = skgpu::SurfaceContext::Make(dContext,
+ info,
SkBackingFit::kExact,
kBottomLeft_GrSurfaceOrigin,
GrRenderable::kYes);
@@ -130,32 +128,23 @@
}
#if SK_GPU_V1
-#include "src/gpu/v1/SurfaceDrawContext_v1.h"
// Make sure GrOpsTask are skippable
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkipOpsTaskTest, reporter, ctxInfo) {
GrDirectContext* dContext = ctxInfo.directContext();
- auto dst = skgpu::v1::SurfaceDrawContext::Make(dContext,
- GrColorType::kRGBA_8888,
- /*color space*/ nullptr,
- SkBackingFit::kExact,
- {10, 10},
- SkSurfaceProps());
+ GrImageInfo ii(GrColorType::kRGBA_8888, kPremul_SkAlphaType, /*color space*/ nullptr, 10, 10);
+
+ auto dst = dContext->priv().makeSFC(ii, SkBackingFit::kExact);
dst->clear(SkPMColor4f{1, 0, 0, 1});
dContext->flush();
dst->clear(SkPMColor4f{0, 0, 1, 1});
- sk_sp<GrRenderTask> task = sk_ref_sp(dst->getOpsTask());
+ sk_sp<GrRenderTask> task = dst->refRenderTask();
// GrDrawingManager maintains an "active ops task" and doesn't like having it closed behind
// its back. temp exists just to replace dst's ops task as the active one.
- auto temp = skgpu::v1::SurfaceDrawContext::Make(dContext,
- GrColorType::kRGBA_8888,
- /*color space*/ nullptr,
- SkBackingFit::kExact,
- {10, 10},
- SkSurfaceProps());
+ auto temp = dContext->priv().makeSFC(ii, SkBackingFit::kExact);
temp->clear(SkPMColor4f{0, 0, 0, 0});
GrSurfaceProxyView readView = dst->readSurfaceView();