Eliminate the check for ANDROID_LARGE_MEMORY in jpeg decoders
BUG=skia:1282 Review URL: https://codereview.chromium.org/1103313002
This commit is contained in:
parent
8d0d2b8577
commit
78d79cc575
@ -196,18 +196,6 @@ def write_android_mk(target_dir, common, deviations_from_common):
|
||||
|
||||
f.write('LOCAL_ARM_MODE := thumb\n')
|
||||
|
||||
# need a flag to tell the C side when we're on devices with large memory
|
||||
# budgets (i.e. larger than the low-end devices that initially shipped)
|
||||
# On arm, only define the flag if it has VFP. For all other architectures,
|
||||
# always define the flag.
|
||||
f.write('ifeq ($(TARGET_ARCH),arm)\n')
|
||||
f.write('\tifeq ($(ARCH_ARM_HAVE_VFP),true)\n')
|
||||
f.write('\t\tLOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE\n')
|
||||
f.write('\tendif\n')
|
||||
f.write('else\n')
|
||||
f.write('\tLOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE\n')
|
||||
f.write('endif\n\n')
|
||||
|
||||
f.write('# used for testing\n')
|
||||
f.write('#LOCAL_CFLAGS += -g -O0\n\n')
|
||||
|
||||
|
@ -42,14 +42,6 @@ ifneq ($(strip $(TARGET_FDO_CFLAGS)),)
|
||||
endif
|
||||
|
||||
LOCAL_ARM_MODE := thumb
|
||||
ifeq ($(TARGET_ARCH),arm)
|
||||
ifeq ($(ARCH_ARM_HAVE_VFP),true)
|
||||
LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
|
||||
endif
|
||||
else
|
||||
LOCAL_CFLAGS += -DANDROID_LARGE_MEMORY_DEVICE
|
||||
endif
|
||||
|
||||
# used for testing
|
||||
#LOCAL_CFLAGS += -g -O0
|
||||
|
||||
|
@ -27,23 +27,6 @@ static void output_message(j_common_ptr info) {
|
||||
print_message(info, "output_message");
|
||||
}
|
||||
|
||||
/*
|
||||
* Choose the size of the memory buffer on Android
|
||||
*/
|
||||
static void overwrite_mem_buffer_size(jpeg_decompress_struct* dinfo) {
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
|
||||
// Use 30 MB for devices with a large amount of system memory and 5MB otherwise
|
||||
// TODO: (msarett) This matches SkImageDecoder. Why were these values chosen?
|
||||
#ifdef ANDROID_LARGE_MEMORY_DEVICE
|
||||
dinfo->mem->max_memory_to_use = 30 * 1024 * 1024;
|
||||
#else
|
||||
dinfo->mem->max_memory_to_use = 5 * 1024 * 1024;
|
||||
#endif
|
||||
|
||||
#endif // SK_BUILD_FOR_ANDROID
|
||||
}
|
||||
|
||||
bool JpegDecoderMgr::returnFalse(const char caller[]) {
|
||||
print_message((j_common_ptr) &fDInfo, caller);
|
||||
return false;
|
||||
@ -89,7 +72,6 @@ void JpegDecoderMgr::init() {
|
||||
jpeg_create_decompress(&fDInfo);
|
||||
fInit = true;
|
||||
fDInfo.src = &fSrcMgr;
|
||||
overwrite_mem_buffer_size(&fDInfo);
|
||||
fDInfo.err->emit_message = &emit_message;
|
||||
fDInfo.err->output_message = &output_message;
|
||||
}
|
||||
|
@ -57,22 +57,6 @@ SK_CONF_DECLARE(bool, c_suppressJPEGImageDecoderErrors,
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void overwrite_mem_buffer_size(jpeg_decompress_struct* cinfo) {
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
/* Check if the device indicates that it has a large amount of system memory
|
||||
* if so, increase the memory allocation to 30MB instead of the default 5MB.
|
||||
*/
|
||||
#ifdef ANDROID_LARGE_MEMORY_DEVICE
|
||||
cinfo->mem->max_memory_to_use = 30 * 1024 * 1024;
|
||||
#else
|
||||
cinfo->mem->max_memory_to_use = 5 * 1024 * 1024;
|
||||
#endif
|
||||
#endif // SK_BUILD_FOR_ANDROID
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void do_nothing_emit_message(jpeg_common_struct*, int) {
|
||||
/* do nothing */
|
||||
}
|
||||
@ -84,7 +68,6 @@ static void initialize_info(jpeg_decompress_struct* cinfo, skjpeg_source_mgr* sr
|
||||
SkASSERT(cinfo != NULL);
|
||||
SkASSERT(src_mgr != NULL);
|
||||
jpeg_create_decompress(cinfo);
|
||||
overwrite_mem_buffer_size(cinfo);
|
||||
cinfo->src = src_mgr;
|
||||
/* To suppress warnings with a SK_DEBUG binary, set the
|
||||
* environment variable "skia_images_jpeg_suppressDecoderWarnings"
|
||||
|
Loading…
Reference in New Issue
Block a user