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

Unified Diff: src/lazy/SkDiscardablePixelRef.cpp

Issue 93703004: Change SkDecodingImageGenerator API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebased Created 6 years, 12 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 | « src/lazy/SkDiscardablePixelRef.h ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lazy/SkDiscardablePixelRef.cpp
diff --git a/src/lazy/SkDiscardablePixelRef.cpp b/src/lazy/SkDiscardablePixelRef.cpp
index 160ca5b4fbacdaae84f040c5eae3084f10b36cd6..2886156102937faeb734f2891b74daaff47dba61 100644
--- a/src/lazy/SkDiscardablePixelRef.cpp
+++ b/src/lazy/SkDiscardablePixelRef.cpp
@@ -72,20 +72,19 @@ bool SkInstallDiscardablePixelRef(SkImageGenerator* generator,
SkBitmap* dst,
SkDiscardableMemory::Factory* factory) {
SkImageInfo info;
- SkASSERT(generator != NULL);
- if ((NULL == generator)
- || (!generator->getInfo(&info))
+ SkAutoTDelete<SkImageGenerator> autoGenerator(generator);
+ if ((NULL == autoGenerator.get())
+ || (!autoGenerator->getInfo(&info))
|| (!dst->setConfig(info, 0))) {
- SkDELETE(generator);
return false;
}
SkASSERT(dst->config() != SkBitmap::kNo_Config);
- if (dst->empty()) { // Use a normal pixelref.
- SkDELETE(generator); // Do not need this anymore.
+ if (dst->empty()) { // Use a normal pixelref.
return dst->allocPixels(NULL, NULL);
}
- SkAutoTUnref<SkDiscardablePixelRef> ref(SkNEW_ARGS(SkDiscardablePixelRef,
- (info, generator, dst->rowBytes(), factory)));
+ SkAutoTUnref<SkDiscardablePixelRef> ref(
+ SkNEW_ARGS(SkDiscardablePixelRef,
+ (info, autoGenerator.detach(), dst->rowBytes(), factory)));
dst->setPixelRef(ref);
return true;
}
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.h ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698