Pass description of GrSurface to GrSurfaceProxy lazy callbacks.
Also make GrDynamicAtlas directly use the GrSurface callback type rather
than go through a springboard.
Change-Id: I3e3c155bbc1e2e794e0d6828b0ea3c64c6a7f3e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283226
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDynamicAtlas.cpp b/src/gpu/GrDynamicAtlas.cpp
index 1ad8c6c..00d0947 100644
--- a/src/gpu/GrDynamicAtlas.cpp
+++ b/src/gpu/GrDynamicAtlas.cpp
@@ -46,8 +46,10 @@
};
sk_sp<GrTextureProxy> GrDynamicAtlas::MakeLazyAtlasProxy(
- const LazyInstantiateAtlasCallback& callback, GrColorType colorType,
- InternalMultisample internalMultisample, const GrCaps& caps,
+ LazyInstantiateAtlasCallback&& callback,
+ GrColorType colorType,
+ InternalMultisample internalMultisample,
+ const GrCaps& caps,
GrSurfaceProxy::UseAllocator useAllocator) {
GrBackendFormat format = caps.getDefaultBackendFormat(colorType, GrRenderable::kYes);
@@ -56,12 +58,8 @@
sampleCount = caps.internalMultisampleCount(format);
}
- auto instantiate = [cb = std::move(callback), format, sampleCount](GrResourceProvider* rp) {
- return cb(rp, format, sampleCount);
- };
-
sk_sp<GrTextureProxy> proxy =
- GrProxyProvider::MakeFullyLazyProxy(std::move(instantiate), format, GrRenderable::kYes,
+ GrProxyProvider::MakeFullyLazyProxy(std::move(callback), format, GrRenderable::kYes,
sampleCount, GrProtected::kNo, caps, useAllocator);
return proxy;
@@ -85,12 +83,11 @@
fTopNode = nullptr;
fDrawBounds.setEmpty();
fTextureProxy = MakeLazyAtlasProxy(
- [this](GrResourceProvider* resourceProvider, const GrBackendFormat& format,
- int sampleCount) {
+ [this](GrResourceProvider* resourceProvider, const LazyAtlasDesc& desc) {
if (!fBackingTexture) {
fBackingTexture = resourceProvider->createTexture(
- {fWidth, fHeight}, format, GrRenderable::kYes, sampleCount,
- GrMipMapped::kNo, SkBudgeted::kYes, GrProtected::kNo);
+ {fWidth, fHeight}, desc.fFormat, desc.fRenderable, desc.fSampleCnt,
+ desc.fMipMapped, desc.fBudgeted, desc.fProtected);
}
return GrSurfaceProxy::LazyCallbackResult(fBackingTexture);
},