Access proxy directly in SkGpuDevice::drawImageSet for pinned/GPU images
Change-Id: Ie39d051ea9e56a0fdb2ddc0670fc9938598e6f99
Reviewed-on: https://skia-review.googlesource.com/c/164045
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 1002053..9f9f783 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1477,20 +1477,25 @@
n = 0;
continue;
}
- textures[i].fProxy =
- as_IB(set[i].fImage.get())
- ->asTextureProxyRef(fContext.get(), GrSamplerState::ClampBilerp(), nullptr);
+ uint32_t uniqueID;
+ textures[i].fProxy = as_IB(set[i].fImage.get())->refPinnedTextureProxy(&uniqueID);
+ if (!textures[i].fProxy) {
+ textures[i].fProxy =
+ as_IB(set[i].fImage.get())
+ ->asTextureProxyRef(fContext.get(), GrSamplerState::ClampBilerp(),
+ nullptr);
+ // If we failed to make a proxy then flush the accumulated set and reset for the next
+ // image.
+ if (!textures[i].fProxy) {
+ draw();
+ base = i + 1;
+ n = 0;
+ continue;
+ }
+ }
textures[i].fSrcRect = set[i].fSrcRect;
textures[i].fDstRect = set[i].fDstRect;
textures[i].fAAFlags = SkToGrQuadAAFlags(set[i].fAAFlags);
- // If we failed to make a proxy or our proxy can't be grouped with the previous proxies then
- // draw the accumulated set and reset.
- if (!textures[i].fProxy) {
- draw();
- base = i + 1;
- n = 0;
- continue;
- }
if (n > 0 &&
(textures[i].fProxy->textureType() != textures[base].fProxy->textureType() ||
textures[i].fProxy->config() != textures[base].fProxy->config() ||