History log of /frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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
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