aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Timothy Liang <timliang@google.com>2018-06-28 15:50:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-28 20:21:17 +0000
commit036fdfe5aa1266dbc35f0a2c680f648b62b9c28b (patch)
tree5daf6dd36649795833724d954994438c9ab35dd2 /tools
parentbe0ab883e796b190cd20a4b1cfaedea932f9e0bf (diff)
implemented getting format from texture as virtual in gpu caps
Bug: skia: Change-Id: If6bbbd212ff472ea322d2bbed61995fe7ba85df7 Reviewed-on: https://skia-review.googlesource.com/138240 Commit-Queue: Timothy Liang <timliang@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/DDLPromiseImageHelper.cpp8
-rw-r--r--tools/DDLPromiseImageHelper.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/tools/DDLPromiseImageHelper.cpp b/tools/DDLPromiseImageHelper.cpp
index 586c2339a6..cc543f9d40 100644
--- a/tools/DDLPromiseImageHelper.cpp
+++ b/tools/DDLPromiseImageHelper.cpp
@@ -20,6 +20,10 @@ DDLPromiseImageHelper::PromiseImageCallbackContext::~PromiseImageCallbackContext
}
}
+const GrCaps* DDLPromiseImageHelper::PromiseImageCallbackContext::caps() const {
+ return fContext->contextPriv().caps();
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkData> DDLPromiseImageHelper::deflateSKP(const SkPicture* inputPicture) {
@@ -104,7 +108,9 @@ sk_sp<SkImage> DDLPromiseImageHelper::PromiseImageCreator(const void* rawData,
}
SkASSERT(curImage.fIndex == *indexPtr);
- GrBackendFormat backendFormat = curImage.fCallbackContext->backendTexture().format();
+ const GrCaps* caps = curImage.fCallbackContext->caps();
+ const GrBackendTexture& backendTex = curImage.fCallbackContext->backendTexture();
+ GrBackendFormat backendFormat = caps->createFormatFromBackendTexture(backendTex);
// Each DDL recorder gets its own ref on the promise callback context for the
// promise images it creates.
diff --git a/tools/DDLPromiseImageHelper.h b/tools/DDLPromiseImageHelper.h
index 5bc97afc34..e9520b2d48 100644
--- a/tools/DDLPromiseImageHelper.h
+++ b/tools/DDLPromiseImageHelper.h
@@ -77,6 +77,8 @@ private:
const GrBackendTexture& backendTexture() const { return fBackendTexture; }
+ const GrCaps* caps() const;
+
private:
GrContext* fContext;
GrBackendTexture fBackendTexture;