History log of /frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c99bcc69f79584c7f5f24338863989c18d6142bb 14-Apr-2017 Romain Guy <romainguy@google.com> Merge "Add BitmapFactory.Options.inColorSpace" into oc-dev
95648b8a590995e57948ff2fd57d234bdbf30be0 14-Apr-2017 Romain Guy <romainguy@google.com> Add BitmapFactory.Options.inColorSpace

This allows applications to load bitmap in a preferred
target color space, similar to inPreferredConfig for
configurations.

This change also applies recent changes made to BitmapFactory
to BitmapRegionDecoder: support for outColorSpace, inColorSpace
and outConfig.

Bug: 32984164, 36905374
Test: CtsGraphicsTestCase (BitmapColorSpaceTest/BitmapRegionDecoderTest)
Change-Id: I4eded9190d1aa9c7f3033f9bb78a6854cc48a3ef
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ca9b703b8862b4b0a9c6134a0b3e0d1a89a9ae64 13-Apr-2017 Matt Sarett <msarett@google.com> Bug fix: use legacy SkCanvas regardless of color space tag

Test: Added unit test. CtsGraphicsModule.

Bug: 32984164

Change-Id: If72e1e31c98e01f97f3a05d763f5d4c71cf88313
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
90fc43b33de1439ae7d92b12c3e09038aa878f50 30-Mar-2017 Romain Guy <romainguy@google.com> Query color space before decoding a bitmap

This follows the pattern established by other "out" fields
in BitmapFactory.Options

Bug: 32984164
Test: CtsGraphicsTestCases

Change-Id: Ie72e47338b578b41c550453e2698d2d49eddf6da
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2ecdfc2a331ee38d4494377330721d93e9f77ced 08-Mar-2017 Matt Sarett <msarett@google.com> Use SkColorSpace::isSRGB() in place of pointer comparison

Test: Refactor

Change-Id: I26301339fb964c6feca8c92f058524f8b83156ff
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
dd3c06ce7e6c3429afb33362c07dcc99299d7047 10-Mar-2017 Leon Scroggins III <scroggo@google.com> Stop explicitly using kCallerPasses_Ownership

Test: No change in behavior, no new tests.

This enum is going away in https://skia-review.googlesource.com/c/9498,
and this method is using the default anyway.

Change-Id: I928a72851f90e84f45ce2fa49560f8ba894a8058
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
327c7207a0967537289d3e20e7be5504f9646e6a 22-Feb-2017 Matt Sarett <msarett@google.com> BitmapFactory: Remove legacy premultiply hacks

Skia now has a mode that will perform color correction,
but still do the premultiply on gamma encoded bytes.

Test: Flashed device, ran cts.

Change-Id: Ib1d1ea1074b5e6d1a49ecfc45e25552643dc04bc
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
6c382572e3136b4017dc80b5d389c771798b401a 21-Feb-2017 Matt Sarett <msarett@google.com> BitmapFactory: Leave the P3 color space on wide gamut bitmaps

Test: Built, flashed, cts

Change-Id: I242952cf690b821056dd5c13ec13f59120f573b5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
e8d2ebb5c29efb996179f9a4b62c78e4d3037e14 10-Feb-2017 Romain Guy <romainguy@google.com> Report bitmap config when decoding only metadata

With the introduction of support for 16 bit images, bitmaps returned
by BitmapFactory may be using the RGBA_F16 configuration. Some apps
and libraries assume the returned configuration is always ARGB_8888
and make assumptions based on that to compute cache sizes, etc.

This changes extract the output config when BitmapFactory is invoked
with the inJustDecodeBounds option. Despite its name, this option
is already used (and documented!) to decode more than bounds as it
also decodes the MIME type.

Bug: 35108998
Test: CtsGraphicsTestCases
Change-Id: If71959751458816678e42b21ab26c889aba5dea0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
33e3741cad838d3228aeb110a107b021bf7b90a7 21-Dec-2016 Matt Sarett <msarett@google.com> Decode images to sRGB, premultiply based on framework define

This reenables color conversion to sRGB at decode time.

Use the value ANDROID_LINEAR_BLENDING_ENABLED to decide
whether to use the codec's linear premultiply or manually
perform a legacy premultiply.

Test: Demonstrated that legacy premultiply is still
faster than the linear premultiply. So the performance
of the two pass approach (decode, then premultiply)
is acceptable. Skia tests both of these decoding modes.

BUG:33741991
BUG:8860389
BUG:24279600

Change-Id: Idea0f359565bd8c7c3ba06e77a897173677db1c6
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
6eebb28b18922c4201849ddbf267c9527597c25a 21-Dec-2016 Matt Sarett <msarett@google.com> Use a colorspace when decoding to F16

A recent change caused us to always pass a color space
to the decoder. A revert of that change caused us to
never pass a color space to the decoder.

In order to decode to F16 (and pass CTS tests), we
need to pass a color space on decodes to F16. This
was the "original" behavior before the bad change
and bad revert.

Test: This will allow us to pass CTS.

BUG:33814604

Change-Id: I4e569213f9d4ff5a452149c4b2ee191bf2fe6b0e
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
8a50364941abec42ea531b05c0993799ad60692c 19-Dec-2016 Matt Sarett <msarett@google.com> Manual revert of "Decode to sRGB in BitmapFactory"

Test: Verified that this fixes rendering artifacts.

BUG:33741991

Change-Id: Ie56ecee668be6fc20acdfcfd1167232d7c46f1ff
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
9505a6552764461c22ce48f1ac13d025d23e1579 14-Dec-2016 Romain Guy <romainguy@google.com> Add new RGBA_F16 bitmap config

This configuration uses 64 bits per pixel. Heach component is stored as a
half precision float value (16 bits). Half floats can be decoded/encoded
using android.util.Half.

RGBA_F16 bitmaps are used to decode wide-gamut images stored in 16 bit
formats (PNG 16 bit for instance). aapt is currently not aware of PNG
16 bits so such files must be placed in raw/ resource directories.

This first pass provides only partial drawing support with hardware
acceleration. RGBA_F16 bitmaps are stored in linear space and need
to be encoded to gamma space with the appropriate OETF to be rendered
properly on Android's current surfaces. They are however suitable for
linear blending. Full rendering support will be provided in a future
CL (BitmapShaders might be a bit tricky to handle properly during
shader generation).

Bug: 32984164
Test: bit CtsGraphicsTestCases:android.graphics.cts.BitmapRGBAF16Test

Change-Id: I328e6b567441a1b9d152a3e7be944a2cf63193bd
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2312cdcaa36e1c52ebe319ae4fd5c4fa8a567111 08-Dec-2016 Matt Sarett <msarett@google.com> Decode to sRGB in BitmapFactory

Test: Verified content looks as expected. Color correct
modes are well tested in Skia.

Change-Id: I922540f0a16df8693e2c30944b595538c34c583a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
9fbb0b5ab321d86efbc7fa8774052bfb34de9557 23-Nov-2016 sergeyv <sergeyv@google.com> Prohibit Config.HARDWARE in factory methods, that create mutable bitmaps

Test: android.cts.graphics.BitmapTest#testCreateMutableBitmapWithHardwareConfig
bug:30999911
Change-Id: I7cd4e2625563b6659613ccd180a57c56dcf7c2b1
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
10219fb261606fcc71c607167b28295b4578a10d 24-Nov-2016 Hal Canary <halcanary@google.com> SkImageEncoder->SkEncodeImage

Test: none
Change-Id: I15630d2852d12840329181f135852e28d287bbcf
(cherry picked from commit 8c6bac4c77caeefb667bec90d16b5384fd2b2b31)
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
da6c8ffcc594493c3936f83255efccdbf964cd21 23-Nov-2016 sergeyv <sergeyv@google.com> Introduce Bitmap.Config.Hardware with @hide annotation

Test: HardwareBitmapTests
bug:30999911
Change-Id: Iaa0e18842704cb6bcd483c63a095dcb22baaf5e0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
18bd88534a5783e581ccdd25b1b0f81c237a14b4 24-Oct-2016 Ben Wagner <bungeman@google.com> Replace SkAutoTUnref with sk_sp.

Skia would like to remove SkAutoTUnref and replace it with sk_sp.
This also removes the last SkAutoTDelete straggler.

Change-Id: Idd46fcbbffe7fc1edb243b82b1c2f5425ccd60b6
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
aed7f58fb05a25ce2112829e77c0eb5dd268e8a7 15-Oct-2016 sergeyv <sergeyv@google.com> Pass Bitmap instead of SkBitmap in canvas.drawBitmap(Bitmap, float,float,Paint)
Test: refactoring cl.
bug:32216791

Change-Id: If9f9fbc19e683b14cce6c3c268258bd832d495d2
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c1c54062f8cc9d47bdea820ae5ab6aef260b4488 20-Oct-2016 sergeyv <sergeyv@google.com> Rename hwui/PixelRef to hwui/Bitmap
Test: refactoring cl.
bug:32216791

Change-Id: I26de43f71027bccb43a5011f84080ab4631b2883
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
260ab726486317496bc12a57d599ea96dcde3284 07-Oct-2016 Mike Reed <reed@google.com> use SkBlendMode instead of SkXfermode
use sk_sp versions of paint setters/getters

Change-Id: I86591a0a8ec92e6039776cbf00424ea24f585b28
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
253f2c213f6ecda63b6872aee77bd30d5ec07c82 29-Sep-2016 Romain Guy <romainguy@google.com> Linear blending, step 1

NOTE: Linear blending is currently disabled in this CL as the
feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
to disable linear blending. This is only for GLES 2.0 GPUs
with no hardware sRGB support. This flag is currently assumed
to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
of the source pixel. The asumption is that a bright pixel will be
blended on a dark background and the other way around. The source
alpha is gamma corrected to thicken dark on bright and thin
bright on dark to match the intended design of fonts. This also
matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
could not be sampled in sRGB without a yet-to-be-defined GL
extension
- The last column of color matrices is converted to linear space
because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c69853c8b72540e5031d28e03cbce5a390c6959f 07-Oct-2016 sergeyv <sergeyv@google.com> Remove all hacks around ref counting in Bitmap
Test: refactoring cl.
bug:27762775

Change-Id: If7ebb8d5ee3a3085c1ef9ffc277cf6feaeab89e1
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
4508218850faedea95371188da587b6734f5f3da 30-Sep-2016 sergeyv <sergeyv@google.com> Make bitmap backed by native memory instead of java byte array
Test: refactoring CL. Existing unit tests still pass.
bug:27762775

Change-Id: Ic4e914b3a941c3d545f8ce9e320e638973df0e91
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
a493f62a0b58ac7695b98e6bbc7af67c8491c020 01-Sep-2016 Matt Sarett <msarett@google.com> Request legacy mode behavior from SkCodec in BitmapFactory

Png assets look funny when we perform a correct, linear
premultiply.

Change-Id: Ifd1202c49ab8b0061a255c2d5319dcfa2f3fd22f
(cherry picked from commit 76094dbd7f618db5e920cf52482fd3bfe4ddcd90)
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
0d4604cdb280c59e596023e844211118a358a6b6 17-Mar-2016 Yujie Qin <yujieqin@google.com> Return DNG mimeType for the case kDNG_SkEncodedFormat

Bug: 27587823
(cherry picked from commit 5a7a5ad3c61054a5a8ef2a64bcd9d3405cc38368)

Change-Id: I45a1f59c013b6e4173b3af4613acb9af3c571d9a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ee80c47163d5ead99972bf84f24ccc462b500806 03-Jun-2016 Matt Sarett <msarett@google.com> Fix uses of SkImageInfo in BitmapFactory to preserve color space info

Change-Id: I1b67d10cd8a2c9ece35154a55060577a7747aebb
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
002c43ef7b28452ae770e8fd103ba519409204cb 24-Mar-2016 Matt Sarett <msarett@google.com> Delete references to SkImageDecoder

SkImageDecoder is no longer used by Android and will be deleted
by Skia.

Change-Id: Ied813559a1cbdbbbad953dad2ff1c3f181afa5d5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
990ea136b202a9956a5d35ac7895655ece34f5f6 17-Mar-2016 Yujie Qin <yujieqin@google.com> Return DNG mimeType for the case kRAW_SkEncodedFormat

Bug: 27587823
Change-Id: I0f539034a883083a30f33262edc715714f45e60d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
4e5ec34e98faa8338ca04282a160ef2b0d13bc9d 07-Mar-2016 Anton Daubert <adaubert@google.com> Fine scale the decoded result to match the desired sampleSize.

Bug: 27097032
Change-Id: Ie15a3116cdd6988524977e5390f6edbac224e502
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c1d7b7f71ce1a55548d7e8bb32d728190e2ffd47 29-Feb-2016 Yujie Qin <yujieqin@google.com> Use SkFILEStream directly when possible

When decoding from a file descriptor, if the descriptor is seekable and
has no offset, use SkFILEStream directly instead of wrapping in an
SkFrontBufferedStream.
This will let the SkRawCodec take advantage of a seekable stream.
One can see 2x speed up for RAW cases.

Bug: 27097104
Change-Id: I369fbb3af1170c94ec7cd9bb35e8e0007dde9fd5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
96ffbdc9ddd8e8fd6582a907b1c5e916d21e44fa 11-Feb-2016 Matt Sarett <msarett@google.com> Use SkCodec::MinBufferedBytes() for front buffered image decode stream

This should not change decode behavior, but it's worth noting that
the number of bytes buffered will decrease from 64 to 30.

Change-Id: I66b0e38a487c1786823b0125686b094dae5d13dc
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
3b1b68d6c764a4f60d034e57a94879b7df65fd43 14-Dec-2015 Matt Sarett <msarett@google.com> Allow ninepatches to be encoded using non-RGBA modes

The original intention for forcing ninepatches to be encoded as
RGBA (with alpha) was to avoid the possibility of the decoder
producing 565 output.

565 output is bad for ninepatches because dithering tiny images
that we intend to scale later leads to bad results. I would
argue that, since the new BitmapFactory does not dither, we might
now be ok to allow 565 decodes for ninepatches. However, we
will maintain the old behavior by disabling 565 decodes for
ninepatch.

There are two changes to PNG encodings:
(1) Allows ninepatch images to be encoded in any mode. Forcing
them to RGBA makes things awkward for the decoder. Currently,
BitmapFactory's png decoder checks every pixel for alpha.
That way, RGBA images that are actually opaque can be marked
as opaque, in order to optimize drawing. We want to remove
this complexity from the decoder.
(2) Make sure ninepatch chunks are stored in the png header. That
way we know immediately that the png is a ninepatch, and can
refuse to decode to 565 (if we feel this is best).

Change-Id: I724f5dbefb1be7b412f9b362dff83cbc0603f0bf
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
e3b8f255cf8e74cccaee49235333994f51852125 04-Jan-2016 Matt Sarett <msarett@google.com> Merge "Make BitmapFactory.Options API Changes"
5e2496bcee239ce9ebeff6022b7badf81d87492c 18-Dec-2015 Matt Sarett <msarett@google.com> Make BitmapFactory.Options API Changes

This changes the documentation for inPreferQualityOverSpeed,
inDither, and requestCancelDecode().

These changes are a result of modifying the backends of
BitmapFactory and BitmapRegionDecoder to be faster, higher quality,
and to use standard libraries.

BUG:26266063
BUG:25556965
Change-Id: I9008fd276a38c737e242bcc6930ffe4e36d9fd1d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
d31512b9a6d9d6913b1d45ad2fb029a98c1804bf 09-Dec-2015 Matt Sarett <msarett@google.com> Clean-ups for BitmapRegionDecoder

Check for OOM after calling encodedFormatToString().

Do not correct Alpha8 to Gray8. This will be handled in Skia.

Change-Id: Id573548608fbd5fbeef2898844480d8f8f73e1d0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
9e7cd6351b8245d3b0eff902beb89dc4c6d3ed19 11-Dec-2015 Matt Sarett <msarett@google.com> Allow SkAndroidCodec to compute the decode color type and alpha type

This CL will not cause a behavior change. SkAndroidCodec implements
the same logic.

Change-Id: I81ef12748d165f4c7a6e86a6e2562a949378940a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b8adc9a37fc92006ebc3c621316f4cd233d4bb83 02-Dec-2015 Matt Sarett <msarett@google.com> Modify BitmapFactory to use SkAndroidCodec

Change-Id: Ifa7c1e2f2a22a0af5426dacdc50a82beecf0e2e3
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f35b989d26bb98900f6c5fa2e586326b30b6e161 31-Jul-2015 Leon Scroggins III <scroggo@google.com> Merge six commits from master-skia to master

Also corrects some code under development behind the HWUI_NEW_OPS flags
to match the updated Skia API.

Include external/skia/include/private
use SrcConstraint for drawBitmapRect
clean up to allow removal of flags for SCALAR_DIV and IMAGEINFO_FIELDS
don't call DEPRECATED getDevice()
update to newer API for drawBitmapRect
asABitmap is deprecated, used isABitmap

previous-Change-Id: I12208855a95948897077b1c1549eb35416cc801e
previous-Change-Id: I5044f0f61315fe48c60d7af5e261a7d0ed574f56
previous-Change-Id: Ic34a3ba77b3f9e091fa7aaba75018a307abacdab
previous-Change-Id: I79f8dd779920565d1204f7fe67b3286b1bbf4e9b
previous-Change-Id: Ic04d1f8274f6a862ea00f8d241363cf31f5ec1ec
previous-Change-Id: I9e4ae257a1976c74302b6a73f17405174ae58cec
previous-Change-Id: I85de3462ad1e4877784df38edc4bcd0acbd24e5e
Change-Id: Ide8e2f669e91a13c32521af3a16efdaa085c81d0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
d8f904f256b82e48e9a85561eb96e15399b0b2d9 28-Oct-2015 Tom Hudson <tomhudson@google.com> Revert "Merge six commits from master-skia to master"

This reverts commit 550780745fa28ae9a87d02331841ca5ce4f9c763.

Change-Id: Ic71eccea454b26261fe6e9a9a7a24eff56396989
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
550780745fa28ae9a87d02331841ca5ce4f9c763 31-Jul-2015 Leon Scroggins III <scroggo@google.com> Merge six commits from master-skia to master

Include external/skia/include/private
use SrcConstraint for drawBitmapRect
clean up to allow removal of flags for SCALAR_DIV and IMAGEINFO_FIELDS
don't call DEPRECATED getDevice()
update to newer API for drawBitmapRect
asABitmap is deprecated, used isABitmap

Change-Id: I519f54f97321a7a365ea81a3b78cb03b9bdca021
previous-Change-Id: I12208855a95948897077b1c1549eb35416cc801e
previous-Change-Id: I5044f0f61315fe48c60d7af5e261a7d0ed574f56
previous-Change-Id: Ic34a3ba77b3f9e091fa7aaba75018a307abacdab
previous-Change-Id: I79f8dd779920565d1204f7fe67b3286b1bbf4e9b
previous-Change-Id: Ic04d1f8274f6a862ea00f8d241363cf31f5ec1ec
previous-Change-Id: I9e4ae257a1976c74302b6a73f17405174ae58cec
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
434a481b2191562582c79be29f24c2e0b5ca60d0 24-Sep-2015 Elliott Hughes <enh@google.com> am ea1831d2: am b57dd722: resolved conflicts for a884d81e to stage-aosp-master

* commit 'ea1831d211ea0e6b2d161c714bb0786369ef2df5':
constify JNINativeMethod function pointer tables
b57dd722f1dc0663417da37d3a82f8283ad3c982 24-Sep-2015 Elliott Hughes <enh@google.com> resolved conflicts for a884d81e to stage-aosp-master

Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
76f6a86de25e1bf74717e047e55fd44b089673f3 19-Sep-2015 Daniel Micay <danielmicay@gmail.com> constify JNINativeMethod function pointer tables

Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
60126efd7d905ca24822765c6dafac17fef278ab 07-Aug-2015 Ben Wagner <bungeman@google.com> Use unique_ptr instead of SkAutoTDelete.

Skia would like to make SkAutoTDelete private, given that unique_ptr
now exists and is a better standard alternative.

Change-Id: Ie21bc4546c93e2096c1e43b26eb3ef80b8f11de4
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ae2e8b4891491e8e89bed5f2c9626415adee09cb 06-May-2015 John Reck <jreck@google.com> Add warning if an in-use Bitmap is reconfigured

Bug: 18928352

Also fix an issue around re-configure not properly handling
mPinnedCount in android::Bitmap

Change-Id: I1815b121f1474ad931060771bb1d52ef31d2aac7
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f29ed28c7b878ef28058bc730715d0d32445bc57 07-Apr-2015 John Reck <jreck@google.com> Attempt to solve the double-GC problem

Fix the issue where Bitmap requires two GC passes
to release its byte[] by using some questionable
ref-counting hacks to manage whether or not
native has a strong or weak ref to the byte[]

Change-Id: Ia90a883579f61c0b1904b5549a66bd0ef34b32c5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
ed207b92747234eac88dd3664ecfb535e45d8ed1 10-Apr-2015 John Reck <jreck@google.com> Change how Java Bitmaps are accessed in a few places

Stop assuming that a Java Bitmap has a SkBitmap* that
has some externally managed lifecycle, and instead switch
a bunch of users to accessing the bitmap by providing
their own SkBitmap* on which to set the (ref counted!)
SkPixelRef* instead

Attempt #2 to land this, original issue was in getSkBitmap
and should be fixed

Change-Id: I0fd9e193968b41e5597784140d56b4885906864a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
edc22fba5921f5c2d3502727e707f959b8c3a460 21-Apr-2015 John Reck <jreck@google.com> Revert "Change how Java Bitmaps are accessed in a few places"

Bug: 20207616

This reverts commit a771b9861d11671c780092d35c0062eeefcf37c0.

Change-Id: Ifd891cc075274a7986e987229e0fed5a04ed9ff0
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
a771b9861d11671c780092d35c0062eeefcf37c0 10-Apr-2015 John Reck <jreck@google.com> Change how Java Bitmaps are accessed in a few places

Stop assuming that a Java Bitmap has a SkBitmap* that
has some externally managed lifecycle, and instead switch
a bunch of users to accessing the bitmap by providing
their own SkBitmap* on which to set the (ref counted!)
SkPixelRef* instead

Change-Id: I0fd9e193968b41e5597784140d56b4885906864a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
4147877b388eb4a6f4e1ee116edfa58a018891ca 10-Apr-2015 John Reck <jreck@google.com> Remove user of GraphicsJNI::createBitmap

Change-Id: I2f31bf98ed08eb4bd39a6ce7236c7a23ef309177
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2a1ce8a4e5258b6599cb8e86864eb816d24d69b4 16-Mar-2015 Mike Reed <reed@google.com> use SkFilterQuality instead of SkPaint::FilterLevel

Change-Id: I5d26869de746107b8a35a7a662236f993a824b0d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
3449789b9ca58fee7e5cd02ff89d544f4a6bc9b5 20-Jan-2015 Leon Scroggins III <scroggo@google.com> SkStream is no longer a ref counted object.

With https://codereview.chromium.org/849103004/, SkStream is no longer
ref counted. Change callers that currently unref() SkStreams to one of
either:
- delete the stream
- pass ownership of the stream

screencap.cpp:
Call EncodeData directly, bypassing SkDynamicMemoryWStream and SkBitmap.

Utils.cpp:
Write directly to an SkData, and then use that to construct a new
SkStream.

Cherry-pick of a change that originally landed in master-skia and is
dependent on a skia merge (ag/655422).

Change-Id: Idc99ad7d5a70c893dc012d59915216f301ab3c9d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f4faeac3525fe1ce3707ab785a1651aec367589d 05-Mar-2015 John Reck <jreck@google.com> Cleanup Bitmap JNI attempt #2

Original version missed a spot

This reverts commit c02977e3bbfaaedcb1b1d67e1692becc7dddd59b.

Change-Id: I56244ce10d709fcdef42a001fe4c6ba7b6bbb04d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c02977e3bbfaaedcb1b1d67e1692becc7dddd59b 05-Mar-2015 Chad Jones <chadj@google.com> Revert "Cleanup Bitmap JNI"

This reverts commit b2915245b74b3b5541b123e38403f8e26426b4b7.

Change-Id: Idd7d7f33eec4ea5024c83de6b10d3d1a6ab2b17a
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
b2915245b74b3b5541b123e38403f8e26426b4b7 04-Mar-2015 John Reck <jreck@google.com> Cleanup Bitmap JNI

Fix a bunch of places where mNativeBitmap was being
poked at directly, switch them either to the NDK API
or to GraphicsJNI where it made sense

Change-Id: I6b3df3712d6497cba828c2d3012e725cb4ebb64d
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
c2d39573ca95994d9a44db8aea4887a67f84e5ac 12-Jan-2015 Ben Wagner <bungeman@google.com> Remove dead code from AssetStreamAdapter.

After "Use at least SkStreamAsset for SkTypefaces." there is now dead
code in AssetStreamAdapter. Remove the code and update the users.

Change-Id: I17a9d82dd6ca4d87a951c1570dc91de7f2fc54f2
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
2e61c040703bea032222850a58c0d38a2566ac12 07-Jan-2015 Vladimir Marko <vmarko@google.com> am bf31cb6b: am 8371f2e3: Merge "Check for OOM in BitmapFactory\'s getMimeTypeString()."
automerge: 4e29869

* commit '4e2986940b2ff456693a805026c6910e950c42e2':
Check for OOM in BitmapFactory's getMimeTypeString().
4e2986940b2ff456693a805026c6910e950c42e2 07-Jan-2015 Vladimir Marko <vmarko@google.com> am bf31cb6b: am 8371f2e3: Merge "Check for OOM in BitmapFactory\'s getMimeTypeString()."

* commit 'bf31cb6be4290ce161d99a2a70c318f665a14a77':
Check for OOM in BitmapFactory's getMimeTypeString().
7ab249a18e08bfefb8c2d60af1fb668c67ba4368 06-Jan-2015 Vladimir Marko <vmarko@google.com> Check for OOM in BitmapFactory's getMimeTypeString().

Bug: 18909596
Change-Id: If65fe45f5fd569a99a0cae1d31117af262bca430
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
f2883b320fd874ec70bbef28731f17fa55bade11 18-Dec-2014 Mike Reed <reed@google.com> explicitly call tryAllocPixels if you want to check for failure

allows us to remove SK_SUPPORT_LEGACY_ALLOCPIXELS_BOOL

Change-Id: I095a04e358404bc413ceebe81e7e1adfbbbec027
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
7d13d9db1ef90063cb542ccd6554042a6a3263b7 21-Nov-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 3fc5e3ca to lmp-mr1-dev-plus-aosp

Change-Id: Id8286e5a4381315a6060251a8055b0f1d1a96019
ed6b9dff563c5e22f040ff37e12c0d771e0478ae 21-Nov-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Consistency in core/jni

Make consistent use of core_jni_helpers for registration.

Translate some #ifdefs into const bools.

Change-Id: I37639aa053dd50f003a552cbd8550dddecc811c5
/frameworks/base/core/jni/android/graphics/BitmapFactory.cpp
3a091b79978caa9b5d58ae19f693279e5a717c2a 21-Nov-2014 Dan Albert <danalbert@google.com> resolved conflicts for merge of 8e0cfe7c to lmp-mr1-dev-plus-aosp

Change-Id: I068d2a0fb118d4e2b4c1e546bebfcbc2cb120d36
46d8444631b4b1253a76bfcc78a29d26014d022f 19-Nov-2014 Dan Albert <danalbert@google.com> Fix clang warnings in core/jni.

There are a few bugs in here too (mostly people expecting + to
concatenate C strings) :(

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

(cherry pick of 5cb769d99952ef9fb4f576abba70423fe157342b.)

bug: 17541634
Change-Id: I9968f9df249e4cba24383239ce6130dd16fcd532
/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