|
API for an image cache, plus two implementations.
Provides an image cache independent from the pixel ref.
SkImageCache:
Pure abstract class representing an API for a pixelRef to get its
pixels from an image cache.
SkImageCacheImpl:
A simple image cache implementation for testing purposes.
SkAshmemImageCache:
An implementation of SkImageCache that uses ashmem.
TODO: Provide the ability to purge all data manually.
SkImageRef:
Provide a constructor to create a new SkImageRef from an SkData.
Remove a private, unused function with no implementation.
Take advantage of SkPixelRef's ring buffer of mutexes, so that
multiple SkImageRefs can be decoded simultaneously.
Return false for whether an SkImageRef's pixels can be written to
and mark them as immutable, since an SkImageRef should always get
its pixels from its encoded data.
SkImageRefPool:
Remove unused function.
SkImageRef_GlobalPool:
Add a constructor that takes an SkData.
Since SkImageRefs no longer share a global mutex, create a single
one that controls access to the GlobalPool.
SkLazyImageRef:
A new subclass of SkImageRef which gets its pixel memory from an
SkImageCache.
SkBitmapFactory:
Provide an option to supply an SkImageCache, which will be
attached to an SkLazyImageRef on the returned SkBitmap, so the
client can determine how to handle caching the pixels.
Set the returned SkBitmaps as immutable, allowing for shallow
copies that do the right thing. For example, if an SkBitmap
generated by the factory that caches its data is drawn to an
SkPicture, the picture will store the SkPixelRef which handles
the caching (rather than doing a deep copy).
SkThread_platform:
Remove SK_DECLARE_GLOBAL_MUTEX, which is no longer used.
SkStream:
Add a MemoryStream that takes an SkData as a parameter.
Make sure that setting an SkMemoryStream's data to NULL does not
result in a crash later by using NewEmpty.
gm/:
Provide a public function to access the resource path so it can be
used by Samples.
Move common code for appending a slash to the resource path to a
common location.
SamplePicture:
Use a resource from the resource folder, if the folder is specified.
Use SkBitmapFactory to create an SkBitmap from the encoded data.
SkBitmapFactoryTest:
Test that the pixels are not allocated until they are needed, and
that they get purged when necessary.
TODO: Add a test for failed decoding.
TODO: Add test for multi threading.
SkStreamTest:
Verify that setting an SkMemoryStream's data to NULL does not result
in a crash later.
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+853 lines, -88 lines) |
Patch |
 |
M |
gm/cmykjpeg.cpp
|
View
|
|
1 chunk |
+0 lines, -3 lines |
0 comments
|
Download
|
 |
M |
gm/factory.cpp
|
View
|
|
1 chunk |
+0 lines, -3 lines |
0 comments
|
Download
|
 |
M |
gm/gm.h
|
View
|
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
 |
M |
gyp/images.gyp
|
View
|
|
1 chunk |
+6 lines, -0 lines |
0 comments
|
Download
|
 |
M |
gyp/ports.gyp
|
View
|
|
1 chunk |
+2 lines, -0 lines |
0 comments
|
Download
|
 |
M |
include/core/SkStream.h
|
View
|
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
 |
M |
include/core/SkThread_platform.h
|
View
|
|
3 chunks |
+1 line, -5 lines |
0 comments
|
Download
|
 |
M |
include/images/SkBitmapFactory.h
|
View
|
|
2 chunks |
+6 lines, -5 lines |
0 comments
|
Download
|
 |
A |
include/images/SkImageCache.h
|
View
|
|
1 chunk |
+62 lines, -0 lines |
0 comments
|
Download
|
 |
A |
include/images/SkImageCacheImpl.h
|
View
|
|
1 chunk |
+132 lines, -0 lines |
0 comments
|
Download
|
 |
M |
include/images/SkImageRef.h
|
View
|
|
4 chunks |
+12 lines, -1 line |
0 comments
|
Download
|
 |
M |
include/images/SkImageRef_GlobalPool.h
|
View
|
|
1 chunk |
+6 lines, -1 line |
0 comments
|
Download
|
 |
A |
include/images/SkLazyImageRef.h
|
View
|
|
1 chunk |
+70 lines, -0 lines |
0 comments
|
Download
|
 |
A |
include/ports/SkAshmemImageCache.h
|
View
|
|
1 chunk |
+46 lines, -0 lines |
0 comments
|
Download
|
 |
M |
samplecode/SamplePicture.cpp
|
View
|
|
2 chunks |
+13 lines, -8 lines |
0 comments
|
Download
|
 |
M |
src/core/SkStream.cpp
|
View
|
|
2 chunks |
+12 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/images/SkBitmapFactory.cpp
|
View
|
|
2 chunks |
+16 lines, -1 line |
0 comments
|
Download
|
 |
A |
src/images/SkImageCacheImpl.cpp
|
View
|
|
1 chunk |
+154 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/images/SkImageRef.cpp
|
View
|
|
7 chunks |
+25 lines, -17 lines |
0 comments
|
Download
|
 |
M |
src/images/SkImageRefPool.h
|
View
|
|
1 chunk |
+0 lines, -1 line |
0 comments
|
Download
|
 |
M |
src/images/SkImageRefPool.cpp
|
View
|
|
1 chunk |
+0 lines, -19 lines |
0 comments
|
Download
|
 |
M |
src/images/SkImageRef_GlobalPool.cpp
|
View
|
|
4 chunks |
+18 lines, -20 lines |
0 comments
|
Download
|
 |
A |
src/images/SkLazyImageRef.cpp
|
View
|
|
1 chunk |
+107 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/ports/SkAshmemImageCache.cpp
|
View
|
|
1 chunk |
+92 lines, -0 lines |
0 comments
|
Download
|
 |
M |
tests/BitmapFactoryTest.cpp
|
View
|
|
3 chunks |
+44 lines, -4 lines |
0 comments
|
Download
|
 |
M |
tests/StreamTest.cpp
|
View
|
|
1 chunk |
+15 lines, -0 lines |
0 comments
|
Download
|
|