diff options
author | 2013-03-18 21:37:39 +0000 | |
---|---|---|
committer | 2013-03-18 21:37:39 +0000 | |
commit | bb281f7f963ea9ae6d735ca8430396cfabaa73ca (patch) | |
tree | 4e3576fe1a3bdd0afad6915958644c71654b3519 /tools/bench_pictures_main.cpp | |
parent | e1575aa21619e252f6c6514317041c32d00ce5a6 (diff) |
Improvements/additions to SkImageCache/SkLazyPixelRef.
SkPurgeableImageCache:
New image cache that uses virtual memory to store the pixels. Combines
features of SkAshmemImageCache (which has been removed) with SkPurgeableMemoryBlock, which has android and Mac versions.
SkImageCache:
Modified the API. pinCache now returns a status out parameter which
states whether the pinned memory retained the old data. This allows
allocAndPinCache to only be used for allocations.
Add a new debug only interface to purge unpinned data.
Updates to documentation, clarifying behavior.
Changed CachedStatus to MemoryStatus
SkLruImageCache:
Implement the new function purgeAllUnpinnedCaches and change implementation
of pinCache for the new behavior.
SkLazyPixelRef:
Rewrite onLockPixels to account for the new behavior of pinCache.
BitmapFactoryTest:
Test the new SkPurgeableImageCache.
Write tests which directly test the SkImageCaches.
Create a larger bitmap, since some of the SkImageCaches are designed
to handle large bitmaps.
bench_ and render_pictures:
Consolidate lazy_decode_bitmap into one function.
Allow using a flag to specify using the purgeable image cache.
Clean up some #includes.
Review URL: https://codereview.chromium.org/12433020
git-svn-id: http://skia.googlecode.com/svn/trunk@8207 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/bench_pictures_main.cpp')
-rw-r--r-- | tools/bench_pictures_main.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp index d027db9633..31ef48449a 100644 --- a/tools/bench_pictures_main.cpp +++ b/tools/bench_pictures_main.cpp @@ -10,16 +10,17 @@ #include "PictureBenchmark.h" #include "PictureRenderingFlags.h" #include "SkBenchLogger.h" -#include "SkBitmapFactory.h" -#include "SkCanvas.h" #include "SkFlags.h" #include "SkGraphics.h" #include "SkImageDecoder.h" +#if LAZY_CACHE_STATS + #include "SkLazyPixelRef.h" +#endif +#include "SkLruImageCache.h" #include "SkMath.h" #include "SkOSFile.h" #include "SkPicture.h" #include "SkStream.h" -#include "SkTArray.h" #include "picture_utils.h" @@ -142,20 +143,9 @@ static SkString filterFlagsUsage() { return result; } -#include "SkData.h" -#include "SkLruImageCache.h" -#include "SkLazyPixelRef.h" - -static SkLruImageCache gLruImageCache(1024*1024); - -static bool lazy_decode_bitmap(const void* buffer, size_t size, SkBitmap* bitmap) { - void* copiedBuffer = sk_malloc_throw(size); - memcpy(copiedBuffer, buffer, size); - SkAutoDataUnref data(SkData::NewFromMalloc(copiedBuffer, size)); - SkBitmapFactory factory(&SkImageDecoder::DecodeMemoryToTarget); - factory.setImageCache(&gLruImageCache); - return factory.installPixelRef(data, bitmap); -} +// These are defined in PictureRenderingFlags.cpp +extern SkLruImageCache gLruImageCache; +extern bool lazy_decode_bitmap(const void* buffer, size_t size, SkBitmap* bitmap); #if LAZY_CACHE_STATS static int32_t gTotalCacheHits; |