Revert "Move makeDeferredRenderTargetContext calls to factory on RTC."
This reverts commit 1c16b430333c6384a8835d4e3671d2fb056ab45b.
Reason for revert: Red on tree
Original change's description:
> Move makeDeferredRenderTargetContext calls to factory on RTC.
>
> Change-Id: Iaa8f5829d9f8650ff27a60f75fb2216f016ab85e
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262058
> Commit-Queue: Greg Daniel <egdaniel@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I9e3c9d13c66b5437c87ad7136d283fa4ac81df1f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263019
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/bench/VertexColorSpaceBench.cpp b/bench/VertexColorSpaceBench.cpp
index 6c2001d..db2dfa4 100644
--- a/bench/VertexColorSpaceBench.cpp
+++ b/bench/VertexColorSpaceBench.cpp
@@ -282,8 +282,8 @@
const int kDrawsPerLoop = 32;
for (int i = 0; i < loops; ++i) {
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, p3, SkBackingFit::kApprox, {100, 100});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, 100, 100, GrColorType::kRGBA_8888, p3);
SkASSERT(rtc);
for (int j = 0; j < kDrawsPerLoop; ++j) {
diff --git a/gm/clockwise.cpp b/gm/clockwise.cpp
index b8f6f68..c52cc3a 100644
--- a/gm/clockwise.cpp
+++ b/gm/clockwise.cpp
@@ -245,10 +245,9 @@
// Draw the test to an off-screen, top-down render target.
GrColorType rtcColorType = rtc->colorInfo().colorType();
- if (auto topLeftRTC = GrRenderTargetContext::Make(
- ctx, rtcColorType, nullptr, SkBackingFit::kExact, {100, 200}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin, SkBudgeted::kYes,
- nullptr)) {
+ if (auto topLeftRTC = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, 100, 200, rtcColorType, nullptr, 1,
+ GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin, nullptr, SkBudgeted::kYes)) {
topLeftRTC->clear(nullptr, SK_PMColor4fTRANSPARENT,
GrRenderTargetContext::CanClearFullscreen::kYes);
topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
@@ -262,10 +261,9 @@
}
// Draw the test to an off-screen, bottom-up render target.
- if (auto topLeftRTC = GrRenderTargetContext::Make(
- ctx, rtcColorType, nullptr, SkBackingFit::kExact, {100, 200}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin, SkBudgeted::kYes,
- nullptr)) {
+ if (auto topLeftRTC = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, 100, 200, rtcColorType, nullptr, 1,
+ GrMipMapped::kNo, kBottomLeft_GrSurfaceOrigin, nullptr, SkBudgeted::kYes)) {
topLeftRTC->clear(nullptr, SK_PMColor4fTRANSPARENT,
GrRenderTargetContext::CanClearFullscreen::kYes);
topLeftRTC->priv().testingOnly_addDrawOp(ClockwiseTestOp::Make(ctx, false, 0));
diff --git a/gm/samplelocations.cpp b/gm/samplelocations.cpp
index 282e13f..e1b1a12 100644
--- a/gm/samplelocations.cpp
+++ b/gm/samplelocations.cpp
@@ -320,9 +320,9 @@
return DrawResult::kSkip;
}
- auto offscreenRTC = GrRenderTargetContext::Make(
- ctx, rtc->colorInfo().colorType(), nullptr, SkBackingFit::kExact, {200, 200},
- rtc->numSamples(), GrMipMapped::kNo, GrProtected::kNo, fOrigin);
+ auto offscreenRTC = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, 200, 200, rtc->colorInfo().colorType(), nullptr,
+ rtc->numSamples(), GrMipMapped::kNo, fOrigin);
if (!offscreenRTC) {
*errorMsg = "Failed to create offscreen render target.";
return DrawResult::kFail;
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index 5720efe..f1528f5 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -226,9 +226,9 @@
const GrReducedClip& reducedClip, GrPaint&& paint) {
const int padRight = (kDeviceRect.right() - kCoverRect.right()) / 2;
const int padBottom = (kDeviceRect.bottom() - kCoverRect.bottom()) / 2;
- auto maskRTC = GrRenderTargetContext::MakeWithFallback(
- ctx, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact,
- {kCoverRect.width() + padRight, kCoverRect.height() + padBottom});
+ auto maskRTC(ctx->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, kCoverRect.width() + padRight, kCoverRect.height() + padBottom,
+ GrColorType::kAlpha_8, nullptr));
if (!maskRTC) {
return;
}
diff --git a/include/private/GrRecordingContext.h b/include/private/GrRecordingContext.h
index cd0f80d..7d732f1 100644
--- a/include/private/GrRecordingContext.h
+++ b/include/private/GrRecordingContext.h
@@ -114,6 +114,43 @@
*/
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
+ /*
+ * Create a new render target context backed by a deferred-style
+ * GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for
+ * renderTargetContexts created via this entry point.
+ */
+ std::unique_ptr<GrRenderTargetContext> makeDeferredRenderTargetContext(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted = SkBudgeted::kYes,
+ GrProtected isProtected = GrProtected::kNo);
+
+ /*
+ * 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.
+ */
+ std::unique_ptr<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted budgeted = SkBudgeted::kYes,
+ GrProtected isProtected = GrProtected::kNo);
+
GrAuditTrail* auditTrail() { return fAuditTrail.get(); }
GrRecordingContext* asRecordingContext() override { return this; }
diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp
index 213345e..b6e270d 100644
--- a/samplecode/SampleCCPRGeometry.cpp
+++ b/samplecode/SampleCCPRGeometry.cpp
@@ -183,10 +183,9 @@
GrOpMemoryPool* pool = ctx->priv().opMemoryPool();
- int width = this->width();
- int height = this->height();
- auto ccbuff = GrRenderTargetContext::Make(
- ctx, GrColorType::kAlpha_F16, nullptr, SkBackingFit::kApprox, {width, height});
+ auto ccbuff = ctx->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox,
+ this->width(), this->height(),
+ GrColorType::kAlpha_F16, nullptr);
SkASSERT(ccbuff);
ccbuff->clear(nullptr, SK_PMColor4fTRANSPARENT,
GrRenderTargetContext::CanClearFullscreen::kYes);
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index b4d265b..e78c2e4 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -107,9 +107,19 @@
int finalH,
sk_sp<SkColorSpace> finalCS,
SkBackingFit dstFit) {
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, srcColorType, std::move(finalCS), dstFit, {finalW, finalH}, 1,
- GrMipMapped::kNo, srcProxy->isProtected(), srcProxy->origin());
+
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ dstFit,
+ finalW,
+ finalH,
+ srcColorType,
+ std::move(finalCS),
+ 1,
+ GrMipMapped::kNo,
+ srcProxy->origin(),
+ nullptr,
+ SkBudgeted::kYes,
+ srcProxy->isProtected());
if (!renderTargetContext) {
return nullptr;
}
@@ -157,9 +167,18 @@
SkBackingFit fit) {
SkASSERT(srcRect.width() <= finalW && srcRect.height() <= finalH);
- auto dstRenderTargetContext = GrRenderTargetContext::Make(
- context, srcColorType, std::move(finalCS), fit, srcRect.size(), 1,
- GrMipMapped::kNo, srcProxy->isProtected(), srcProxy->origin());
+ auto dstRenderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ fit,
+ srcRect.width(),
+ srcRect.height(),
+ srcColorType,
+ std::move(finalCS),
+ 1,
+ GrMipMapped::kNo,
+ srcProxy->origin(),
+ nullptr,
+ SkBudgeted::kYes,
+ srcProxy->isProtected());
if (!dstRenderTargetContext) {
return nullptr;
}
@@ -283,10 +302,19 @@
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
shrink_irect_by_2(&dstRect, i < scaleFactorX, i < scaleFactorY);
- dstRenderTargetContext = GrRenderTargetContext::Make(
- context, srcColorType, finalCS, SkBackingFit::kApprox,
- {dstRect.fRight, dstRect.fBottom}, 1, GrMipMapped::kNo, srcProxy->isProtected(),
- srcProxy->origin());
+ // We know this will not be the final draw so we are free to make it an approx match.
+ dstRenderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox,
+ dstRect.fRight,
+ dstRect.fBottom,
+ srcColorType,
+ finalCS,
+ 1,
+ GrMipMapped::kNo,
+ srcProxy->origin(),
+ nullptr,
+ SkBudgeted::kYes,
+ srcProxy->isProtected());
if (!dstRenderTargetContext) {
return nullptr;
}
@@ -364,9 +392,9 @@
srcRenderTargetContext = nullptr; // no longer needed
- auto dstRenderTargetContext = GrRenderTargetContext::Make(
- context, srcColorType, std::move(finalCS), fit, {finalW, finalH}, 1,
- GrMipMapped::kNo, srcProxy->isProtected(), srcProxy->origin());
+ auto dstRenderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ fit, finalW, finalH, srcColorType, std::move(finalCS), 1, GrMipMapped::kNo,
+ srcProxy->origin());
if (!dstRenderTargetContext) {
return nullptr;
}
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index ff6c6df..1075664 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -575,10 +575,18 @@
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, SkColorTypeToGrColorType(colorType), sk_ref_sp(colorSpace),
- SkBackingFit::kApprox, bounds.size(), 1, GrMipMapped::kNo, isProtected,
- kBottomLeft_GrSurfaceOrigin);
+ auto renderTargetContext =
+ context->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox,
+ bounds.width(),
+ bounds.height(),
+ SkColorTypeToGrColorType(colorType),
+ sk_ref_sp(colorSpace),
+ 1,
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ isProtected);
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 41511c0..6deca8c 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -169,10 +169,9 @@
if (!context) {
return nullptr;
}
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, colorType, std::move(colorSpace), SkBackingFit::kApprox, {width, height}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kBottomLeft_GrSurfaceOrigin, SkBudgeted::kYes,
- props);
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, width, height, colorType, std::move(colorSpace), 1,
+ GrMipMapped::kNo, kBottomLeft_GrSurfaceOrigin, props);
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
index 3dade7f..1367fba 100644
--- a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
+++ b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
@@ -103,8 +103,8 @@
sk_sp<GrTextureProxy> SkAlphaThresholdFilterImpl::createMaskTexture(GrRecordingContext* context,
const SkMatrix& inMatrix,
const SkIRect& bounds) const {
- auto rtContext = GrRenderTargetContext::MakeWithFallback(
- context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kApprox, bounds.size());
+ auto rtContext = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(), GrColorType::kAlpha_8, nullptr);
if (!rtContext) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 8a08602..8b5e2d2 100644
--- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -403,9 +403,18 @@
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, ctx.grColorType(), ctx.refColorSpace(), SkBackingFit::kApprox, bounds.size(),
- 1, GrMipMapped::kNo, isProtected, kBottomLeft_GrSurfaceOrigin);
+ auto renderTargetContext =
+ context->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox,
+ bounds.width(),
+ bounds.height(),
+ ctx.grColorType(),
+ ctx.refColorSpace(),
+ 1,
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ isProtected);
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index 656a76c..e647821 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -363,9 +363,18 @@
SkMatrix matrix;
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, ctx.grColorType(), ctx.refColorSpace(), SkBackingFit::kApprox,
- bounds.size(), 1, GrMipMapped::kNo, isProtected, kBottomLeft_GrSurfaceOrigin);
+ auto renderTargetContext =
+ context->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox,
+ bounds.width(),
+ bounds.height(),
+ ctx.grColorType(),
+ ctx.refColorSpace(),
+ 1,
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ isProtected);
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkLightingImageFilter.cpp b/src/effects/imagefilters/SkLightingImageFilter.cpp
index b0a47cb..82199bd 100644
--- a/src/effects/imagefilters/SkLightingImageFilter.cpp
+++ b/src/effects/imagefilters/SkLightingImageFilter.cpp
@@ -488,10 +488,18 @@
sk_sp<GrTextureProxy> inputProxy(input->asTextureProxyRef(context));
SkASSERT(inputProxy);
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, ctx.grColorType(), ctx.refColorSpace(), SkBackingFit::kApprox,
- offsetBounds.size(), 1, GrMipMapped::kNo, inputProxy->isProtected(),
- kBottomLeft_GrSurfaceOrigin);
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox,
+ offsetBounds.width(),
+ offsetBounds.height(),
+ ctx.grColorType(),
+ ctx.refColorSpace(),
+ 1,
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ inputProxy->isProtected());
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index 2e8742e..182d73a 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -567,9 +567,18 @@
SkASSERT(radius.width() > 0 || radius.height() > 0);
if (radius.fWidth > 0) {
- auto dstRTContext = GrRenderTargetContext::Make(
- context, colorType, colorSpace, SkBackingFit::kApprox, rect.size(), 1,
- GrMipMapped::kNo, srcTexture->isProtected(), kBottomLeft_GrSurfaceOrigin);
+ auto dstRTContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox,
+ rect.width(),
+ rect.height(),
+ colorType,
+ colorSpace,
+ 1,
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ srcTexture->isProtected());
if (!dstRTContext) {
return nullptr;
}
@@ -587,9 +596,18 @@
srcRect = dstRect;
}
if (radius.fHeight > 0) {
- auto dstRTContext = GrRenderTargetContext::Make(
- context, colorType, colorSpace, SkBackingFit::kApprox, rect.size(), 1,
- GrMipMapped::kNo, srcTexture->isProtected(), kBottomLeft_GrSurfaceOrigin);
+ auto dstRTContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox,
+ rect.width(),
+ rect.height(),
+ colorType,
+ colorSpace,
+ 1,
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ srcTexture->isProtected());
if (!dstRTContext) {
return nullptr;
}
diff --git a/src/effects/imagefilters/SkXfermodeImageFilter.cpp b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
index 8924456..c36d226 100644
--- a/src/effects/imagefilters/SkXfermodeImageFilter.cpp
+++ b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
@@ -310,8 +310,9 @@
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, ctx.grColorType(), ctx.refColorSpace(), SkBackingFit::kApprox, bounds.size());
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, bounds.width(), bounds.height(), ctx.grColorType(),
+ ctx.refColorSpace());
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index b2a7f65..f7fae02 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -185,9 +185,9 @@
// the same. We should offset our filter within the render target and expand the size as needed
// to guarantee at least 1px of padding on all sides.
auto approxSize = GrResourceProvider::MakeApprox(maskRect.size());
- auto rtContext = GrRenderTargetContext::MakeWithFallback(
- context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, approxSize, sampleCnt,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto rtContext = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, approxSize.width(), approxSize.height(), GrColorType::kAlpha_8,
+ nullptr, sampleCnt, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
if (!rtContext) {
return nullptr;
}
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 40a9931..5d2b7de 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -354,10 +354,18 @@
return proxy;
}
- auto rtc = GrRenderTargetContext::MakeWithFallback(
- context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kApprox,
- {reducedClip.width(), reducedClip.height()}, 1, GrMipMapped::kNo, proxy->isProtected(),
- kTopLeft_GrSurfaceOrigin);
+ auto isProtected = proxy->isProtected();
+ auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(SkBackingFit::kApprox,
+ reducedClip.width(),
+ reducedClip.height(),
+ GrColorType::kAlpha_8,
+ nullptr,
+ 1,
+ GrMipMapped::kNo,
+ kTopLeft_GrSurfaceOrigin,
+ nullptr,
+ SkBudgeted::kYes,
+ isProtected);
if (!rtc) {
return nullptr;
}
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index 0efe6ea..a0f5d49 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -40,6 +40,33 @@
fContext->addOnFlushCallbackObject(onFlushCBObject);
}
+std::unique_ptr<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrMipMapped mipMapped,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted,
+ GrProtected isProtected) {
+ return fContext->makeDeferredRenderTargetContext(fit, width, height, colorType,
+ std::move(colorSpace), sampleCnt, mipMapped,
+ origin, surfaceProps, budgeted, isProtected);
+}
+
+std::unique_ptr<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit fit, int width, int height, GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace, int sampleCnt, GrMipMapped mipMapped,
+ GrSurfaceOrigin origin, const SkSurfaceProps* surfaceProps, SkBudgeted budgeted,
+ GrProtected isProtected) {
+ return fContext->makeDeferredRenderTargetContextWithFallback(
+ fit, width, height, colorType, std::move(colorSpace), sampleCnt, mipMapped, origin,
+ surfaceProps, budgeted, isProtected);
+}
+
std::unique_ptr<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContext(
const GrBackendTexture& tex,
GrSurfaceOrigin origin,
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 03cab66..95dfcfb 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -69,6 +69,43 @@
*/
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
+ /*
+ * Create a new render target context backed by a deferred-style
+ * GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for
+ * renderTargetContexts created via this entry point.
+ */
+ std::unique_ptr<GrRenderTargetContext> makeDeferredRenderTargetContext(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted = SkBudgeted::kYes,
+ GrProtected isProtected = GrProtected::kNo);
+
+ /*
+ * 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.
+ */
+ std::unique_ptr<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted budgeted = SkBudgeted::kYes,
+ GrProtected isProtected = GrProtected::kNo);
+
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
/**
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 02359c3..ecc16e6 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -167,6 +167,101 @@
this->drawingManager()->addOnFlushCallbackObject(onFlushCBObject);
}
+std::unique_ptr<GrRenderTargetContext> GrRecordingContext::makeDeferredRenderTargetContext(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrMipMapped mipMapped,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted,
+ GrProtected isProtected) {
+ SkASSERT(sampleCnt > 0);
+ if (this->abandoned()) {
+ return nullptr;
+ }
+
+ auto format = this->caps()->getDefaultBackendFormat(colorType, GrRenderable::kYes);
+ if (!format.isValid()) {
+ return nullptr;
+ }
+ auto config = this->caps()->getConfigFromBackendFormat(format, colorType);
+ if (config == kUnknown_GrPixelConfig) {
+ return nullptr;
+ }
+
+ GrSurfaceDesc desc;
+ desc.fWidth = width;
+ desc.fHeight = height;
+ desc.fConfig = config;
+
+ sk_sp<GrTextureProxy> rtp =
+ this->proxyProvider()->createProxy(format, desc, GrRenderable::kYes, sampleCnt, origin,
+ mipMapped, fit, budgeted, isProtected);
+ if (!rtp) {
+ return nullptr;
+ }
+
+ auto drawingManager = this->drawingManager();
+
+ auto renderTargetContext = drawingManager->makeRenderTargetContext(
+ std::move(rtp), colorType, std::move(colorSpace), surfaceProps);
+ if (!renderTargetContext) {
+ return nullptr;
+ }
+
+ renderTargetContext->discard();
+
+ return renderTargetContext;
+}
+
+static inline GrColorType color_type_fallback(GrColorType ct) {
+ switch (ct) {
+ // kRGBA_8888 is our default fallback for many color types that may not have renderable
+ // backend formats.
+ case GrColorType::kAlpha_8:
+ case GrColorType::kBGR_565:
+ case GrColorType::kABGR_4444:
+ case GrColorType::kBGRA_8888:
+ case GrColorType::kRGBA_1010102:
+ case GrColorType::kRGBA_F16:
+ case GrColorType::kRGBA_F16_Clamped:
+ return GrColorType::kRGBA_8888;
+ case GrColorType::kAlpha_F16:
+ return GrColorType::kRGBA_F16;
+ case GrColorType::kGray_8:
+ return GrColorType::kRGB_888x;
+ default:
+ return GrColorType::kUnknown;
+ }
+}
+
+std::unique_ptr<GrRenderTargetContext>
+GrRecordingContext::makeDeferredRenderTargetContextWithFallback(SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrMipMapped mipMapped,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted,
+ GrProtected isProtected) {
+ SkASSERT(sampleCnt > 0);
+ std::unique_ptr<GrRenderTargetContext> rtc;
+ do {
+ rtc = this->makeDeferredRenderTargetContext(fit, width, height, colorType, colorSpace,
+ sampleCnt, mipMapped, origin, surfaceProps,
+ budgeted, isProtected);
+ colorType = color_type_fallback(colorType);
+ } while (!rtc && colorType != GrColorType::kUnknown);
+ return rtc;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<const GrCaps> GrRecordingContextPriv::refCaps() const {
return fContext->refCaps();
@@ -176,6 +271,49 @@
fContext->addOnFlushCallbackObject(onFlushCBObject);
}
+std::unique_ptr<GrRenderTargetContext> GrRecordingContextPriv::makeDeferredRenderTargetContext(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrMipMapped mipMapped,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted,
+ GrProtected isProtected) {
+ return fContext->makeDeferredRenderTargetContext(fit, width, height, colorType,
+ std::move(colorSpace), sampleCnt, mipMapped,
+ origin, surfaceProps, budgeted, isProtected);
+}
+
+std::unique_ptr<GrRenderTargetContext>
+GrRecordingContextPriv::makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType colorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt,
+ GrMipMapped mipMapped,
+ GrSurfaceOrigin origin,
+ const SkSurfaceProps* surfaceProps,
+ SkBudgeted budgeted,
+ GrProtected isProtected) {
+ return fContext->makeDeferredRenderTargetContextWithFallback(fit,
+ width,
+ height,
+ colorType,
+ std::move(colorSpace),
+ sampleCnt,
+ mipMapped,
+ origin,
+ surfaceProps,
+ budgeted,
+ isProtected);
+}
+
GrContext* GrRecordingContextPriv::backdoor() {
return (GrContext*) fContext;
}
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index 9b64ed0..6ec2468 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -66,6 +66,43 @@
*/
void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
+ /*
+ * Create a new render target context backed by a deferred-style
+ * GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for
+ * renderTargetContexts created via this entry point.
+ */
+ std::unique_ptr<GrRenderTargetContext> makeDeferredRenderTargetContext(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted = SkBudgeted::kYes,
+ GrProtected isProtected = GrProtected::kNo);
+
+ /*
+ * 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.
+ */
+ std::unique_ptr<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit fit,
+ int width,
+ int height,
+ GrColorType,
+ sk_sp<SkColorSpace> colorSpace,
+ int sampleCnt = 1,
+ GrMipMapped = GrMipMapped::kNo,
+ GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+ const SkSurfaceProps* surfaceProps = nullptr,
+ SkBudgeted budgeted = SkBudgeted::kYes,
+ GrProtected isProtected = GrProtected::kNo);
+
GrAuditTrail* auditTrail() { return fContext->auditTrail(); }
// CONTEXT TODO: remove this backdoor
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index fc6df9e..00fb78f 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -137,115 +137,6 @@
GrDrawingManager* fDrawingManager;
};
-std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
- GrRecordingContext* context,
- GrColorType colorType,
- sk_sp<SkColorSpace> colorSpace,
- SkBackingFit fit,
- const SkISize& dimensions,
- const GrBackendFormat& format,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- SkBudgeted budgeted,
- const SkSurfaceProps* surfaceProps) {
- auto config = context->priv().caps()->getConfigFromBackendFormat(format, colorType);
- if (config == kUnknown_GrPixelConfig) {
- return nullptr;
- }
- GrSurfaceDesc desc;
- desc.fWidth = dimensions.width();
- desc.fHeight = dimensions.height();
- desc.fConfig = config;
-
- GrSwizzle readSwizzle = context->priv().caps()->getReadSwizzle(format, colorType);
- GrSwizzle outSwizzle = context->priv().caps()->getOutputSwizzle(format, colorType);
-
- sk_sp<GrTextureProxy> proxy = context->priv().proxyProvider()->createProxy(
- format, desc, GrRenderable::kYes, sampleCnt, origin, mipMapped, fit, budgeted,
- isProtected);
- if (!proxy) {
- return nullptr;
- }
- GrRenderTargetProxy* rtp = proxy->asRenderTargetProxy();
- SkASSERT(rtp);
-
- auto rtc = std::make_unique<GrRenderTargetContext>(context, sk_ref_sp(rtp), colorType, origin,
- readSwizzle, outSwizzle,
- std::move(colorSpace), surfaceProps, true);
- if (!rtc) {
- return nullptr;
- }
- rtc->discard();
- return rtc;
-}
-
-std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::Make(
- GrRecordingContext* context,
- GrColorType colorType,
- sk_sp<SkColorSpace> colorSpace,
- SkBackingFit fit,
- const SkISize& dimensions,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- SkBudgeted budgeted,
- const SkSurfaceProps* surfaceProps) {
- auto format = context->priv().caps()->getDefaultBackendFormat(colorType, GrRenderable::kYes);
- if (!format.isValid()) {
- return nullptr;
- }
-
- return GrRenderTargetContext::Make(context, colorType, std::move(colorSpace), fit, dimensions,
- format, sampleCnt, mipMapped, isProtected, origin, budgeted,
- surfaceProps);
-}
-
-static inline GrColorType color_type_fallback(GrColorType ct) {
- switch (ct) {
- // kRGBA_8888 is our default fallback for many color types that may not have renderable
- // backend formats.
- case GrColorType::kAlpha_8:
- case GrColorType::kBGR_565:
- case GrColorType::kABGR_4444:
- case GrColorType::kBGRA_8888:
- case GrColorType::kRGBA_1010102:
- case GrColorType::kRGBA_F16:
- case GrColorType::kRGBA_F16_Clamped:
- return GrColorType::kRGBA_8888;
- case GrColorType::kAlpha_F16:
- return GrColorType::kRGBA_F16;
- case GrColorType::kGray_8:
- return GrColorType::kRGB_888x;
- default:
- return GrColorType::kUnknown;
- }
-}
-
-std::unique_ptr<GrRenderTargetContext> GrRenderTargetContext::MakeWithFallback(
- GrRecordingContext* context,
- GrColorType colorType,
- sk_sp<SkColorSpace> colorSpace,
- SkBackingFit fit,
- const SkISize& dimensions,
- int sampleCnt,
- GrMipMapped mipMapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- SkBudgeted budgeted,
- const SkSurfaceProps* surfaceProps) {
- std::unique_ptr<GrRenderTargetContext> rtc;
- do {
- rtc = GrRenderTargetContext::Make(context, colorType, colorSpace, fit, dimensions,
- sampleCnt, mipMapped, isProtected, origin, budgeted,
- surfaceProps);
- colorType = color_type_fallback(colorType);
- } while (!rtc && colorType != GrColorType::kUnknown);
- return rtc;
-}
-
// In MDB mode the reffing of the 'getLastOpsTask' call's result allows in-progress
// GrOpsTask to be picked up and added to by renderTargetContexts lower in the call
// stack. When this occurs with a closed GrOpsTask, a new one will be allocated
@@ -1655,9 +1546,9 @@
}
srcRectToDraw = SkRect::MakeWH(srcRect.width(), srcRect.height());
}
- tempRTC = GrRenderTargetContext::Make(
- direct, this->colorInfo().colorType(), info.refColorSpace(),
- SkBackingFit::kApprox, srcRect.size(), 1, GrMipMapped::kNo, GrProtected::kNo,
+ tempRTC = direct->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, srcRect.width(), srcRect.height(),
+ this->colorInfo().colorType(), info.refColorSpace(), 1, GrMipMapped::kNo,
kTopLeft_GrSurfaceOrigin);
if (!tempRTC) {
callback(context, nullptr);
@@ -1866,9 +1757,10 @@
return;
}
SkRect srcRectToDraw = SkRect::Make(srcRect);
- tempRTC = GrRenderTargetContext::Make(
- direct, this->colorInfo().colorType(), dstColorSpace, SkBackingFit::kApprox,
- dstSize, 1, GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ tempRTC = direct->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, dstSize.width(), dstSize.height(),
+ this->colorInfo().colorType(), dstColorSpace, 1, GrMipMapped::kNo,
+ kTopLeft_GrSurfaceOrigin);
if (!tempRTC) {
callback(context, nullptr);
return;
@@ -1889,17 +1781,17 @@
return;
}
- auto yRTC = GrRenderTargetContext::MakeWithFallback(
- direct, GrColorType::kAlpha_8, dstColorSpace, SkBackingFit::kApprox, dstSize, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto yRTC = direct->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, dstSize.width(), dstSize.height(), GrColorType::kAlpha_8,
+ dstColorSpace, 1, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
int halfW = dstSize.width()/2;
int halfH = dstSize.height()/2;
- auto uRTC = GrRenderTargetContext::MakeWithFallback(
- direct, GrColorType::kAlpha_8, dstColorSpace, SkBackingFit::kApprox, {halfW, halfH}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
- auto vRTC = GrRenderTargetContext::MakeWithFallback(
- direct, GrColorType::kAlpha_8, dstColorSpace, SkBackingFit::kApprox, {halfW, halfH}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto uRTC = direct->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, halfW, halfH, GrColorType::kAlpha_8, dstColorSpace, 1,
+ GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
+ auto vRTC = direct->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kApprox, halfW, halfH, GrColorType::kAlpha_8, dstColorSpace, 1,
+ GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
if (!yRTC || !uRTC || !vRTC) {
callback(context, nullptr);
return;
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index fa08494..58e2aae 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -57,28 +57,6 @@
*/
class GrRenderTargetContext : public GrSurfaceContext {
public:
- static std::unique_ptr<GrRenderTargetContext> Make(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
- const SkISize& dimensions, const GrBackendFormat&, int sampleCnt, GrMipMapped,
- GrProtected, GrSurfaceOrigin, SkBudgeted, const SkSurfaceProps*);
-
- // Same as above but will use the default GrBackendFormat for the given GrColorType
- static std::unique_ptr<GrRenderTargetContext> Make(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
- const SkISize& dimensions, int sampleCnt = 1, GrMipMapped = GrMipMapped::kNo,
- GrProtected = GrProtected::kNo, GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
- SkBudgeted = SkBudgeted::kYes, const SkSurfaceProps* = nullptr);
-
- // Same as previous factory but will try to use fallback GrColorTypes if the one passed in
- // fails. The fallback GrColorType will have at least the number of channels and precision per
- // channel as the passed in GrColorType. It may also swizzle the changes (e.g., BGRA -> RGBA).
- // SRGB-ness will be preserved.
- static std::unique_ptr<GrRenderTargetContext> MakeWithFallback(
- GrRecordingContext*, GrColorType, sk_sp<SkColorSpace>, SkBackingFit,
- const SkISize& dimensions, int sampleCnt = 1, GrMipMapped = GrMipMapped::kNo,
- GrProtected = GrProtected::kNo, GrSurfaceOrigin = kBottomLeft_GrSurfaceOrigin,
- SkBudgeted = SkBudgeted::kYes, const SkSurfaceProps* = nullptr);
-
GrRenderTargetContext(GrRecordingContext*, sk_sp<GrRenderTargetProxy>, GrColorType,
GrSurfaceOrigin, GrSwizzle readSwizzle, GrSwizzle outSwizzle,
sk_sp<SkColorSpace>, const SkSurfaceProps*, bool managedOpsTask = true);
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 2e31129..ca04239 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -56,18 +56,10 @@
}
std::unique_ptr<GrSurfaceContext> GrSurfaceContext::Make(
- GrRecordingContext* context,
- const SkISize& dimensions,
- const GrBackendFormat& format,
- GrRenderable renderable,
- int renderTargetSampleCnt,
- GrMipMapped mipMapped,
- GrProtected isProtected,
- GrSurfaceOrigin origin,
- GrColorType colorType,
- SkAlphaType alphaType,
- sk_sp<SkColorSpace> colorSpace,
- SkBackingFit fit,
+ GrRecordingContext* context, const SkISize& dimensions, const GrBackendFormat& format,
+ GrRenderable renderable, int renderTargetSampleCnt, GrMipMapped mipMapped,
+ GrProtected isProtected, GrSurfaceOrigin origin, GrColorType colorType,
+ SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace, SkBackingFit fit,
SkBudgeted budgeted) {
auto config = context->priv().caps()->getConfigFromBackendFormat(format, colorType);
if (config == kUnknown_GrPixelConfig) {
@@ -201,9 +193,9 @@
canvas2DFastPath ? GrColorType::kRGBA_8888 : this->colorInfo().colorType();
sk_sp<SkColorSpace> cs = canvas2DFastPath ? nullptr : this->colorInfo().refColorSpace();
- auto tempCtx = GrRenderTargetContext::Make(
- direct, colorType, std::move(cs), SkBackingFit::kApprox, dstInfo.dimensions(),
- 1, GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto tempCtx = direct->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, dstInfo.width(), dstInfo.height(), colorType, std::move(cs),
+ 1, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin, nullptr, SkBudgeted::kYes);
if (!tempCtx) {
return false;
}
@@ -558,9 +550,9 @@
auto xform = GrColorSpaceXform::Make(this->colorInfo().colorSpace(), srcAlphaType, cs.get(),
kPremul_SkAlphaType);
// We'll fall back to kRGBA_8888 if half float not supported.
- auto linearRTC = GrRenderTargetContext::MakeWithFallback(
- fContext, GrColorType::kRGBA_F16, cs, SkBackingFit::kExact, {srcW, srcH}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto linearRTC = fContext->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, srcW, srcH, GrColorType::kRGBA_F16, cs, 1, GrMipMapped::kNo,
+ kTopLeft_GrSurfaceOrigin);
if (!linearRTC) {
return nullptr;
}
@@ -609,9 +601,9 @@
input->colorInfo().alphaType(), cs.get(),
info.alphaType());
}
- tempB = GrRenderTargetContext::MakeWithFallback(
- fContext, colorType, std::move(cs), SkBackingFit::kExact, {nextW, nextH}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ tempB = fContext->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, nextW, nextH, colorType, std::move(cs), 1, GrMipMapped::kNo,
+ kTopLeft_GrSurfaceOrigin);
if (!tempB) {
return nullptr;
}
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index c62f651..944f979 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -19,7 +19,6 @@
#include "src/gpu/GrOpsTask.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrStencilAttachment.h"
#include "src/gpu/GrSurfacePriv.h"
#include "src/gpu/GrTexturePriv.h"
@@ -330,10 +329,10 @@
}
}
if (src->asTextureProxy()) {
- auto dstContext = GrRenderTargetContext::Make(context, colorType, nullptr, fit,
- {width, height}, format, 1,
- mipMapped, src->isProtected(), origin,
- budgeted, nullptr);
+ auto dstContext = context->priv().makeDeferredRenderTargetContext(
+ fit, width, height, colorType, nullptr, 1, mipMapped, src->origin(), nullptr,
+ budgeted);
+
if (dstContext && dstContext->blitTexture(src->asTextureProxy(), srcRect, dstPoint)) {
return dstContext->asTextureProxyRef();
}
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index d6a4a08..1bf649d 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -50,9 +50,9 @@
}
}
- auto copyRTC = GrRenderTargetContext::MakeWithFallback(
- context, colorType, nullptr, SkBackingFit::kExact, copyParams.fDimensions, 1,
- mipMapped, inputProxy->isProtected(), inputProxy->origin());
+ auto copyRTC = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, dstRect.width(), dstRect.height(), colorType, nullptr, 1,
+ mipMapped, inputProxy->origin());
if (!copyRTC) {
return nullptr;
}
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 6f861da..e6003bf 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -157,9 +157,9 @@
}
// TODO: investigate preallocating mip maps here
- auto renderTargetContext = GrRenderTargetContext::Make(
- ctx, colorType, nullptr, SkBackingFit::kExact, {desc.fWidth, desc.fHeight}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto renderTargetContext = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, desc.fWidth, desc.fHeight, colorType, nullptr, 1,
+ GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 020d123..9e114f3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -148,10 +148,10 @@
// This method is used to create SkGpuDevice's for SkSurface_Gpus. In this case
// they need to be exact.
- return GrRenderTargetContext::Make(
- context, SkColorTypeToGrColorType(origInfo.colorType()), origInfo.refColorSpace(),
- SkBackingFit::kExact, origInfo.dimensions(), sampleCount, mipMapped, GrProtected::kNo,
- origin, budgeted, surfaceProps);
+ return context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, origInfo.width(), origInfo.height(),
+ SkColorTypeToGrColorType(origInfo.colorType()), origInfo.refColorSpace(), sampleCount,
+ mipMapped, origin, surfaceProps, budgeted);
}
sk_sp<SkSpecialImage> SkGpuDevice::filterTexture(SkSpecialImage* srcImg,
@@ -1627,12 +1627,18 @@
SkASSERT(cinfo.fInfo.colorType() != kRGBA_1010102_SkColorType);
- auto rtc = GrRenderTargetContext::MakeWithFallback(
- fContext.get(), SkColorTypeToGrColorType(cinfo.fInfo.colorType()),
- fRenderTargetContext->colorInfo().refColorSpace(), fit, cinfo.fInfo.dimensions(),
- fRenderTargetContext->numSamples(), GrMipMapped::kNo,
- fRenderTargetContext->asSurfaceProxy()->isProtected(), kBottomLeft_GrSurfaceOrigin,
- SkBudgeted::kYes, &props);
+ auto rtc = fContext->priv().makeDeferredRenderTargetContextWithFallback(
+ fit,
+ cinfo.fInfo.width(),
+ cinfo.fInfo.height(),
+ SkColorTypeToGrColorType(cinfo.fInfo.colorType()),
+ fRenderTargetContext->colorInfo().refColorSpace(),
+ fRenderTargetContext->numSamples(),
+ GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin,
+ &props,
+ SkBudgeted::kYes,
+ fRenderTargetContext->asSurfaceProxy()->isProtected());
if (!rtc) {
return nullptr;
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp
index 8978efe..7338b7d 100644
--- a/src/gpu/effects/GrConfigConversionEffect.fp
+++ b/src/gpu/effects/GrConfigConversionEffect.fp
@@ -41,10 +41,14 @@
const SkImageInfo ii = SkImageInfo::Make(kSize, kSize,
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
- auto readRTC = GrRenderTargetContext::Make(
- context, kColorType, nullptr, SkBackingFit::kExact, {kSize, kSize});
- auto tempRTC = GrRenderTargetContext::Make(
- context, kColorType, nullptr, SkBackingFit::kExact, {kSize, kSize});
+ auto readRTC =
+ context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact,
+ kSize, kSize,
+ kColorType, nullptr);
+ auto tempRTC =
+ context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact,
+ kSize, kSize,
+ kColorType, nullptr);
if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
return false;
}
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index 290295b..f13707d 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -55,8 +55,9 @@
// TODO: this could be SkBackingFit::kApprox, but:
// 1) The texture coords would need to be updated.
// 2) We would have to use GrTextureDomain::kClamp_Mode for the GaussianBlur.
- auto rtc = GrRenderTargetContext::MakeWithFallback(
- context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions);
+ auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, dimensions.fWidth, dimensions.fHeight,
+ GrColorType::kAlpha_8, nullptr);
if (!rtc) {
return nullptr;
}
diff --git a/src/gpu/effects/generated/GrConfigConversionEffect.h b/src/gpu/effects/generated/GrConfigConversionEffect.h
index 6260b35..a7825c3 100644
--- a/src/gpu/effects/generated/GrConfigConversionEffect.h
+++ b/src/gpu/effects/generated/GrConfigConversionEffect.h
@@ -49,10 +49,10 @@
const SkImageInfo ii =
SkImageInfo::Make(kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
- auto readRTC = GrRenderTargetContext::Make(context, kColorType, nullptr,
- SkBackingFit::kExact, {kSize, kSize});
- auto tempRTC = GrRenderTargetContext::Make(context, kColorType, nullptr,
- SkBackingFit::kExact, {kSize, kSize});
+ auto readRTC = context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, kSize,
+ kSize, kColorType, nullptr);
+ auto tempRTC = context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, kSize,
+ kSize, kColorType, nullptr);
if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
return false;
}
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index 94b6ca1..5238abb 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -56,8 +56,9 @@
// TODO: this could be SkBackingFit::kApprox, but:
// 1) The texture coords would need to be updated.
// 2) We would have to use GrTextureDomain::kClamp_Mode for the GaussianBlur.
- auto rtc = GrRenderTargetContext::MakeWithFallback(
- context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions);
+ auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, dimensions.fWidth, dimensions.fHeight,
+ GrColorType::kAlpha_8, nullptr);
if (!rtc) {
return nullptr;
}
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 0b305e6..909ace8 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -253,8 +253,8 @@
}
// Setup dummy SkPaint / GrPaint / GrRenderTargetContext
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1024, 1024});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox, 1024, 1024,
+ GrColorType::kRGBA_8888, nullptr);
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 5800ca6..1a561af 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -81,9 +81,9 @@
targetCS.get(), this->alphaType());
SkASSERT(xform || targetCT != this->colorType());
- auto renderTargetContext = GrRenderTargetContext::MakeWithFallback(
- context, SkColorTypeToGrColorType(targetCT), nullptr, SkBackingFit::kExact,
- this->dimensions());
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, this->width(), this->height(), SkColorTypeToGrColorType(targetCT),
+ nullptr);
if (!renderTargetContext) {
return nullptr;
}
@@ -272,9 +272,13 @@
SkISize imageSize,
GrSurfaceOrigin imageOrigin,
sk_sp<SkColorSpace> imageColorSpace) {
- auto renderTargetContext = GrRenderTargetContext::Make(
- ctx, GrColorType::kRGBA_8888, std::move(imageColorSpace), SkBackingFit::kExact,
- imageSize, 1, GrMipMapped::kNo, GrProtected::kNo, imageOrigin);
+ const int width = imageSize.width();
+ const int height = imageSize.height();
+
+ // Needs to create a render target in order to draw to it for the yuv->rgb conversion.
+ auto renderTargetContext = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, width, height, GrColorType::kRGBA_8888,
+ std::move(imageColorSpace), 1, GrMipMapped::kNo, imageOrigin);
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index f134477..12ed864 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -142,9 +142,9 @@
}
// Needs to create a render target in order to draw to it for the yuv->rgb conversion.
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, this->refColorSpace(), SkBackingFit::kExact,
- this->dimensions(), 1, GrMipMapped::kNo, GrProtected::kNo, fOrigin);
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, this->width(), this->height(), GrColorType::kRGBA_8888,
+ this->refColorSpace(), 1, GrMipMapped::kNo, fOrigin);
if (!renderTargetContext) {
return;
}
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index d1fc8fe..6f620a1 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -357,10 +357,17 @@
GrColorType grColorType = SkColorTypeToGrColorType(c.colorType());
- auto rtc = GrRenderTargetContext::Make(
- context, grColorType, c.refColorSpace(), SkBackingFit::kExact,
- {c.width(), c.height()}, c.sampleCount(), GrMipMapped(c.isMipMapped()), c.isProtected(),
- c.origin(), budgeted, &c.surfaceProps());
+ auto rtc = context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact,
+ c.width(),
+ c.height(),
+ grColorType,
+ c.refColorSpace(),
+ c.sampleCount(),
+ GrMipMapped(c.isMipMapped()),
+ c.origin(),
+ &c.surfaceProps(),
+ budgeted,
+ c.isProtected());
if (!rtc) {
return nullptr;
}
diff --git a/tests/BulkRectTest.cpp b/tests/BulkRectTest.cpp
index 3e6d741..9dbf812 100644
--- a/tests/BulkRectTest.cpp
+++ b/tests/BulkRectTest.cpp
@@ -13,8 +13,8 @@
#include "tests/Test.h"
static std::unique_ptr<GrRenderTargetContext> new_RTC(GrContext* context) {
- return GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {128, 128});
+ return context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, 128, 128,
+ GrColorType::kRGBA_8888, nullptr);
}
sk_sp<GrSurfaceProxy> create_proxy(GrContext* context) {
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index 13a696f..d1373d0 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -61,8 +61,8 @@
}
std::unique_ptr<GrRenderTargetContext> newRTC(GrContext* context, int w, int h) {
- return GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {w, h});
+ return context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, w, h,
+ GrColorType::kRGBA_8888, nullptr);
}
static void clear_op_test(skiatest::Reporter* reporter, GrContext* context) {
diff --git a/tests/DefaultPathRendererTest.cpp b/tests/DefaultPathRendererTest.cpp
index ccf54d7..40a8578 100644
--- a/tests/DefaultPathRendererTest.cpp
+++ b/tests/DefaultPathRendererTest.cpp
@@ -84,9 +84,9 @@
GrStyle style(SkStrokeRec::kFill_InitStyle);
{
- auto rtc = GrRenderTargetContext::Make(
- ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox,
- {kBigSize/2 + 1, kBigSize/2 + 1});
+ auto rtc = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, kBigSize/2 + 1, kBigSize/2 + 1,
+ GrColorType::kRGBA_8888, nullptr);
rtc->clear(nullptr, { 0, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes);
@@ -103,8 +103,8 @@
}
{
- auto rtc = GrRenderTargetContext::Make(
- ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {kBigSize, kBigSize});
+ auto rtc = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kBigSize, kBigSize, GrColorType::kRGBA_8888, nullptr);
rtc->clear(nullptr, { 0, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes);
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index f2f1e45..b5c04cb 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -192,8 +192,8 @@
auto textContext = drawingManager->getTextContext();
auto opMemoryPool = context->priv().opMemoryPool();
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {32, 32});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox, 32, 32,
+ GrColorType::kRGBA_8888, nullptr);
SkPaint paint;
paint.setColor(SK_ColorRED);
diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index 6af9ba1..db81945 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -64,9 +64,9 @@
CCPRPathDrawer(sk_sp<GrContext> ctx, skiatest::Reporter* reporter, DoStroke doStroke)
: fCtx(ctx)
, fCCPR(fCtx->priv().drawingManager()->getCoverageCountingPathRenderer())
- , fRTC(GrRenderTargetContext::Make(
- fCtx.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kCanvasSize, kCanvasSize}))
+ , fRTC(fCtx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kCanvasSize, kCanvasSize, GrColorType::kRGBA_8888,
+ nullptr))
, fDoStroke(DoStroke::kYes == doStroke) {
if (!fCCPR) {
ERRORF(reporter, "ccpr not enabled in GrContext for ccpr tests");
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 6f04c50..f88b2f8 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -90,9 +90,8 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kImageWidth, kImageHeight});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kImageWidth, kImageHeight, GrColorType::kRGBA_8888, nullptr);
if (!rtc) {
ERRORF(reporter, "could not create render target context.");
return;
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index 1d8a42a..13c4628 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -183,9 +183,8 @@
GrContext* context = ctxInfo.grContext();
GrResourceProvider* rp = context->priv().resourceProvider();
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kScreenSize, kScreenSize});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kScreenSize, kScreenSize, GrColorType::kRGBA_8888, nullptr);
if (!rtc) {
ERRORF(reporter, "could not create render target context.");
return;
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index e973dcd..8d04bfa 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -323,10 +323,9 @@
{
std::unique_ptr<GrSurfaceContext> surfCtx;
if (renderable == GrRenderable::kYes) {
- surfCtx = GrRenderTargetContext::Make(
- context, combo.fColorType, nullptr, fit,
- {desc.fWidth, desc.fHeight}, 1, GrMipMapped::kNo,
- GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ surfCtx = context->priv().makeDeferredRenderTargetContext(
+ fit, desc.fWidth, desc.fHeight, combo.fColorType, nullptr,
+ 1, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin, nullptr);
} else {
surfCtx = GrSurfaceContext::Make(
context, {desc.fWidth, desc.fHeight}, combo.fFormat,
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 3d439d8..45dbac9 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -211,11 +211,11 @@
for (bool nullTexture : {false, true}) {
LazyProxyTest test(reporter);
ctx->priv().addOnFlushCallbackObject(&test);
- auto rtc = GrRenderTargetContext::Make(
- ctx.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {100, 100});
+ auto rtc = ctx->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, 100, 100,
+ GrColorType::kRGBA_8888, nullptr);
REPORTER_ASSERT(reporter, rtc);
- auto mockAtlas = GrRenderTargetContext::Make(
- ctx.get(), GrColorType::kAlpha_F16, nullptr, SkBackingFit::kExact, {10, 10});
+ auto mockAtlas = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, 10, 10, GrColorType::kAlpha_F16, nullptr);
REPORTER_ASSERT(reporter, mockAtlas);
rtc->priv().testingOnly_addDrawOp(LazyProxyTest::Clip(&test, mockAtlas->asTextureProxy()),
LazyProxyTest::Op::Make(ctx.get(), proxyProvider, &test, nullTexture));
@@ -386,8 +386,8 @@
sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions());
GrProxyProvider* proxyProvider = ctx->priv().proxyProvider();
for (bool failInstantiation : {false, true}) {
- auto rtc = GrRenderTargetContext::Make(
- ctx.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {100, 100});
+ auto rtc = ctx->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, 100, 100,
+ GrColorType::kRGBA_8888, nullptr);
REPORTER_ASSERT(reporter, rtc);
rtc->clear(nullptr, SkPMColor4f::FromBytes_RGBA(0xbaaaaaad),
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 12f9bc0..6480649 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -440,9 +440,11 @@
static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject* object, int start,
sk_sp<GrTextureProxy> atlasProxy,
SkAlphaType atlasAlphaType) {
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox,
- {3 * kDrawnTileSize, kDrawnTileSize});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox,
+ 3* kDrawnTileSize,
+ kDrawnTileSize,
+ GrColorType::kRGBA_8888,
+ nullptr);
rtc->clear(nullptr, { 1, 0, 0, 1 }, GrRenderTargetContext::CanClearFullscreen::kYes);
@@ -555,9 +557,8 @@
static const int kFinalWidth = 6*kDrawnTileSize;
static const int kFinalHeight = kDrawnTileSize;
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox,
- {kFinalWidth, kFinalHeight});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, kFinalWidth, kFinalHeight, GrColorType::kRGBA_8888, nullptr);
rtc->clear(nullptr, SK_PMColor4fWHITE, GrRenderTargetContext::CanClearFullscreen::kYes);
diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp
index 676b803..44961d4 100644
--- a/tests/PathRendererCacheTests.cpp
+++ b/tests/PathRendererCacheTests.cpp
@@ -79,9 +79,9 @@
ctx->setResourceCacheLimit(8000000);
GrResourceCache* cache = ctx->priv().getResourceCache();
- auto rtc = GrRenderTargetContext::Make(
- ctx.get(), GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto rtc = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, 800, 800, GrColorType::kRGBA_8888, nullptr, 1, GrMipMapped::kNo,
+ kTopLeft_GrSurfaceOrigin);
if (!rtc) {
return;
}
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 305202d..acfa54d 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -144,8 +144,8 @@
GrGpu* gpu = context->priv().getGpu();
#endif
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1, 1});
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, 1, 1, GrColorType::kRGBA_8888, nullptr);
if (!renderTargetContext) {
ERRORF(reporter, "Could not create render target context.");
return;
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index cfe00d6..f7c80e2 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -159,8 +159,8 @@
for (bool makeClone : {false, true}) {
for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {1, 1});
+ auto renderTargetContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, 1, 1, GrColorType::kRGBA_8888, nullptr);
{
sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(
format, desc, GrRenderable::kNo, 1, kTopLeft_GrSurfaceOrigin,
@@ -482,9 +482,8 @@
// Make the destination context for the test.
static constexpr int kRenderSize = 256;
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kRenderSize, kRenderSize});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kRenderSize, kRenderSize, GrColorType::kRGBA_8888, nullptr);
GrProcessorTestData::ProxyInfo proxies[2];
if (!init_test_textures(resourceProvider, proxyProvider, &random, proxies)) {
@@ -717,9 +716,8 @@
// Make the destination context for the test.
static constexpr int kRenderSize = 1024;
- auto rtc = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kRenderSize, kRenderSize});
+ auto rtc = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kRenderSize, kRenderSize, GrColorType::kRGBA_8888, nullptr);
GrProcessorTestData::ProxyInfo proxies[2];
if (!init_test_textures(resourceProvider, proxyProvider, &random, proxies)) {
diff --git a/tests/ProgramsTest.cpp b/tests/ProgramsTest.cpp
index 97c00c1..fc611aa 100644
--- a/tests/ProgramsTest.cpp
+++ b/tests/ProgramsTest.cpp
@@ -155,10 +155,14 @@
// Above could be 0 if msaa isn't supported.
sampleCnt = SkTMax(1, sampleCnt);
- return GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kRenderTargetWidth, kRenderTargetHeight}, sampleCnt, GrMipMapped::kNo,
- GrProtected::kNo, origin);
+ return context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact,
+ kRenderTargetWidth,
+ kRenderTargetHeight,
+ GrColorType::kRGBA_8888,
+ nullptr,
+ sampleCnt,
+ GrMipMapped::kNo,
+ origin);
}
#if GR_TEST_UTILS
@@ -320,9 +324,12 @@
GrPrepareForExternalIORequests());
// Validate that GrFPs work correctly without an input.
- auto renderTargetContext = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
- {kRenderTargetWidth, kRenderTargetHeight});
+ auto renderTargetContext =
+ context->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact,
+ kRenderTargetWidth,
+ kRenderTargetHeight,
+ GrColorType::kRGBA_8888,
+ nullptr);
if (!renderTargetContext) {
SkDebugf("Could not allocate a renderTargetContext");
return false;
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 2eacffe..7c66850 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -30,8 +30,8 @@
static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* context,
sk_sp<GrTextureProxy> rectProxy, GrColorType colorType,
SkAlphaType alphaType, uint32_t expectedPixelValues[]) {
- auto rtContext = GrRenderTargetContext::Make(
- context, colorType, nullptr, SkBackingFit::kExact, rectProxy->dimensions());
+ auto rtContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, rectProxy->width(), rectProxy->height(), colorType, nullptr);
for (auto filter : {GrSamplerState::Filter::kNearest,
GrSamplerState::Filter::kBilerp,
GrSamplerState::Filter::kMipMap}) {
diff --git a/tests/RenderTargetContextTest.cpp b/tests/RenderTargetContextTest.cpp
index 395a09a..ce7a39f 100644
--- a/tests/RenderTargetContextTest.cpp
+++ b/tests/RenderTargetContextTest.cpp
@@ -17,8 +17,8 @@
static const int kSize = 64;
static std::unique_ptr<GrRenderTargetContext> get_rtc(GrContext* ctx) {
- return GrRenderTargetContext::Make(
- ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {kSize, kSize});
+ return ctx->priv().makeDeferredRenderTargetContext(SkBackingFit::kExact, kSize, kSize,
+ GrColorType::kRGBA_8888, nullptr);
}
static void check_instantiation_status(skiatest::Reporter* reporter,
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index b54026b..f42bc22 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -190,10 +190,10 @@
static std::unique_ptr<GrSurfaceContext> make_surface_context(Encoding contextEncoding,
GrContext* context,
skiatest::Reporter* reporter) {
- auto surfaceContext = GrRenderTargetContext::Make(
- context, GrColorType::kRGBA_8888, encoding_as_color_space(contextEncoding),
- SkBackingFit::kExact, {kW, kH}, 1, GrMipMapped::kNo, GrProtected::kNo,
- kBottomLeft_GrSurfaceOrigin, SkBudgeted::kNo);
+ auto surfaceContext = context->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kExact, kW, kH, GrColorType::kRGBA_8888,
+ encoding_as_color_space(contextEncoding), 1, GrMipMapped::kNo,
+ kBottomLeft_GrSurfaceOrigin, nullptr, SkBudgeted::kNo, GrProtected::kNo);
if (!surfaceContext) {
ERRORF(reporter, "Could not create %s surface context.", encoding_as_str(contextEncoding));
}
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index acd97b1..0a382c8 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -733,9 +733,9 @@
DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
GrContext* ctx = ctxInfo.grContext();
- auto rtc = GrRenderTargetContext::Make(
- ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800}, 1,
- GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
+ auto rtc = ctx->priv().makeDeferredRenderTargetContext(
+ SkBackingFit::kApprox, 800, 800, GrColorType::kRGBA_8888, nullptr, 1, GrMipMapped::kNo,
+ kTopLeft_GrSurfaceOrigin);
if (!rtc) {
return;
}