Views for all draw texture calls in SkGpuDevice and RenderTargetContext.
Bug: skia:9556
Change-Id: Ibb0e0cff3301554e988d5900455766b6428484ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269360
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index f1c74ae..605b6c8 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -266,18 +266,15 @@
* 'domain' is null, it's equivalent to using the fast src rect constraint. If 'domain' is
* provided, the strict src rect constraint is applied using 'domain'.
*/
- void drawTextureQuad(const GrClip& clip, sk_sp<GrTextureProxy> proxy, GrColorType srcColorType,
+ void drawTextureQuad(const GrClip& clip, GrSurfaceProxyView view, GrColorType srcColorType,
SkAlphaType srcAlphaType, GrSamplerState::Filter filter, SkBlendMode mode,
const SkPMColor4f& color, const SkPoint srcQuad[4],
const SkPoint dstQuad[4], GrAA aa, GrQuadAAFlags edgeAA,
const SkRect* domain, const SkMatrix& viewMatrix,
sk_sp<GrColorSpaceXform> texXform) {
- GrSurfaceOrigin origin = proxy->origin();
- const GrSwizzle& swizzle = proxy->textureSwizzle();
- GrSurfaceProxyView proxyView(std::move(proxy), origin, swizzle);
DrawQuad quad{GrQuad::MakeFromSkQuad(dstQuad, viewMatrix),
GrQuad::MakeFromSkQuad(srcQuad, SkMatrix::I()), edgeAA};
- this->drawTexturedQuad(clip, std::move(proxyView), srcAlphaType, std::move(texXform),
+ this->drawTexturedQuad(clip, std::move(view), srcAlphaType, std::move(texXform),
filter, color, mode, aa, &quad, domain);
}
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 4eb9e3e..edd3469 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -174,7 +174,7 @@
static void draw_texture(GrRenderTargetContext* rtc, const GrClip& clip, const SkMatrix& ctm,
const SkPaint& paint, const SkRect& srcRect, const SkRect& dstRect,
const SkPoint dstClip[4], GrAA aa, GrQuadAAFlags aaFlags,
- SkCanvas::SrcRectConstraint constraint, sk_sp<GrTextureProxy> proxy,
+ SkCanvas::SrcRectConstraint constraint, GrSurfaceProxyView view,
const GrColorInfo& srcColorInfo) {
const GrColorInfo& dstInfo(rtc->colorInfo());
auto textureXform =
@@ -192,7 +192,7 @@
case kHigh_SkFilterQuality:
SK_ABORT("Quality level not allowed.");
}
-
+ GrSurfaceProxy* proxy = view.proxy();
// Must specify the strict constraint when the proxy is not functionally exact and the src
// rect would access pixels outside the proxy's content area without the constraint.
if (constraint != SkCanvas::kStrict_SrcRectConstraint && !proxy->isFunctionallyExact()) {
@@ -219,15 +219,12 @@
SkPoint srcQuad[4];
GrMapRectPoints(dstRect, srcRect, dstClip, srcQuad, 4);
- rtc->drawTextureQuad(clip, std::move(proxy), srcColorInfo.colorType(),
+ rtc->drawTextureQuad(clip, std::move(view), srcColorInfo.colorType(),
srcColorInfo.alphaType(), filter, paint.getBlendMode(), color, srcQuad,
dstClip, aa, aaFlags,
constraint == SkCanvas::kStrict_SrcRectConstraint ? &srcRect : nullptr,
ctm, std::move(textureXform));
} else {
- GrSurfaceOrigin origin = proxy->origin();
- GrSwizzle swizzle = proxy->textureSwizzle();
- GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
rtc->drawTexture(clip, std::move(view), srcColorInfo.alphaType(), filter,
paint.getBlendMode(), color, srcRect, dstRect, aa, aaFlags, constraint,
ctm, std::move(textureXform));
@@ -250,7 +247,7 @@
}
draw_texture(rtc, clip, ctm, paint, src, dst, dstClip, aa, aaFlags, constraint,
- view.asTextureProxyRef(),
+ std::move(view),
{ct, producer->alphaType(), sk_ref_sp(producer->colorSpace())});
return;
}
@@ -417,7 +414,7 @@
if (attemptDrawTexture && can_use_draw_texture(paint)) {
draw_texture(fRenderTargetContext.get(), this->clip(), ctm, paint, src, dst, dstClip,
- aa, aaFlags, constraint, view.asTextureProxyRef(), colorInfo);
+ aa, aaFlags, constraint, std::move(view), colorInfo);
return;
}
GrTextureAdjuster adjuster(fContext.get(), std::move(view), colorInfo, pinnedUniqueID,