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

Unified Diff: gm/deferredtextureimagedata.cpp

Issue 2068863003: Actually fix leak in deferred_texture_image_data (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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: gm/deferredtextureimagedata.cpp
diff --git a/gm/deferredtextureimagedata.cpp b/gm/deferredtextureimagedata.cpp
index 3cb1f24a77ef0d094d1b59e5e68414cf3e0dff6c..0a3b40213a4b33a600d559c8ea27c6748a404e94 100644
--- a/gm/deferredtextureimagedata.cpp
+++ b/gm/deferredtextureimagedata.cpp
@@ -18,20 +18,19 @@
static bool DrawDeferredTextureImageData(GrContext* context, SkCanvas* canvas, SkImage* image,
SkImage::DeferredTextureImageUsageParams* params,
SkScalar x, SkScalar y) {
- size_t deferredSize =
- image->getDeferredTextureImageData(*context->threadSafeProxy(), params, 1, nullptr);
- if (deferredSize == 0) {
- SkDebugf("\nCould not create DeferredTextureImageData.\n");
- return false;
- }
+ SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
+ size_t deferredSize = image->getDeferredTextureImageData(*proxy, params, 1, nullptr);
+ if (deferredSize == 0) {
+ SkDebugf("\nCould not create DeferredTextureImageData.\n");
+ return false;
+ }
- std::vector<uint8_t> memory;
- memory.resize(deferredSize);
- SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
- image->getDeferredTextureImageData(*proxy, params, 1, memory.data());
- sk_sp<SkImage> uploadedImage =
- SkImage::MakeFromDeferredTextureImageData(context, memory.data(), SkBudgeted::kNo);
- canvas->drawImage(uploadedImage, x, y);
+ std::vector<uint8_t> memory;
+ memory.resize(deferredSize);
+ image->getDeferredTextureImageData(*proxy, params, 1, memory.data());
+ sk_sp<SkImage> uploadedImage =
+ SkImage::MakeFromDeferredTextureImageData(context, memory.data(), SkBudgeted::kNo);
+ canvas->drawImage(uploadedImage, x, y);
return true;
}
« 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