Store GrSurfaceProxyView on shadow ops.
Bug: skia:9556
Change-Id: I04a5a44a6483c3e4d70b84b1d7df7ea9db6d44d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258814
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index 6a4bbab..a9e7b72 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -192,9 +192,9 @@
// An insetWidth > 1/2 rect width or height indicates a simple fill.
ShadowCircularRRectOp(GrColor color, const SkRect& devRect,
float devRadius, bool isCircle, float blurRadius, float insetWidth,
- sk_sp<GrTextureProxy> falloffProxy)
+ GrSurfaceProxyView falloffView)
: INHERITED(ClassID())
- , fFalloffProxy(falloffProxy) {
+ , fFalloffView(std::move(falloffView)) {
SkRect bounds = devRect;
SkASSERT(insetWidth > 0);
SkScalar innerRadius = 0.0f;
@@ -541,7 +541,7 @@
void onPrepareDraws(Target* target) override {
// Setup geometry processor
GrGeometryProcessor* gp = GrRRectShadowGeoProc::Make(target->allocator(),
- fFalloffProxy.get());
+ fFalloffView);
int instanceCount = fGeoData.count();
SkASSERT(sizeof(CircleVertex) == gp->vertexStride());
@@ -593,7 +593,7 @@
}
auto fixedDynamicState = target->makeFixedDynamicState(1);
- fixedDynamicState->fPrimitiveProcessorTextures[0] = fFalloffProxy.get();
+ fixedDynamicState->fPrimitiveProcessorTextures[0] = fFalloffView.proxy();
GrMesh* mesh = target->allocMesh(GrPrimitiveType::kTriangles);
mesh->setIndexed(std::move(indexBuffer), fIndexCount, firstIndex, 0, fVertCount - 1,
@@ -619,13 +619,13 @@
}
void visitProxies(const VisitProxyFunc& func) const override {
- func(fFalloffProxy.get(), GrMipMapped(false));
+ func(fFalloffView.proxy(), GrMipMapped(false));
}
SkSTArray<1, Geometry, true> fGeoData;
int fVertCount;
int fIndexCount;
- sk_sp<GrTextureProxy> fFalloffProxy;
+ GrSurfaceProxyView fFalloffView;
typedef GrMeshDrawOp INHERITED;
};
@@ -691,6 +691,10 @@
if (!falloffTexture) {
return nullptr;
}
+ GrSwizzle swizzle = context->priv().caps()->getTextureSwizzle(falloffTexture->backendFormat(),
+ GrColorType::kAlpha_8);
+
+ GrSurfaceProxyView falloffView(std::move(falloffTexture), kTopLeft_GrSurfaceOrigin, swizzle);
// Do any matrix crunching before we reset the draw state for device coords.
const SkRect& rrectBounds = rrect.getBounds();
@@ -714,7 +718,7 @@
rrect.isOval(),
blurWidth,
scaledInsetWidth,
- std::move(falloffTexture));
+ std::move(falloffView));
}
}