Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 2157513002: Add copy (when needed) to SkGpuDevice::asSpecial (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add copy (when needed) to SkGpuDevice::asSpecial Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 3ceff366c40fa1aaf1fcf2b6c35fdf504a4d78be..e9baae54a8740d4a353e06e59787479e22dd18a8 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1402,7 +1402,19 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
sk_sp<SkSpecialImage> SkGpuDevice::asSpecial() {
sk_sp<GrTexture> texture(this->accessDrawContext()->asTexture());
if (!texture) {
- return nullptr;
+ // When the device doesn't have a texture, we create a temporary texture.
+ // TODO: we should actually only copy the portion of the source needed to apply the image
+ // filter
+ texture.reset(fContext->textureProvider()->createTexture(this->accessDrawContext()->desc(),
+ SkBudgeted::kYes));
+ if (!texture) {
+ return nullptr;
+ }
+
+ if (!fContext->copySurface(this->accessDrawContext()->accessRenderTarget(),
+ texture.get())) {
+ return nullptr;
+ }
}
const SkImageInfo ii = this->imageInfo();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698