History log of /frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
152d7282a42cd7130648f373775fe75d319557f2 06-Jan-2015 Vladimir Marko <vmarko@google.com> Check for OOM in BitmapFactory's getMimeTypeString().

Bug: 18909596

(cherry picked from commit 7ab249a18e08bfefb8c2d60af1fb668c67ba4368)

Change-Id: Ie7be228442876d47faf37e3f664e378253dab6e3
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
14494262d39964ccd7f0fbac43f45ac2ea1eb224 17-Oct-2014 Leon Scroggins III <scroggo@google.com> Decoder only returns true on complete success.

Recently we added a way for SkImageDecoder::decode to distinguish
between successfully decoding the entire image and only partially
decoding the image (see https://codereview.chromium.org/647023006).

Only consider a call to decode() a success if the image was completely
decoded. This matches pre-L behavior, and lets the caller know that
they need to try to decode again.

Requires a change to external/skia (I33e6940e247b74b20361ae041f8d36eb600df49f)

BUG:17419670
Change-Id: I17ed7288b2359fafaec9551adb16d1d037800eb7
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
5cb769d99952ef9fb4f576abba70423fe157342b 24-Sep-2014 Derek Sollenberger <djsollen@google.com> Fix memory leak where we close the descriptor instead of the file.

bug: 17541634
Change-Id: I9968f9df249e4cba24383239ce6130dd16fcd532
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
d29c902f9822ab4b11dd4b91729c64d6987cdf29 26-Sep-2014 Jérôme Poichet <jpoichet@google.com> Revert "Fix memory leak where we close the descriptor instead of the file."

This reverts commit 1503ebd95fc82b1ae6ec8b006e62a9f6109973fa.

Change-Id: Id40cf34821ea244b1a838079bd147bc845b96cb3
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
1b99187253fcb03698a7db71394ff8a900ce56a6 24-Sep-2014 Derek Sollenberger <djsollen@google.com> Fix memory leak where we close the descriptor instead of the file.

bug: 17541634
Change-Id: I842176213e0547dd737ef6e0b83c320a5cc32219
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
a08d10fa7051668b629d561bb8411e34d28fdabf 30-Aug-2014 Mathieu Chartier <mathieuc@google.com> Add missing null check to ninePatchInsets

ninePatchInsets could be null after allocation, this possibly caused
a SIGABRT in GC or check_jni failure.

Bug: 17323232

Change-Id: Icd7e3819032e8e999d3c1483bf261bb39b3fe9e4
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
bd8db2e87e16900ff9b87937d3ccff6a50bd5b2a 21-Aug-2014 Chris Craik <ccraik@google.com> Add bounds checking to nine patch scaling

bug:17114103

Better handle the case, when scaling the divs in a nine patch, where
divs fall outside of the bounds of the bitmap.

Change-Id: I244b9c45b938c2a15f29e4563a86825ee9439b5f
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
77b5cad3efedd20f2b7cc14d87ccce1b0261960a 31-Jul-2014 Chris Craik <ccraik@google.com> Add outline alpha

bug:16140822
bug:16566746

This allows background drawables to alter the opacity of a shadow
being cast with their own alpha values.

Change-Id: I49698cc7c1bf4b2b55ffe2f82899543ca62bc61c
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
47cd8e921db73e894f94ec4729ade90da50996f5 09-Jul-2014 Chris Craik <ccraik@google.com> Implement outline support for nine patches

b/15856895

Nine patches now have outline round rect metadata stored as optional
png tags. aapt generates these automatically by inspecting the bitmap
pixels to estimate outline bounds and round rect radius, based on
opacity.

Change-Id: I226e328a97873010d9e1adb797ac48f93a31183c
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
42a1d08df7d417fd4e67eabc91ff05ee77fd9995 08-Jul-2014 Mike Reed <reed@google.com> SkBitmap::Config is deprecated, use SkColorType

Change-Id: Ida181d2aac760072cf2d01409edac37699dea216
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
4a9c3891d4f890109e02bc83fecf9bcdf56a9395 07-Jul-2014 Mike Reed <reed@google.com> kNative_8888_SkColorType is now kN32_SkColorType

Change-Id: I13421a21de611203c62c1c1c36570a8cc803907b
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c054966b719c8a7255f7cf4120cca5050acb68bd 04-Jul-2014 Alan Viverette <alanv@google.com> Make optical insets actually work

Change-Id: I9fabf4cb939cc7a868f95580e7229745acde0418
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b933055cf3f7f8ea89bfd3bc9c37a3891ff7310a 16-Jun-2014 Mike Reed <reed@google.com> stop using (deprecated) SkBitmap::Config

Change-Id: Ic75b5fc6996578e9d95bd3a220439ec1541d7c3b
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
0aa39dc2dcfca20f4d9cbeb1699d48a4808f2c70 03-Jun-2014 Leon Scroggins III <scroggo@google.com> Ignore inPurgeable and inInputShareable.

These are discouraged anyway, due to the fact that using them may
result in decoding on the UI thread. Now that they are ignored, the
images will still be decoded; they just will never have their
memory purged, meaning there could be a RAM penalty. This is
acceptable, since apps are encouraged to instead use inBitmap to
manage bitmap memory.

This incidentally fixes BUG:15390468 by converting purgeable index8
(e.g. gif) images to non purgeable.

Change-Id: Ieaf3ab25d28d93fb94bdaea1eb3bd762f163b09a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
28408c23958bb14d296574853d8a576177a36a5b 27-May-2014 Leon Scroggins III <scroggo@google.com> Remove call to deprecated SkBitmap::asImageInfo.

Instead, call SkBitmap::info().

Change-Id: Ib6e56c6e103afa5748405574043860449c33c467
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
cc11f15f76a62ded3e403cb2bc818c6aa5bf261c 31-Mar-2014 Leon Scroggins <scroggo@google.com> Update to call new Skia APIs.

I816129d49c0118453222916f3c818eccac33663d merges a new version of
Skia that updates various APIs. Call the new ones.

SkBitmap::copyTo now takes an SkColorType instead of an
SkBitmap::Config, so do the conversion with
SkBitmapConfigToColorType or use the enum when it makes sense.

Call SkImageDecoder::decodeSubset instead of (deprecated)
SkImageDecoder::decodeRegion.

Override SkCanvas::ClipVisitor::clipRRect in ClipCopier.

In Canvas::clip calls, call SkCanvas::isClipEmpty(), which was
previously called inside the clip call, to determine the return value.

For various SkPaint effects, call the new factories (as the constructors
have been made protected).

Implement SkJavaOutputStream::bytesWritten(), overriding a new pure
virtual function on SkWStream.

Update Matrix calls to always return true (since SkMatrix calls no
longer return a value).

Depends on I816129d49c0118453222916f3c818eccac33663d (skia).

Change-Id: I5cdcea827ebff587df0bbddc0965e3e0fbf48002
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
46cb9bdbf56b27cbf2ab878b41d21e30896a4fea 06-Mar-2014 Leon Scroggins <scroggo@google.com> Update framework to use M34 version of Skia.

These changes are needed due to changes in the Skia API.

Depends on https://googleplex-android-review.git.corp.google.com/#/c/439626/1
(Ic3cf846b74d6f10ec30c477b50fd774cc30ad52c)

BitmapFactory.cpp:
Use SkColorType instead of SkBitmap::Config, where possible.
Call SkBitmap::info() instead of deprecated SkBitmap::asImageInfo().
Remove calls to deprecated SkBitmap::getSize64().

Canvas.cpp:
ColorFilter.cpp:
Matrix.cpp
Remove the deprecated SK_SCALAR_IS_FIXED path. Leave in an else case for
SK_SCALAR_IS_FLOAT, to allow for eventual SK_SCALAR_IS_DOUBLE path.

Graphics.cpp:
Like in BitmapFactory.cpp, use new methods for determining the size of
pixels.

Paint.cpp:
Use more precise SkScalar_ToInt versions of macros.

TextLayoutCache.cpp:
Fix bug in macro definition for HB_SurrogateToUcs4.
Use the new name for SkCreateTypefaceForScriptNG.

android_view_SurfaceControl.cpp:
Replace ScreenshotPixelRef with a Skia pixel ref.

This is a merge from master-skia branch:
https://googleplex-android-review.git.corp.google.com/#/c/430554/
(Ie11503bcefd3883c466279fde5ce147c8a72b452)

Change-Id: Idf15746f93dabeb7862ac02cc6bd925f0dcc68ba
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
42a51ae8812bccde7ff370cc2688f7955e489ad4 11-Mar-2014 Narayan Kamath <narayan@google.com> Fix scaleNinePatch.

Use yDivs for yDivs, and not xDivs.

bug: 13394494
Change-Id: I4ca5fe33cf61922a894f071927ef08b2d7db7dd0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b5c4e7fd3866bbe30d7ea4d7bc463da5a70970e2 10-Mar-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 92860a74 to master

Change-Id: I3036ef9f1251c756092dc5ee2c4fed8146855e1e
6381dd4ff212a95be30d2b445d40ff419ab076b4 03-Mar-2014 Narayan Kamath <narayan@google.com> LP64: Make 9 patches architecture agnostic.

The Res_png_9patch struct had several pointer members
whose size differed between 32 and 64 bit platforms.

These members have been replaced by uint32_t offsets
to serialized data. The serialized form for 9patches
places a Res_png_9patch object at the beginning of
serialized data, followed by int32_t arrays of xDivs,
yDivs and colors.

Note that these offsets are not strictly required,
since they can be computed from the values of numXDivs,
numYDivs & numColors, however they are called in tight
loops so having them computed once is a beneficial.

This change also removed the unused patch_equals function
from aapt's Image.cpp.

Change-Id: I3b9ac8ae5c05510d41377cae4dff1c69b40c2531
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b644a3b84521e2155a5af985a4d4ed305474e567 17-Jan-2014 Derek Sollenberger <djsollen@google.com> Updates to the Skia API needed to merge the WebView m33 version of Skia.

This is a cherry-pick of 2 CLs:

21969a2b26945da3fd86aef7c93479e4fb359a65
c7a581cf7691db5c61e6694aa51daaa994004bd9

Change-Id: I6fd9366fbba0a336de1df794be9497983bfd13ae
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2826e5f20295a1adb3b341c8b32f27d748e2ee19 06-Feb-2014 Leon Scroggins III <scroggo@google.com> Decode file descriptor from the correct offset.

Fix a few bugs in nativeDecodeFileDescriptor:
1. Restore the FD's offset when exiting the function.
2. Copy the data when potentially using an SkImageRef.
The old behavior would have continued to modify the
file descriptor's offset each time a new decode was
required. The copy ensures that the file descriptor
remains unchanged.
3. Buffer the file stream.
Prior to this change, if the image was not a PNG,
the stream would be rewound to the beginning of the
file, even if the file descriptor was passed in with
an offset. Thanks to the buffer, the stream is only
rewound to the original offset.

Depends on https://googleplex-android-review.googlesource.com/#/c/415821/1
in external/skia

BUG:12807677
BUG:12895876
Change-Id: I38b8cf5d210dbbc0107e6562e3884867de57fc4b
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
a0398430fcf365fba6e42ad0bdca2fbf45ed6fe0 20-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make graphics classes 64-bit compatible

Changes in this patch include

[x] Long is used to store native pointers as they can
be 64-bit.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
yet. Specifically mAtlasMap member has to be converted
to hold native pointer using long. Added a TODO to
AssetAtlasManager.java to indicate the change required.

Change-Id: I940433f601c6db998c1a8ffff338f5361200d5ed
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
36bef0bf30d6bae48cf3837df351075ca4fce654 20-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make graphics classes 64-bit compatible

This a merger of two commits submitted to AOSP by
the following authors:

ashok.bhat@arm.com, david.butcher@arm.coma
craig.barber@arm.com, kevin.petit@arm.com and
marcus.oakland@arm.com

Due to the very large number of internal conflicts, I
have chosen to cherry-pick this change instead
of letting it merge through AOSP because the merge
conflict resolution would be very hard to review.

Commit messages below:

================================================
AArch64: Make graphics classes 64-bit compatible

Changes in this patch include

[x] Long is used to store native pointers as they can
be 64-bit.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
yet. Specifically mAtlasMap member has to be converted
to hold native pointer using long. Added a TODO to
AssetAtlasManager.java to indicate the change required.

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

==================================================================

AArch64: Use long for pointers in graphics/Camera

For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

===================================================================

Change-Id: Id5793fa0ebc17ee8b1eecf4b3f327977fdccff71
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
7023df08f14ec5dee76ac54c03e870f84e297636 27-Jan-2014 Narayan Kamath <narayan@google.com> Revert "AArch64: Make graphics classes 64-bit compatible"

This reverts commit 18b4cbeedef21c1fa666a110a157bab66edff976.

Change-Id: I0c52983a3ab1ace3ff743de546a43eca28e5cb0e
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
18b4cbeedef21c1fa666a110a157bab66edff976 20-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make graphics classes 64-bit compatible

This a merger of two commits submitted to AOSP by
the following authors:

ashok.bhat@arm.com, david.butcher@arm.coma
craig.barber@arm.com, kevin.petit@arm.com and
marcus.oakland@arm.com

Due to the very large number of internal conflicts, I
have chosen to cherry-pick this change instead
of letting it merge through AOSP because the merge
conflict resolution would be very hard to review.

Commit messages below:

================================================
AArch64: Make graphics classes 64-bit compatible

Changes in this patch include

[x] Long is used to store native pointers as they can
be 64-bit.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
yet. Specifically mAtlasMap member has to be converted
to hold native pointer using long. Added a TODO to
AssetAtlasManager.java to indicate the change required.

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

==================================================================

AArch64: Use long for pointers in graphics/Camera

For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

===================================================================

Change-Id: Ib3eab85ed97ea3e3c227617c20f8d213f17d4ba0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
0102f8a87a7571b1ff537a1293d67ae8fa001167 14-Jan-2014 Leon Scroggins III <scroggo@google.com> In nativeDecodeFileDescriptor, use fdopen.

Instead of attempting to mmap the entire file, create an
SkFILEStream from a FILE.

BUG:11669944
BUG:11028218
Change-Id: If67da91484acc79f9f3dde6d05201409c0c75e41
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
8790be6de3644e332ec6a17c855da89ffc13a9bf 03-Dec-2013 Leon Scroggins III <scroggo@google.com> Remove calls to deprecated SkBitmap::setIsOpaque()

setIsOpaque() has been removed from ToT Skia.

Update setters for mIsPremultiplied and hasAlpha to take the
other into consideration.

Change-Id: I1b36b0b0ce7126031eb7b769b563c17dcd4b306a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b9c58ab617c257dbece105167b21e94faad67320 03-Dec-2013 Leon Scroggins III <scroggo@google.com> Merge AssetStream with AssetStreamAdaptor.

Add enums to the constructor for AssetStreamAdaptor to choose the
different behaviors used by the (former) two different classes.

The old clients of AssetStream now get the following features of
AssetStreamAdaptor
- Debugging statements on error.
- The stream is an SkStreamRewindable.
- getLength() returns the correct value, and the old way of getting
the length (read(NULL, 0)) is no longer implemented, since it is
no longer used.
- isAtEnd() returns the correct value. ToT Skia makes it pure virtual,
so some implementation is necessary.

Change-Id: I2a5395914e4f53830aaefee396556459083a1c56
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
4b9a19a8f865970e0079f431c8c2c2a8e4333ae9 03-Dec-2013 Leon Scroggins III <scroggo@google.com> Call SkBitmap::config() instead of ::getConfig()

getConfig() has been deprecated.

Change-Id: I32066256ab82ac4760c752c80856d1b56d291fae
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f65183fd76aa82eedaebcbde9395a5dba42fc969 07-Oct-2013 Leon Scroggins III <scroggo@google.com> Do not attempt to decode NULL SkData.

NewFromFD fails if mmap fails. In that case, it returns a NULL
SkData. SkMemoryStream handles NULL input by calling SkData::NewEmpty,
which is not threadsafe. If the SkMemoryStream were to get some
busted SkData, its call to read might fail. Sidestep this problem
by not creating the SkMemoryStream if the SkData is NULL, skipping
the call to SkData::NewEmpty.

BUG:11028218
Change-Id: Id70299bef1c85ffb5d17102fdb5ea071b0bee68a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
1ffe727c0616ca11092a45c3dfb94479fe55fdd9 19-Sep-2013 Leon Scroggins III <scroggo@google.com> Skip writing zeroes to java allocated memory.

If pixel memory was just allocated by Java, tell our decoders not
to write 0s, since the memory was initialized to 0. Likewise,
when drawing to a bitmap with memory just allocated by Java, do
not erase to 0.

Depends on a change to external/skia to add the new option on
image decoders:
https://googleplex-android-review.git.corp.google.com/362663

BUG:10016979
Change-Id: I9a3dc969870f8516e7d8495fe96d0a6b8225eda2
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
7315f1baee19476363235127bc1438e2a291fa15 11-Sep-2013 Leon Scroggins III <scroggo@google.com> Use a native buffer for decoding images.

Fixes BUG:10725383

Depends on https://googleplex-android-review.git.corp.google.com/#/c/357300/
in external/skia.

In the previous fix for BUG:8432093 and BUG:6493544
(https://googleplex-android-review.googlesource.com/#/c/346191/),
instead of calling mark on the provided input stream, we
copied the entire stream in native code (except in one case;
more details below), allowing rewind no matter how much of
the stream had been read. This was because two decoders
may rewind after reading an arbitrary amount of the stream:
SkImageDecoder_wbmp and SkImageDecoder_libjpeg.

It turns out that the jpeg decoder does not need this rewind
after arbitrary length (it is a failure recovery case, and
libjpeg has a default recovery we can use - the above referenced
CL in Skia uses the default).

Although the wbmp decoder could read any amount given a
stream with the "right" data, and then return false, such a
stream would not be a valid stream of another format, so it
is okay for this rewind to fail.

Further, the previous fix was inefficient in the common case
where the caller decodes just the bounds, resets, then decodes
the entire image (since we have copied the entire stream twice).
The copy also resulted in the crashes seen in BUG:10725383.

In this CL, buffer only the amount of input needed by
SkImageDecoder::Factory to determine the type of image decoder
needed. Do not mark the input stream provided by the caller,
so their mark (if any) can remain in tact. The new Skia class
SkFrontBufferedStream allows buffering just the beginning
of the stream.

core/jni/android/graphics/BitmapFactory.cpp:
Instead of calling GetRewindableStream (which has been removed),
call CreateJavaInputStreamAdaptor. Then wrap it in an
SkFrontBufferedStream, with a large enough buffer to determine
which type of image is used.

core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h:
core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp:
Remove mark, markSupported, and rewind. CreateJavaInputStreamAdaptor
now turns an SkStream which is not rewindable. If the caller
needs rewind that needs to be handled differently (for example,
by using SkFrontBufferedStream, as is done in BitmapFactory and
Movie.
Remove RewindableJavaStream and GetRewindableStream.
Remove code specific to ByteArrayInputStream, which makes slow
JNI calls. Instead, depend on the caller to buffer the input
in the general case. There is no reason to special case this
stream (especially since we already have decodeByteArray).
Remove CheckForAssetStream, which is now always special cased
in Java.

core/jni/android/graphics/Movie.cpp:
Call CreateJavaInputStreamAdaptor and use an SkFrontBufferedStream.
Add a native function for decoding an Asset, and remove old
call to CheckForAssetStream.

graphics/java/android/graphics/BitmapFactory.java:
Write a helper function for decoding a stream to consolidate
common code.
Buffer enough of the input so that SkImageDecoder::Factory
can rewind after having read enough to determine the type.
Unlike the old code, do NOT mark the caller's stream. This is
handled in native code. The caller's mark (if any) is left alone.

graphics/java/android/graphics/Movie.java:
Check for an Asset stream before passing to native, and
call a native function for handling the asset directly.

BUG:6493544
BUG:8432093
BUG:10725383

Change-Id: Ide74d3606ff4bb2a8c6cdbf11bae3f96696f331a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
cd0ba71aa942f35fcdb26808b86f20073b8aff92 06-Sep-2013 Chris Craik <ccraik@google.com> Create a pixelref wrapper for reused bitmaps

Reused bitmaps may gain a color table when reused, so we wrap a new
AndroidPixelRef that holds the color table around the old.

bug:10608305
Change-Id: I35288edf3158cfda21c500360ad1abdf5654af8d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ca32021b43f326af7d3f4ae041f8db297f98a518 20-Aug-2013 Leon Scroggins III <scroggo@google.com> Replace stream wrap-function w/ more specific ones

The current stream wrapper returns a potentially incorrect
value for a call to getLength(), is typically copied into
another stream (not always in the same way), and doesn't
always take advantage of its underlying data (like when it
is an Asset). The overall goal of this CL is to provide the
caller with something that is ready to use, depending on
what is asked for. If a copy is desired, the copy is made
before being returned to the caller.

core/jni/android/graphics/Bitmap.cpp:

Include SkStream.h, since it is no longer included by
CreateJavaOutputStreamAdaptor's header file.

core/jni/android/graphics/BitmapFactory.cpp:

Pass an SkStreamRewindable to decoding functions, as Skia
decoders will be updated to only take an SkStreamRewindable
(which makes more sense because they require rewinding).

Call the more specific GetRewindableStream to get a
rewindable stream.

Remove copyAssetToStream which has been moved to Utils.

In nativeDecodeAsset, pass forcePurgeable as allowPurgeable
in doDecode. Technically the old code worked, but it checked
the BitmapOptions again.

Remove getFDSize, which is no longer used.

core/jni/android/graphics/BitmapRegionDecoder.cpp:

Remove redundant buildSkMemoryStream. nativeNewInstanceFromStream
now calls CopyJavaInputStream, which handles the copy.

Copy the Asset directly, using common code, rather than creating
an AssetStreamAdaptor to copy.

core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp:
core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h:

Provide new interfaces to access data from a Java InputStream.
The new interfaces are more specific about what type of stream
is desired.

Use forward declarations where possible.

Remove doSize, which gives a misleading answer to the question
of how long the entire stream is.

TODO: Only call FindClass etc once.

core/jni/android/graphics/Movie.cpp:

Check for an asset stream, and use it if possible. Then call
GetRewindableStream if there is not an asset.
Remove the memory leak. Call DeleteLocalRef to delete the
allocated memory.

core/jni/android/graphics/Picture.cpp:

Call the new interface.

core/jni/android/graphics/Utils.cpp:
core/jni/android/graphics/Utils.h:

Make AssetStreamAdaptor inherit from SkStreamRewindable so it
can be passed to Skia decoding functions once they require it.

Add CopyAssetToStream (moved from BitmapFactory.cpp) so it can
be used by multiple files.

graphics/java/android/graphics/BitmapFactory.java:

Remove the call to mark, which is now done natively.

Remove the BufferedInputStream. Mark/reset is now handled
by native code.

Allow decodeStream to handle a FileInputStream by using the
FileDescriptor, if it is seekable. In decodeFileDescriptor,
call nativeDecodeStream instead of decodeStream so this new
functionality will not loop.

Call setDensityFromOptions in decodeFileDescriptor.

graphics/java/android/graphics/BitmapRegionDecoder.java:

Remove the BufferedInputStream. Mark/reset is now handled
by native code.

TODO: ADD TESTS!

Requires https://googleplex-android-review.googlesource.com/#/c/344317/

BUG=https://b.corp.google.com/issue?id=8432093

Change-Id: I4419b70b3482325c98ecc673dbfc4613f1b18581
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
1abf5d62429e5a9329520b2f7c2b5a5e7a8e72ec 16-Aug-2013 Chris Craik <ccraik@google.com> Add inPremutiplied option to BitmapFactory.Options, functionality in Bitmap

bug:2248948

Change-Id: I8fdd649332667598504a1076d5a447572bd53086
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
5827cb5059ed0eec4c73adf1acbd7ee47b2c5c8f 26-Jul-2013 Derek Sollenberger <djsollen@google.com> Changes needed to support Skia at r10377.

Change-Id: Id1e1c8c5938ee1a33c6fa3caabd2c28e89243eb4
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
d63ee7565211d9a5dd4251079e3073886562b6d6 15-Jul-2013 Chris Craik <ccraik@google.com> Merge "Add webp to BitmapFactory.Options outMimetype"
95587f9045443f8201d01db1d2bee8ae79edab8c 13-Jul-2013 Chris Craik <ccraik@google.com> Add webp to BitmapFactory.Options outMimetype

Change-Id: Id0d5b4d6c2c5b21fa0b31f1a5ada6275fdc38f44
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
787e35793f47abdb6cc10f328cd58d362c7bd250 12-Jul-2013 Romain Guy <romainguy@google.com> Trace bitmaps decoding

Also remove dead code

Change-Id: Ie931b21858ccbe6ee4def54caf028fd2aed23317
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
6b0437c2c7a552c8195956444facff3532e25c21 24-Jun-2013 Derek Sollenberger <djsollen@google.com> Fix SkASSERT errors resulting from the order objects are allocated
on the stack.

Change-Id: I24649fed5c069d8d3777d153e8fb31a55a9cf7a1
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
905e8246ef0bd20ee28d81ce3da0c5e5fc8e3913 05-Jun-2013 Chris Craik <ccraik@google.com> Add support for post-decode density scaling with reuse

Also, simplifies scaling path, removing java variant - we always do
the scaling in native, which has the benefit of avoiding non-native
temporary allocations

Change-Id: I39c2219f5d77a267719629704e65611cf4388a82
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
7e8c03c0fed64c73a4f0cfb96a2c6905b348a143 03-Jun-2013 Chris Craik <ccraik@google.com> Support all formats for BitmapFactory.Options.inBitmap

bug:9194265

Instead of using custom code in skia to avoid allocations, use a
custom allocator that reuses the allocations from the inBitmap.

In order to avoid inconsistent state, the decode is done in a
separate bitmap and swapped into the existing native bitmap.

Eventually, we'd like to support inScaled=true completely avoiding
java allocations.

Change-Id: Ic4a2f2373b100a80a32c1cdebb7bcb726711c8a7
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
9f58361e98be7386a4eadd3aa254e9b7d09d0a3b 21-May-2013 Chris Craik <ccraik@google.com> Support larger bitmaps in BitmapFactory.Options.inBitmap

bug:8121994

Adds a new distiction between bitmap size and the allocation
(pixel ref/buffer) used to store its data.

BitmapFactory.inBitmap will allow a bitmap to be reinitialized with
new data if the bitmap being decoded is (after sampleSize) equal or
smaller.

Change-Id: I747750a735c858882df3af74fca6cdc46f2a9f81
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
7f2e4efa96c6e3ab636c5e70b5fc09b0153d30e8 04-Feb-2013 Michael Jurka <mikejurka@google.com> am c24b1448: Merge "Don\'t mark recycled bitmaps as immutable"

# Via Android (Google) Code Review (1) and Michael Jurka (1)
* commit 'c24b14481527e2f87ddb3a156b8217d32c645b10':
Don't mark recycled bitmaps as immutable
afce5a4008c494f6384e1b6b2fb4f13d33e917cb 04-Feb-2013 Michael Jurka <mikejurka@google.com> Don't mark recycled bitmaps as immutable

Helps avoid Bitmap allocations in apps that use a
pool of bitmaps and recycle them

Change-Id: I787455a5207bf90d6ed9f1622e0f7f7e1a4a6704
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ca79cf69d09efa0c327e9b1237d86a119aea5da7 14-Aug-2012 Derek Sollenberger <djsollen@google.com> Update framework to support r5967 of Skia.

bug: 6906025
Change-Id: Iefdb830ec3aa2ab3472c1c142484a7aa21788a15
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
8cba91d0d1d900fe9cba2bfc73c4458016b4ff04 21-Sep-2012 Raph Levien <raph@google.com> am 8b0851ca: am 3034d451: Merge "Fix for native crash on image decode OOM" into jb-mr1-dev

* commit '8b0851caf26dfd5e1cc7798e5ff6c6adc3a5e92c':
Fix for native crash on image decode OOM
005bfc694d167b7da4b565a1c4de03592fdbe86e 21-Sep-2012 Raph Levien <raph@google.com> Fix for native crash on image decode OOM

When decoding an image with scaling, if the allocation of the bitmap
data for the scaled bitmap failed, we were just ignoring it and going
on. This was yielding strange native crashes (bug 7196860 and bug
7175536). This patch checks whether the allocation succeeds, and returns
a null bitmap if not.

Of course, if the app really is OOM because it's allocated too many
bitmaps, it'll still get the OOME, but that's a lot nicer than a native
crash or memory corruption.

Change-Id: I8384059ab11c2ab9e93e283b9438d79e6709b7b1
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2a6ecae93d4effa47827029d74f2136b5ae8558d 31-Aug-2012 Derek Sollenberger <djsollen@google.com> Fix Skia assertions where we were allowing immutable bitmaps to be written to.

bug: 7092330
Change-Id: I4a9d1d299244d46172562080c56c8360f5e4af02
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
053a82cc18b8ad9b6cb321b57893225411ccf146 10-Jul-2012 Romain Guy <romainguy@google.com> Properly resize paletted bitmaps when adjusting for density

If an app used a GIF file in the wrong density bucket, the auto-scaling
code would not properly resize the bitmap.

Change-Id: I28f6506a94b20d11b3ba53ac442abec2b92e093e
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
27d83834143c117cbc0d06147c4374553f26b683 10-May-2012 Jeff Brown <jeffbrown@google.com> Fix possible leak in bitmap decoding.

In one particular error case, we might exit the function without
destroying the bitmap.

Bug: 6467873 (tangentially related)
Change-Id: I3a213cc0a53023d9d0d2a080aed15774f4c4c10c
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b2fe3be4fffc9ff1bfbba0c450d64ccd6e6c4011 07-May-2012 Marco Nelissen <marcone@google.com> Fix crash when decoding bitmap

Externally reported crash when decoding corrupted .wmf file.
b/5048623

Change-Id: I1df0861cd36983cb4d1460caa221c54d3fc240af
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
76344241719384f160ee623554f66987d0fcae41 30-Apr-2012 Dianne Hackborn <hackbod@google.com> Fix scaling of layout bounds.

Change-Id: I9d8c8924900fed69030ee3e8d6decee89ca67820
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
8f8d9fb52c65e50a32babf67ef764e173d2a5473 26-Apr-2012 Romain Guy <romainguy@google.com> Keep opaque bitmaps opaque after scaling
Bug #6293845

Change-Id: If9e82993f4c9702244ddedb5667421a6fcc7a0c5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ec4a50428d5f26a22df3edaf7e5b08f41d5cb54b 04-Apr-2012 Amith Yamasani <yamasani@google.com> Embed layout padding in nine patch images

- Added a new custom PNG chunk that carries the layout padding ints.
- Extract the padding ticks from .9.png images and store in the chunk.
- Load the padding information at runtime into Bitmap and NinePatchDrawable.

- The new chunk is ordered first so that it doesn't cause a problem in older
versions of the platform.

Bug: 6087201

Change-Id: I5de46167a1d44b3ec21065b0c165e594b1dc8399
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
7b2f8b8fb7064a1d3b6d942b978c30c24c9d7299 20-Mar-2012 Romain Guy <romainguy@google.com> Pre-scale bitmaps on the native heap

Change-Id: I9819b532b89a997ab775b31ffee46445f1d16e20
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
caf813fe1ec10dda75cd752cb3ff80872ae7ac0b 16-Mar-2012 Romain Guy <romainguy@google.com> Remove unused private API

Change-Id: Iec9c2bc275fc7376f4e0b0b9c44059c56a9dd173
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b13b9bdad2baf6ad1ec2e56b6b7598fa20f55fc4 18-Feb-2012 Mathias Agopian <mathias@google.com> frameworks/base refactoring.

step 2: move libutils headers to their new home: androidfw

Change-Id: I14624ba23db92a81f2cb929f104386e1fab293ef
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
99b7b7a7f896f8b98e84c4d87e1239541f518f76 14-Jul-2011 Romain Guy <romainguy@google.com> Force bitmaps to load in ARGB8888 by default.
Bug #5024993

Change-Id: Id0c63f675ae188e5a786b7fdd63916e114b9ed4a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
a3804cf77f0edd93f6247a055cdafb856b117eec 12-Apr-2011 Elliott Hughes <enh@google.com> You don't need to poke around inside FileDescriptor manually.

We can help you with that.

Note also that getParcelFileDescriptorFD did no such thing. All its callers
were passing in a regular java.io.FileDescriptor and expecting the int. No
ParcelFileDescriptors involved.

Change-Id: Idc233626f20c092e719f152562601f406cc1b64a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
a06d86ab8177ee9e631e0ee4e39688bf42179bde 02-Mar-2011 Leon Scroggins <scroggo@google.com> Move NinePatchPeeker into its own file.

This way it can be used by other clients that want to draw
ninepatches. Ultimately the goal is to allow ninepatch
drawing from native code for WebView. Bug:3009375

Change-Id: Id13cef17ed7655a07e9f055586b686cf1e4af392
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
4b26247e8b45850afc78e414a7007266dbdc5d18 18-Jan-2011 Owen Lin <owenlin@google.com> Merge "Change to stream decoding mode if the file descriptor cannot support seek." into honeycomb
a9d0d47076ecf2d1739bb3534abc9deead8ebebd 18-Jan-2011 Owen Lin <owenlin@google.com> Change to stream decoding mode if the file descriptor cannot support seek.

bug: 3298498
Change-Id: Id7ae46bf8e885a417753edbd6648332052fee469
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2361098da3b9d9c3eeed410dc72ba62c0e9177cf 17-Jan-2011 Romain Guy <romainguy@google.com> Add BitmapFactory.Options.inMutable to load mutable bitmaps.

Change-Id: Iaa222127520f3aa55072d44af12ee3477908b876
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2118b25ad422e946d4d87e191c5710bfacd7503e 18-Dec-2010 Carl Shapiro <cshapiro@google.com> Eliminate tracked allocations and the inNativeAlloc option.

Change-Id: Ic10b2b41a26925d799e5d1e50be77fc480ec0f17
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
e4ac2d6b5723c95e648c489b187ddde449452c13 01-Dec-2010 Patrick Dubroy <dubroy@google.com> Allocate bitmap backing buffers in the Java heap.

Change-Id: I60f6ccff13357c1c518e9d56b02fe0171637edd1
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
decc8cd41eca3770c8f5ee13d81b9cd5f0c25ccd 11-Dec-2010 Chet Haase <chet@google.com> Add ability to reuse bitmaps when decoding PNG content

Change-Id: Ic74b62c6280954ff80bcf64f3989a36c7c0b5615
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
37f74cad46c6f1799aec3c52e8f47598237f43d4 09-Dec-2010 Chet Haase <chet@google.com> Add ability to reuse bitmaps when loading new content

Change-Id: Ic5f5f40ee39787403977fb372b335dc21cf07243
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ddb76c4644756b31be948d70aaa8ee541dd94999 24-Nov-2010 Kenny Root <kroot@google.com> Change assets to use 64-bit API

The asset system and supporting libraries were using off_t instead of
off64_t to access files larger than 2GB (32-bit signed). This change
replaces all off_t with off64_t and lseek64.

There is a new utils/Compat.h added for Mac OS compatibility.

Also fixed some size-related compiler warnings.

Bug: 3205336
Change-Id: I9097b3cb7a602e811fe52f245939d8975da55e9e
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
953f9094a2ec14594fa8501d5f3e2d9e300b1b62 03-Dec-2010 Wei-Ta Chen <weita@google.com> Add inPreferQualityOverSpeed into BitmapFactory.Options.

The new field allows a developer to use a more accurate by
slightly slower IDCT method in JPEG decode. This in turns improves the
quality of the reconstructed image.

The field by default is not set and thus does not affect existing
applications.

Bug: 3238925
Change-Id: I93d55b7226e47a43e639325cd1a677694d6f2ee4
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2a3d754549abc4b55e6cfc2d0c986d29782b2492 03-Nov-2010 Bryan Mawhinney <bryanmawhinney@google.com> Avoid copying byte arrays when just decoding bounds.

Currently, if a caller specifies both "purgeable" and "just decode
bounds" options when passing a byte array to decode, we create an
unnecessary copy of the byte array. This is probably not common,
but we may as well avoid the copy.

Change-Id: I27e573b0e1fb8f8516729882a84efa02b6da08a5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
6b849e2123be98eb2a1a25b8abf0b13a279ce952 07-Sep-2010 Wei-Ta Chen <weita@google.com> Unhide BitmapRegionDecoder.

1. Rename LargeBitmap to BitmapRegionDecoder
2. Move the instantiations of BitmapRegionDecoder out of BitmapFactory.
3. Remove the use of MemoryFile in BitmapRegionDecoder, since MemoryFile's API had been modified in master. Otherwise, the change will break the master build.
4. Move AssetStreamAdaptor, AutoFDSeek and nullObjectReturn to Utils.h because BitmapFactory.cpp and BitmapRegionDecoder.cpp both need to use these utility functions.

Most of the modifications, except for (2) and (3), were reviewed in https://android-git.corp.google.com/g/#change,64716 .
However, that change broke the master build due to (3) and was reverted eventually.
So, instead of withdrawing this change and waiting for that change to be checked in again, I merge the two changes into one.

Change-Id: I2202c0fbbbd6d6676bbd9637e690023ea4099c40
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2dcfbefbbeac406d16ec379c6430dd9ee9fd23a1 10-Sep-2010 Joseph Wen <josephwen@google.com> Fix bug in JNI BitmapFactory

In nativeCreateLargeBitmapFromFileDescriptor() if the file descriptor
can not be rewinded isShareable should be set to false.

Change-Id: I7dd545c9d52d21c226e11b8921e35a1d9bba9515
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
340ce75b446f6a6afc12b0582be3fc34ac3a5364 08-Sep-2010 Wei-Ta Chen <weita@google.com> Revert "Rename LargeBitmap to BitmapRegionDecoder for having a better API."

This reverts commit 50ba3d2c09a9131f3578d271adf2bc8258ca1742.
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
50ba3d2c09a9131f3578d271adf2bc8258ca1742 07-Sep-2010 Wei-Ta Chen <weita@google.com> Rename LargeBitmap to BitmapRegionDecoder for having a better API.

Move AssetStreamAdaptor, AutoFDSeek and nullObjectReturn to Utils.h because
BitmapFactory.cpp and BitmapRegionDecoder.cpp both need to use these utility functions.

Change-Id: I3e60c7fe4abd0289e1384e69a08fd20fe6fb0e10
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
18ef37258d897928c68b89535a93b99d8a817d3c 20-Aug-2010 Romain Guy <romainguy@google.com> DO NOT MERGE. Fix the build.

Change-Id: I3322faa948af015f7d8df31b9a4c281f5311f067
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
288471d8a57e1c318742cbfc28697877436fdb87 19-Aug-2010 Romain Guy <romainguy@google.com> DO NOT MERGE. Load assets in place instead of deferring until draw.

Before this change, all framework assets would be decoded at drawing time
outside of zygote. This was forcing all apps to re-decode the assets and
zygote to keep an in-memory copy of each asset. This behavior is now
opt-in by setting the inPurgeable flag on BitmapFactory.Options.

Change-Id: Ief823139163d8071b8ee1267746622faf52eb8ec
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f1f48bc7f200f54c76b22d845d8ba8419879b375 19-Jul-2010 Joseph Wen <josephwen@google.com> Do JPEG tile-based decoding.

Change-Id: I5c1b4ac3c02eb4350ef0ba9a7877b22cfd730cfb
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
39f10ec7dac59b5a8bc6f7e5b86846da77c30337 24-Mar-2010 Mike Reed <reed@google.com> If we detect a 9patch chunk, force the config chooser to avoid 565, with its pre-dithering madness

Change-Id: I0a2d1b094ccb16d479524779acec0216dc7a80ee
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
36ad54acef82f80dbf0ecdd8c44f5764df1be119 10-Mar-2010 Mike Reed <reed@google.com> force purgeability for assets

Change-Id: I1067cfb91846a05290ed26ce9a62eb82d3170719
http://b/issue?id=1860187
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ab4a0c164b5a44d5bfd37069cfe499db31e7620c 26-Jan-2010 Mike Reed <reed@google.com> add API to change default config on image decoders.

May be called by the browser to get high-quality images when running in a 32bit window
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
17154417e8ad488d18d9133bf802f598e7506483 24-Sep-2009 Mike Reed <reed@google.com> use new setDither on ImageRef to retain that setting for purgeable images
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
1b22b979256cf163ab9bbfd4fcfa16a8ce862ed1 17-Jul-2009 Mike Reed <reed@google.com> add hidden Options field for native allocations
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2a2c5cd74128a7750f05683614c9824c9262addc 03-Jun-2009 Wei-Ta Chen <weita@google.com> Modify the decoding logic in the FD case when a purgeable flag is set,
and lower the threshold of bitmap size for using ashmem().

For the decoding logic, we now go through the "non-purgeable" path if isShareable is false,
irrespective of the value of the purgeable flag.
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c70e06bbfac0d92ec218a32e35d9d7fa80f23cc9 24-Apr-2009 Mike Reed <reed@google.com> Add (hidden for now) purgeable bitmaps

BitmapFactory::Options now let you specify if the resulting bitmap can be
"purgeable". If so, then its decoded pixels may be purged when not actively
being drawn, freeing up that RAM. When such a bitmap is drawn, it will
automatically be re-decoded on demand. This is done by having the bitmap
keep a reference/copy of the encoded data.

Where it is a reference or a copy is controlled by the "shareable" flag in
Options. If this is true, the implementation *may* just reference the encode
data (e.g. a file descriptor) rathern than making a complete copy of it.

Currently, purgeable is not supported for generic inputstreams, but is
enabled for byte-array, file-descriptor, and assets, though for impl
reasons only file-descripts are currently enabled for "shareable", but that
may change in the future.
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
0a6a0e9e95fffc3b53be92ba617e97fff66d1401 02-Apr-2009 Ray Chen <> AI 144176: To fix the race condition in case "requestCancelDecode"
happens earlier than AutoDecoderCancel object is added
to the gAutoDecoderCancelMutex linked list.
BUG=1692286

Automated import of CL 144176
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp