summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-22 21:38:35 +0000
committerscroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-22 21:38:35 +0000
commitc720674dc5dfe3bdbd889c6a45038bbe57185d2e (patch)
treeaa8b8fe2bea2c6363d6e4653b4e5e135cbe25ead
parent2da0220e12010bd581861fd1f07f16b7f7d554da (diff)
downloadgyp-c720674dc5dfe3bdbd889c6a45038bbe57185d2e.tar.gz
Create SkLazyPixelRef which performs lazy decoding.
The new pixel ref behaves similarly to SkImageRef, with some key differences: It does not depend on the images project. It requires an SkImageCache, which handles allocation and caching of the pixel memory. It takes a function signature for decoding which decodes into already allocated pixel memory rather than into an SkBitmap. Add two implementations of SkImageCache: SkLruImageCache and SkAshmemImageCache. Replace SkSerializationHelpers::DecodeBitmap with SkPicture::InstallPixelRefProc, and update sites that referenced it. SkBitmapFactory now sets the pixel ref to a new object of the new class SkLazyPixelRef, provided it has an SkImageCache for caching. Provide an option to do lazy decodes in render_pictures and bench_pictures. SkPicture: Eliminate the default parameters in the constructor. If a proc for decoding bitmaps is installed, use it to decode any encoded data in subpictures. When parsing deserializing subpictures, check for success. When serializing subpictures, pass the picture's bitmap encoder to the subpicture's call to serialize. Update BitmapFactoryTest to test its new behavior. BUG=https://code.google.com/p/skia/issues/detail?id=1008 BUG=https://code.google.com/p/skia/issues/detail?id=1009 Review URL: https://codereview.appspot.com/7060052 git-svn-id: http://skia.googlecode.com/svn/trunk/gyp@7835 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--animator.gyp7
-rw-r--r--core.gyp2
-rw-r--r--core.gypi10
-rw-r--r--images.gyp6
-rw-r--r--ports.gyp3
-rw-r--r--tests.gyp1
-rw-r--r--views.gyp9
-rw-r--r--views_animated.gyp13
8 files changed, 36 insertions, 15 deletions
diff --git a/animator.gyp b/animator.gyp
index 942e849..a462ca4 100644
--- a/animator.gyp
+++ b/animator.gyp
@@ -10,14 +10,15 @@
'type': 'static_library',
'standalone_static_library': 1,
'include_dirs': [
+ '../include/animator',
'../include/config',
'../include/core',
'../include/effects',
- '../include/animator',
+ '../include/images',
+ '../include/lazy',
+ '../include/utils',
'../include/views',
'../include/xml',
- '../include/utils',
- '../include/images',
'../src/utils',
],
'sources': [
diff --git a/core.gyp b/core.gyp
index 7e7640c..76994e1 100644
--- a/core.gyp
+++ b/core.gyp
@@ -15,6 +15,7 @@
'include_dirs': [
'../include/config',
'../include/core',
+ '../include/lazy',
'../include/pipe',
'../include/ports',
'../include/utils',
@@ -106,6 +107,7 @@
'config',
'../include/config',
'../include/core',
+ '../include/lazy',
'../include/pipe',
'ext',
],
diff --git a/core.gypi b/core.gypi
index d5f76a3..9831bbb 100644
--- a/core.gypi
+++ b/core.gypi
@@ -281,6 +281,16 @@
'<(skia_include_path)/core/SkWeakRefCnt.h',
'<(skia_include_path)/core/SkWriter32.h',
'<(skia_include_path)/core/SkXfermode.h',
+
+ # Lazy decoding:
+ '<(skia_include_path)/lazy/SkBitmapFactory.h',
+ '<(skia_include_path)/lazy/SkImageCache.h',
+ '<(skia_include_path)/lazy/SkLruImageCache.h',
+
+ '<(skia_src_path)/lazy/SkBitmapFactory.cpp',
+ '<(skia_src_path)/lazy/SkLazyPixelRef.h',
+ '<(skia_src_path)/lazy/SkLazyPixelRef.cpp',
+ '<(skia_src_path)/lazy/SkLruImageCache.cpp',
],
}
diff --git a/images.gyp b/images.gyp
index 8c4690e..2f007ff 100644
--- a/images.gyp
+++ b/images.gyp
@@ -16,9 +16,11 @@
'../include/config',
'../include/core',
'../include/images',
+ '../include/lazy',
+ # for access to SkImagePriv.h
+ '../src/image/',
],
'sources': [
- '../include/images/SkBitmapFactory.h',
'../include/images/SkImageDecoder.h',
'../include/images/SkImageEncoder.h',
'../include/images/SkImageRef.h',
@@ -29,7 +31,6 @@
'../src/images/bmpdecoderhelper.cpp',
'../src/images/bmpdecoderhelper.h',
- '../src/images/SkBitmapFactory.cpp',
'../src/images/SkFDStream.cpp',
'../src/images/SkImageDecoder.cpp',
'../src/images/SkImageDecoder_Factory.cpp',
@@ -136,6 +137,7 @@
'direct_dependent_settings': {
'include_dirs': [
'../include/images',
+ '../include/lazy',
],
},
},
diff --git a/ports.gyp b/ports.gyp
index 219bf3e..814441a 100644
--- a/ports.gyp
+++ b/ports.gyp
@@ -155,12 +155,15 @@
'../src/ports/SkDebug_stdio.cpp',
],
'sources': [
+ '../include/ports/SkAshmemImageCache.h',
+
'../src/ports/SkDebug_android.cpp',
'../src/ports/SkThread_pthread.cpp',
'../src/ports/SkFontHost_android.cpp',
'../src/ports/SkFontHost_FreeType.cpp',
'../src/ports/SkFontHost_FreeType_common.cpp',
'../src/ports/FontHostConfiguration_android.cpp',
+ '../src/ports/SkAshmemImageCache.cpp',
],
'dependencies': [
'freetype.gyp:freetype',
diff --git a/tests.gyp b/tests.gyp
index 247148b..6362352 100644
--- a/tests.gyp
+++ b/tests.gyp
@@ -10,6 +10,7 @@
'include_dirs' : [
'../src/core',
'../src/effects',
+ '../src/lazy',
'../src/pdf',
'../src/pipe/utils',
'../src/utils',
diff --git a/views.gyp b/views.gyp
index b0697a0..aca3bb3 100644
--- a/views.gyp
+++ b/views.gyp
@@ -14,12 +14,13 @@
'include_dirs': [
'../include/config',
'../include/core',
- '../include/views',
- '../include/xml',
- '../include/utils',
- '../include/images',
'../include/effects',
+ '../include/images',
+ '../include/lazy',
+ '../include/utils',
+ '../include/views',
'../include/views/unix',
+ '../include/xml',
],
'dependencies': [
'angle.gyp:*',
diff --git a/views_animated.gyp b/views_animated.gyp
index 1767fe1..29e981d 100644
--- a/views_animated.gyp
+++ b/views_animated.gyp
@@ -6,16 +6,17 @@
'target_name': 'views_animated',
'type': 'static_library',
'include_dirs': [
+ '../include/animator',
'../include/config',
'../include/core',
- '../include/views',
- '../include/xml',
- '../include/utils',
- '../include/images',
- '../include/animator',
'../include/effects',
- '../include/views/unix',
+ '../include/images',
+ '../include/lazy',
+ '../include/utils',
+ '../include/views',
'../include/views/animated',
+ '../include/views/unix',
+ '../include/xml',
],
'sources': [
'../include/views/animated/SkBorderView.h',