aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-04-17 16:09:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-17 20:57:01 +0000
commitc186e17a6b78e4897a9180f33b638d6b6cc6d959 (patch)
treeca6cfcff94c2e939ab5205df3e1602cafdbd1940 /dm
parentf155f81b8dacc2a779bce57b7f056c2831c7267d (diff)
Add handling to ViaDDL for images that are too large to be uploaded in one go
In Chrome's use case they are already doing a lot of work to determine where a given texture lands in device space. Presumably, part of that analysis is to determine if a texture is too big and either resize it or break it up. It seems unlikely they would be letting us upload it and draw it tiled. Bug: skia:7762 Change-Id: Ia95abc52f7e99c0a6ddef9f6db6237adba8cbc93 Reviewed-on: https://skia-review.googlesource.com/121892 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'dm')
-rw-r--r--dm/DMSrcSink.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index f0b329c5b9..9829e2978d 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -2099,12 +2099,14 @@ public:
sk_sp<PromiseImageCallbackContext> callbackContext(
new PromiseImageCallbackContext(context));
+ const PromiseImageInfo& info = fImageInfo[i];
+
// DDL TODO: how can we tell if we need mipmapping!
callbackContext->setBackendTexture(gpu->createTestingOnlyBackendTexture(
- fImageInfo[i].fBitmap.getPixels(),
- fImageInfo[i].fBitmap.width(),
- fImageInfo[i].fBitmap.height(),
- fImageInfo[i].fBitmap.colorType(),
+ info.fBitmap.getPixels(),
+ info.fBitmap.width(),
+ info.fBitmap.height(),
+ info.fBitmap.colorType(),
false, GrMipMapped::kNo));
// The GMs sometimes request too large an image
//SkAssertResult(callbackContext->backendTexture().isValid());
@@ -2262,8 +2264,11 @@ private:
const PromiseImageHelper::PromiseImageInfo& curImage = helper->getInfo(*indexPtr);
if (!curImage.fCallbackContext->backendTexture().isValid()) {
- // We weren't able to make a backend texture for this SkImage
- return nullptr;
+ // We weren't able to make a backend texture for this SkImage. In this case we create
+ // a separate bitmap-backed image for each thread.
+ // Note: we would like to share the same bitmap between all the threads but
+ // SkBitmap is not thread-safe.
+ return SkImage::MakeRasterCopy(curImage.fBitmap.pixmap());
}
SkASSERT(curImage.fIndex == *indexPtr);