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

Unified Diff: gm/factory.cpp

Issue 103033002: Big Cleanup: SkBitmapFactory, SkLazyPixelRef, SkImageCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 | gyp/core.gypi » ('j') | include/images/SkDecodingImageGenerator.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/factory.cpp
diff --git a/gm/factory.cpp b/gm/factory.cpp
index 6734235abb583aa66b5325feeca1ff1e5edefd1e..548de80bb39f57bd5749b6751da3c39816628151 100644
--- a/gm/factory.cpp
+++ b/gm/factory.cpp
@@ -6,12 +6,13 @@
*/
#include "gm.h"
-#include "SkBitmapFactory.h"
#include "SkCanvas.h"
#include "SkData.h"
+#include "SkDecodingImageGenerator.h"
+#include "SkDiscardablePixelRef.h"
#include "SkImageDecoder.h"
-#include "SkLruImageCache.h"
#include "SkOSFile.h"
+#include "SkDiscardableMemoryPool.h"
#include "SkStream.h"
namespace skiagm {
@@ -36,12 +37,14 @@ protected:
void* buffer = sk_malloc_throw(length);
stream->read(buffer, length);
SkAutoDataUnref data(SkData::NewFromMalloc(buffer, length));
- SkBitmapFactory factory(&SkImageDecoder::DecodeMemoryToTarget);
+
+ SkASSERT(NULL == data.get());
scroggo 2013/12/03 23:00:01 How is data NULL here? Did you test with the resou
hal.canary 2013/12/04 00:01:36 I meant to write !=, and I haven't gotten around t
hal.canary 2013/12/04 14:30:33 Tested with `out/Debug/gm --match factory --resour
// Create a cache which will boot the pixels out anytime the
// bitmap is unlocked.
- SkAutoTUnref<SkLruImageCache> cache(SkNEW_ARGS(SkLruImageCache, (1)));
- factory.setImageCache(cache);
- factory.installPixelRef(data, &fBitmap);
+ SkAutoTUnref<SkDiscardableMemoryPool> pool(
+ SkNEW_ARGS(SkDiscardableMemoryPool, (1)));
+ SkAssertResult(SkDecodingImageGenerator::Install(data,
+ &fBitmap, pool));
}
}
« no previous file with comments | « no previous file | gyp/core.gypi » ('j') | include/images/SkDecodingImageGenerator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698