aboutsummaryrefslogtreecommitdiff
path: root/src/image
diff options
context:
space:
mode:
authorJim Van Verth <jvanverth@google.com>2018-11-05 15:55:53 -0500
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-11-05 21:33:23 +0000
commit803a5023625c387ca4ca6707eba77baf696fa635 (patch)
tree85652dfc6d3b3914658a1ded3eb6f3150bf8d7e8 /src/image
parentc34dd6c5263490b94ef9af7a14dee1b4bc872b58 (diff)
downloadskqp-803a5023625c387ca4ca6707eba77baf696fa635.tar.gz
Fix persp_images with DDL correctly
Bug: skia: Change-Id: I459e8ca8ae077fd3aa9d9753f856690ac7de2711 Reviewed-on: https://skia-review.googlesource.com/c/168276 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_GpuYUVA.cpp18
-rw-r--r--src/image/SkImage_GpuYUVA.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 8a32d1ad67..7e45c51570 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -16,6 +16,7 @@
#include "GrRenderTargetContext.h"
#include "GrTexture.h"
#include "GrTextureProducer.h"
+#include "SkGr.h"
#include "SkImage_Gpu.h"
#include "SkImage_GpuYUVA.h"
#include "SkMipMap.h"
@@ -119,6 +120,23 @@ sk_sp<GrTextureProxy> SkImage_GpuYUVA::asTextureProxyRef() const {
return fRGBProxy;
}
+sk_sp<GrTextureProxy> SkImage_GpuYUVA::asMippedTextureProxyRef() const {
+ // if invalid or already has miplevels
+ auto proxy = this->asTextureProxyRef();
+ if (!proxy || GrMipMapped::kYes == fRGBProxy->mipMapped()) {
+ return proxy;
+ }
+
+ // need to generate mips for the proxy
+ if (auto mippedProxy = GrCopyBaseMipMapToTextureProxy(fContext.get(), proxy.get())) {
+ fRGBProxy = mippedProxy;
+ return mippedProxy;
+ }
+
+ // failed to generate mips
+ return nullptr;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkImage> SkImage::MakeFromYUVATextures(GrContext* ctx,
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index fea77005d5..7e4150a1eb 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -51,6 +51,10 @@ public:
bool canBeMipmapped(GrContext* context) const;
+ // Returns a ref-ed texture proxy with miplevels
+ sk_sp<GrTextureProxy> asMippedTextureProxyRef() const;
+
+
/**
Create a new SkImage_GpuYUVA that's very similar to SkImage created by MakeFromYUVATextures.
The main difference is that the client doesn't have the backend textures on the gpu yet but