Make SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE equal to
skia_resource_cache_mb_limit, if that value is >0 (true for some
low-memory Android devices).
render_pdfs test program uses lazy decoding (and the discardable
memory pool).
BUG=skia:2743
R=djsollen@google.com, mtklein@google.com
Author: halcanary@google.com
Review URL: https://codereview.chromium.org/
433063002
'SK_SUPPORT_GPU=<(skia_gpu)',
'SK_SUPPORT_OPENCL=<(skia_opencl)',
'SK_FORCE_DISTANCEFIELD_FONTS=<(skia_force_distancefield_fonts)',
+ 'SK_DEFAULT_RESOURCE_CACHE_MB_LIMIT=<(skia_resource_cache_mb_limit)',
],
'conditions' : [
['skia_pic', {
'type': 'executable',
'sources': [
'../tools/render_pdfs_main.cpp',
+ '../tools/flags/SkCommandLineFlags.cpp',
+ '../tools/LazyDecodeBitmap.cpp',
'../tools/PdfRenderer.cpp',
'../tools/PdfRenderer.h',
],
'include_dirs': [
+ '../src/core',
+ '../src/lazy',
'../src/pipe/utils/',
'../src/utils/',
+ '../tools/flags',
],
'dependencies': [
'pdf.gyp:pdf',
SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool();
#if !defined(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE)
-#define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (128 * 1024 * 1024)
+ #if defined(SK_DEFAULT_RESOURCE_CACHE_MB_LIMIT) && \
+ SK_DEFAULT_RESOURCE_CACHE_MB_LIMIT > 0
+ #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE \
+ (SK_DEFAULT_RESOURCE_CACHE_MB_LIMIT * 1024 * 1024)
+ #else
+ #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE \
+ (128 * 1024 * 1024)
+ #endif
#endif
#endif // SkDiscardableMemoryPool_DEFINED
#include "SkTArray.h"
#include "PdfRenderer.h"
#include "picture_utils.h"
+#include "LazyDecodeBitmap.h"
__SK_FORCE_IMAGE_DECODER_LINKING;
return false;
}
- SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream));
+ SkAutoTUnref<SkPicture> picture(
+ SkPicture::CreateFromStream(
+ &inputStream, &sk_tools::LazyDecodeBitmap));
if (NULL == picture.get()) {
SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str());