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

Unified Diff: tools/bench_pictures_main.cpp

Issue 19109002: Add the lazy decoder from PictureFlags to SkImageDecoder (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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
Index: tools/bench_pictures_main.cpp
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 720621ec9a05ff870b466e152173267b1543d089..9e30a4276d568260e7b74f21532fb97e61eb1fee 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -11,7 +11,6 @@
#include "PictureRenderingFlags.h"
#include "SkBenchLogger.h"
#include "SkCommandLineFlags.h"
-#include "SkForceLinking.h"
#include "SkGraphics.h"
#include "SkImageDecoder.h"
#if LAZY_CACHE_STATS
@@ -24,8 +23,6 @@
#include "SkStream.h"
#include "picture_utils.h"
-__SK_FORCE_IMAGE_DECODER_LINKING;
-
SkBenchLogger gLogger;
// Flags used by this file, in alphabetical order.
@@ -145,10 +142,6 @@ static SkString filterFlagsUsage() {
return result;
}
-// 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;
static int32_t gTotalCacheMisses;
@@ -167,15 +160,16 @@ static bool run_single_benchmark(const SkString& inputPath,
}
// Since the old picture has been deleted, all pixels should be cleared.
- SkASSERT(gLruImageCache.getImageCacheUsed() == 0);
+ SkLruImageCache* gLruImageCache = SkImageDecoder::getLruImageCache();
+ SkASSERT(gLruImageCache->getImageCacheUsed() == 0);
if (FLAGS_countRAM) {
// Set the limit to zero, so all pixels will be kept
- gLruImageCache.setImageCacheLimit(0);
+ gLruImageCache->setImageCacheLimit(0);
}
SkPicture::InstallPixelRefProc proc;
if (FLAGS_deferImageDecoding) {
- proc = &lazy_decode_bitmap;
+ proc = &SkImageDecoder::LazyDecodeBitmap;
} else {
proc = &SkImageDecoder::DecodeMemory;
}
@@ -212,7 +206,7 @@ static bool run_single_benchmark(const SkString& inputPath,
#endif
if (FLAGS_countRAM) {
SkString ramCount("RAM used for bitmaps: ");
- size_t bytes = gLruImageCache.getImageCacheUsed();
+ size_t bytes = gLruImageCache->getImageCacheUsed();
if (bytes > 1024) {
size_t kb = bytes / 1024;
if (kb > 1024) {

Powered by Google App Engine
This is Rietveld 408576698