History log of /frameworks/base/core/jni/android/graphics/Bitmap.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3ca3975f066433a473d89b37432f43c74b1c5143 26-May-2017 Matt Sarett <msarett@google.com> Add logging and null check for SkColorSpace serialization

Test: Compiled and flashed device.

BUG:38502480

Change-Id: Iaae74d8485ef88d85b634ddf86999e5cac60028f
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
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/Bitmap.cpp
8242656f495847c50c9ceaea92839dce78218a75 05-Apr-2017 Romain Guy <romainguy@google.com> Color management, the missing pieces

Implement missing color management pieces for bitmaps:

- Bitmap.createBitmap(Bitmap src, ...) now creates a bitmap
in the same color space as the source bitmap
- Bitmap.createScaledBitmap() now creates a bitmap in the
same color space as the source bitmap
- Bitmap.createBitmap(..., ColorSpace colorSpace) to create
bitmaps in a specific color space
- Fix copy from A8 to F16
- Copying bitmaps in F16 or with a color space does not work,
it's currently a limitation in Skia

Bug: 36905374
Test: BitmapColorSpaceTest
Change-Id: I0092fe4432511db50daa3a9393389a9db05e0c2a
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
5320a72a882f505682f47978d2e38778113900fa 20-Mar-2017 Matt Sarett <msarett@google.com> Support Alpha8->RGBA bitmap copying

Skia recently dropped support for this conversion. So this adds
an implementation to the framework.

This also unifies framework behavior to treat Alpha8 as
implicitly black when it must be converted to a color.

Test: CTS

BUG:36202415

Change-Id: Ia141733387e80f7e61bae472e632cdfbac67b2e0
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
d70532d123b816e0f2ae482258b4e3af56fcdcb2 15-Mar-2017 Romain Guy <romainguy@google.com> Don't apply the sRGB OETF twice on RGBAF16 bitmaps

Bug: 36250591
Test: BitmapRGBAF16Test
Change-Id: I39ca9e4bb666ab85066b5d45934f5f10210f6999
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
ce217faddb4b40c1b3e698944da1951027080427 09-Mar-2017 Romain Guy <romainguy@google.com> Make Bitmap.get/setPixel[s] color space aware

Bug: 32984164
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.BitmapColorSpaceTest
Change-Id: Iee8c4abb264f0d2a44bae59788fbf4dcb2d0fdf7
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
5acc476878bce8b72c0059e05cbbd5b43ffee5d5 08-Mar-2017 Romain Guy <romainguy@google.com> Write Bitmap's color space in parcel

This change also resets the cached color space field in Bitmap.java
when reconfigure() is called or when a bitmap is reused by the
bitmap factory.

Bug: 32072280
Test: CtsGraphicsTestCases.BitmapColorSpaceTest
Change-Id: I232b729b7a29e65bfff21dc749570c3c80adf855
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
efb4b06493fe7b1604c762a448b13c7af2845a8d 27-Feb-2017 Romain Guy <romainguy@google.com> Add ColorSpace information on Bitmap

This is the first step toward interpreting color spaces at render time.

Bug: 32984164
Test: BitmapColorSpaceTest in CtsGraphicsTestCases

Change-Id: I0164a18f1ed74a745874fe5229168042afe27a04
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
53fc3cdd5ce88ff6e8c3e7d5eca6c90cb72ea9f8 02-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix NDK access to recycle'd bitmaps"
00799f760d6956fc54ee1763427f8196fcb3696d 02-Mar-2017 John Reck <jreck@google.com> Fix NDK access to recycle'd bitmaps

Also kills off one user of GraphicsJNI.h!

Change-Id: Icbf979e485b3b6ec2f37e18ff654b8ff1e44fb35
Fixes: 34712423
Test: cts CtsGraphicsTestCases --test android.graphics.cts.BitmapTest#testNdkAccessAfterRecycle passes
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
656117bed2fc1937bcebd615898924ed57c48979 01-Mar-2017 sergeyv <sergeyv@google.com> Fix premultiplied flag for hardware bitmaps

Test: android.uirendering.cts.testclasses.HardwareBitmapTests
bug:35752428
Change-Id: I2d21822e13c007c760f2fb42370aeb9240fcb5fa
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
89ddb1f1644e0b47de060d2c9aaf6d5387c38f2f 10-Feb-2017 Matt Sarett <msarett@google.com> Update framework to use new SkColorSpace API

Test: This compiles with SK_USE_LEGACY_NAMED_COLOR_SPACE
turned off.

Change-Id: Ie573f59e0aa475bab06b38589db3c6158ad82c5a
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
6e3658a63843096058ed444d073fbcd191fd7e1b 05-Jan-2017 sergeyv <sergeyv@google.com> Hidden method to get a graphic buffer from a hardware bitmap

Test: locally tested Bitmap.getGraphicBuffer()
bug:30999911
Change-Id: I68d56d769045bada6a5db90ed884a570c49be4fd
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
0a0f23163a7a62900d46c7f81d109320d73d6c6b 04-Jan-2017 sergeyv <sergeyv@google.com> Move GraphicBuffer to graphics package

Test: locally tested Bitmap.createHardwareBitmap method
bug: 30999911
Change-Id: Iad432577f26f2362ede9e77cd8a5425c010692e5
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
81f97ee47ccf0d011cdc4f38b6ea5c45b70dedc0 28-Dec-2016 sergeyv <sergeyv@google.com> HardwareBitmaps: support createBitmap methods that return immutable bitmap

Test: testCreateScaledBitmap, testCreateTransformedBitmap, testCreateSubsetBitmap in HardwareBitmapTests
bug:30999911
Change-Id: Ic128dfed78b18ad6f12dad50023ee7c2f5bfa4ad
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
15a108550e3d74b406927d85c8e69018761adf49 27-Dec-2016 sergeyv <sergeyv@google.com> Fix getConfig on recycled bitmap

Test: android.graphics.cts.BitmapTest#testGetConfigOnRecycled
bug:33789983
Change-Id: Ic91c16cbd83acdd6002021b44da57636ee27742d
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
8b6fe1d8948bbd6479387ab1015a306022b55db4 19-Dec-2016 Sergei Vasilinetc <sergeyv@google.com> Merge "Support Bitmap.copy for hardware bitmaps"
045d4786a1623a2b1e88182481bbb668b711b103 17-Dec-2016 Chris Craik <ccraik@google.com> Merge "Fix ViewCaptureTest, Bitmap.sameAs"
05126d151eb3caa85bd3a039cffb6e37940c3fa4 16-Dec-2016 sergeyv <sergeyv@google.com> Support Bitmap.copy for hardware bitmaps

Test: android.uirendering.cts.testclasses.HardwareBitmapTests#testBitmapConfig*
bug:30999911
Change-Id: I2e80dff914bfa0666290701072ac93d30d218e8d
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
795bd0fe93e8bb5214e22cd38aea6a9dc651604b 17-Dec-2016 Chris Craik <ccraik@google.com> Fix ViewCaptureTest, Bitmap.sameAs

Bug: 33702897
Test: tests added to android.graphics.cts.BitmapTest, all passing

Change-Id: I41b06114929df3c0c9bf826c721a29630e8c5098
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.cpp
1eabed3d14fdc47ac6939cfa98521adcb45bc224 14-Dec-2016 sergeyv <sergeyv@google.com> Add check if bitmap is hardware in Bitmap.sameAs

Test: BitmapTests#testHardwareSameAs
bug:30999911
Change-Id: I644776c1ad258fc84d5c2c2ae09bf0859424ee48
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
19b4b019169424d62bf3edc40b9560984206cf80 14-Dec-2016 sergeyv <sergeyv@google.com> Fix getConfig function for hw bitmaps

Test: HardwareBitmapTests#testGetConfig
bug:30999911
Change-Id: I93a1c9fc88567ada2462a7a3b6cef8f796844e15
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.cpp
780b624fb5632c5baa8e50bc3ba52ec3772e7be4 05-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Reference colorspace during creation of SkImageInfo"
7d5219fb505ff1b178910cda25a40154e7d4d09a 04-Nov-2016 sergeyv <sergeyv@google.com> Reference colorspace during creation of SkImageInfo

Change-Id: I515060776ef13ad125c7e8513ea10944ef2d4a79
Test: manual.
bug:32621254
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
ab12c1fe73734a18ac19a06b97f276528f6d027a 03-Nov-2016 Mike Reed <reed@google.com> update callers to newer Skia APIs

Test: refactoring CL. Existing unit tests still pass.

Change-Id: I47e73e00f14f78dd9d4c48a142ac9853e7e4cad7
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
9192d5e8d78b826a665ce048c007e6eaf0f5b003 31-Oct-2016 John Reck <jreck@google.com> Remove unused method

Test: builds

Change-Id: I8ad660f083a57f30db5ed0e2fe777286720033ca
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
ec4a4b13eae2241d1613890c1c1c096bed891845 21-Oct-2016 sergeyv <sergeyv@google.com> Use Bitmap in DisplayList & RecordedOps instead of SkBitmap
Test: refactoring cl.
bug:32216791

Change-Id: I1d8a9a6e772e2176b6c2409409a910478b45f8db
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
5fd2a1cb2726afa7d40fe4750e9defd89c24ed37 21-Oct-2016 sergeyv <sergeyv@google.com> Pass Bitmap instead of SkBitmap in drawNinePatch & drawBitmapMesh
Test: refactoring cl.
bug:32216791

Change-Id: I5adcd59daf752d36012456b0a9960c59d07e2e3d
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
fc9999505a36c66892d7ccce85187936105f4f36 17-Oct-2016 sergeyv <sergeyv@google.com> Pass Bitmap instead of SkBitmap for bitmap rect operation
Test: refactoring cl.
bug:32216791

Change-Id: I66d19194c57b3aa2c400aa87acffc774a533776a
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.cpp
c36bd6c16ddfc160732ff7e4518564714c8aa66e 12-Oct-2016 sergeyv <sergeyv@google.com> Move allocatePixelRef methods to hwui.
This patch also makes tests to use SkBitmap backed by hwui/PixelRef,
Test: refactoring cl.
bug:27762775

Change-Id: Ib936e81877790849118420f5e565fc8f4466c1be
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
1158b6d4ee34707515d5af59a13e4999ba53563e 12-Oct-2016 Romain Guy <romainguy@google.com> layoutlib relies on refSkPixelRef(), put it back

Test: Build aosp_arm64-eng successfully
Change-Id: Ic00cacac9aa1006ec16060a95bd1a22133e9a4bd
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
21986f2ae73e9ae3395a37dd3976af55e75d4f9d 12-Oct-2016 Romain Guy <romainguy@google.com> Merge "Linear blending, step 1"
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/Bitmap.cpp
163f88140e18f13575886e88af0336e0ab1ec846 08-Oct-2016 sergeyv <sergeyv@google.com> Move PixelRef to hwui
Test: refactoring cl.
bug:27762775

Change-Id: Idd13b865ce22d4c51ced9b0fe3e9174452e87c6e
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.cpp
003bdee0b6680b8ab0d1fa07451e50e8c3555160 12-Sep-2016 John Reck <jreck@google.com> Ensure munmap matches mmap

Bug: 31350622
Change-Id: I6d3f9faec32d54360caa6706d17405e20b50966c
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
897b9effb7f84c241bc68686c09324987c1dba37 02-Aug-2016 John Reck <jreck@google.com> Eliminate recents upload jank am: 4387190d8e
am: 021a952150

Change-Id: I9715db27b6ea265c180f56297815b7240368231f
4387190d8ec9fe4e953fcfeb093a644b82cf85ed 01-Aug-2016 John Reck <jreck@google.com> Eliminate recents upload jank

Bug: 30342017

Upload recents thumbnails in the
dead gaps between frames instead of
at the start of a frame. This eliminates
jank caused by the large texture
upload.

Change-Id: I507cd286d199109c7a9a1511d68ba5ab5d28069f
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
85e0c89ba55188ecc484538efbfdb570606fc1a2 28-Apr-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of 1599b981 to nyc-dev-plus-aosp

Change-Id: I90807581e10b6a0024515ff634ac8b29eaa5fc9f
c6baf563ba6aa207a48317c177b29f1d2b70cf3d 27-Apr-2016 Chih-Hung Hsieh <chh@google.com> Fix google-explicit-constructor warnings.

Bug: 28341362
Change-Id: Ibdd6a210bb7ff228e3624cc319169f77aca3b51e
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a5fdde9d15fbdf1aaeb61e1cf0c128af3aeb7b67 15-Apr-2016 Winson <winsonc@google.com> Take app screenshots in 565.

- Or to be specific, SurfaceFlinger can’t easily take 565 screenshots,
so convert them when creating the ashmem bitmap.

Bug: 28151300
Change-Id: Ic7586659a41cc19c322136f77a1c52ef68c22707
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
562cfef1d5f179d1ca6b1672825f3533874d4650 31-Mar-2016 John Reck <jreck@google.com> Remove warning

Fixes: 25760687

The recommendation floating around is to ignore this even
though it's unquestionably an app bug so just remove it.

Change-Id: I7075de5d2864874d786a0aab0c945be96de172e3
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
dccca44ffda4836b56a21da95a046c9708ffd49c 21-Mar-2016 sergeyv <sergeyv@google.com> Reland: Move text logic from jni to hwui level

Initial CL: https://googleplex-android-review.git.corp.google.com/#/c/886854/

Change-Id: I9dfd85fe1d2a2c44f4360c8a29fd58d80e6f31c8
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
afbd0f1fef46ef0ddf633dfde0de724db3da1405 21-Mar-2016 Sergei Vasilinetc <sergeyv@google.com> Revert "Move text logic from jni to hwui level"

This reverts commit a7f6bba1a3565c19715e878dfe7f0e01022944ff.

Change-Id: If4f36f87a85411b6128fd92d391313803ccaf9dd
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a7f6bba1a3565c19715e878dfe7f0e01022944ff 16-Mar-2016 sergeyv <sergeyv@google.com> Move text logic from jni to hwui level

bug:25865834
Change-Id: I2d8c9c9544afcb5ce1784f732aed3e54e0eda372
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
66ce1c3b1a7b5ed3d4d5a9a05a7c133998c9a73e 02-Feb-2016 Leon Scroggins III <scroggo@google.com> Lock SkBitmap before accessing color table

This only affects kIndex_8 Bitmaps, which can only be created by
decoding particular images (e.g. GIF). Without locking the SkBitmap,
colorTable() always returns NULL. Lock it so we can write the color
table to the Parcel.

BUG:26527976
Change-Id: Ifc54b06ca08db26ba6455a3830b7e671b64f37c4
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
775873a66a946fae2b0535abb51df9817bd1b20c 29-Dec-2015 Richard Uhler <ruhler@google.com> Use NativeAllocationRegistry for Paint, Canvas, and Bitmap

Bug: 23130675
Change-Id: I3fbd84ba417ac63df75f87ee2c56e3e7f3c9eb46
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
fa17e612911a131a356dd80cd4be801bdc6b39dd 16-Nov-2015 Erik Wolsheimer <ewol@google.com> Log errno when dup fd cannot be allocated BUG: 25165471 am: 211abad3b9 am: b45defae8e am: 529893f84c am: 7698dd970f
am: ae4ab3501a

* commit 'ae4ab3501a0400940ace2d0bfdf0d7021c740603':
Log errno when dup fd cannot be allocated BUG: 25165471
2fba776ee0227e54f750dc6b87c8ca1bc1fd556f 16-Nov-2015 Erik Wolsheimer <ewol@google.com> Log errno when dup fd cannot be allocated BUG: 25165471 am: 211abad3b9
am: b45defae8e

* commit 'b45defae8e61a4fa3aba9dd08480861d10f5982a':
Log errno when dup fd cannot be allocated BUG: 25165471
211abad3b92b70dd094949c79f67e686c940fa0c 13-Nov-2015 Erik Wolsheimer <ewol@google.com> Log errno when dup fd cannot be allocated
BUG: 25165471

Change-Id: I7342e2b4c566325fc2e15643a7c7b6ba989ee8c7
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
87455c7397605fba4bf3ad04af8df3c599a7a6ba 03-Nov-2015 Ian Pedowitz <ijpedowitz@google.com> Merge "Limit persistent ashmem backed fds to a minimum of 128kB." into mnc-dr-dev am: 966d6040c6 am: 95fc53b029
am: d6f3e38738

* commit 'd6f3e38738c88821b28b2571d034fc1b189a35de':
Limit persistent ashmem backed fds to a minimum of 128kB.
8cee7c17119b204be88860feb812f2374d0de732 02-Nov-2015 Riley Andrews <riandrews@android.com> Limit persistent ashmem backed fds to a minimum of 128kB.

Bug 25256717

Change-Id: Ieb356006df0a6545b89de44d3d8fd4b46312b3b8
Signed-off-by: Riley Andrews <riandrews@google.com>
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
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/Bitmap.cpp
01a0af31d7d418f400ce5d3f752eba6a35aa00e2 31-Jul-2015 John Reck <jreck@google.com> Yell loudly about undefined behind in Bitmap, but work anyway

Bug: 22214367

Previous releases would let the getters on a recycle()'d bitmap to still
work despite being firmly in undefined behavior per the documentation
on Bitmap#recycle().

As there are apps relying on this, yell very loudly about this behavior
in the log and give them a bit of time to fix it

Change-Id: I857be7e74cb217877973d9c6f03eb761d12fd056
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
6260b22501996d2e7a0323b493ae6c4badb93c28 25-Jul-2015 Chris Craik <ccraik@google.com> Fix bitmap get/set pixels for ALPHA_8

bug:22724734

Change-Id: If8307854f6bad6fac9ee0b394bf0b044c61183e5
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a316c5dfbc6355f536d765959cacb06bbfed76ad 06-Jun-2015 Jeff Brown <jeffbrown@google.com> Fix Bitmap parceling through ashmem.

Fixes a bug where the Bitmap parceling code was unable to deal with
sending bitmaps through Parcels that disallow file descriptors.
Uses extended functionality of the Parcel blob interface to pass
buffers around more efficiently while adapting to whether FDs
are allowed.

Bug: 21428802
Change-Id: If24926f4388d29aa2aac627000436beb015edcb9
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
0781a2f116be045ff1a3aca721c47f9fef980bea 28-May-2015 John Reck <jreck@google.com> Fix reconfigure & setPremult alpha handling

Bug: 20948129
Change-Id: Ifba35e5d87772a304fd3655e4a2363b293a6d8ac
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
721ae5fec5f1fd4f93aa2a361a0ac298e15ce353 12-May-2015 Riley Andrews <riandrews@google.com> Add internal bitmap api for creating immutable ashmem backed bitmaps.

Bug 21037890
Change-Id: I827e83dd75e301e7d93ead5efdd744f0d8435ae5
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
39d7f30ebe490c1d6aee76b0b61e3e67dec13e34 14-Nov-2014 Riley Andrews <riandrews@google.com> Use ashmem to optimize all bitmap copies.

Bug 21037890
Change-Id: Ie32ca3a0c527755f1a1b77db7548cb9629e2001b
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
2a94a10bec186d832c2b95675cb6dc27b012c2d0 07-May-2015 Derek Sollenberger <djsollen@google.com> Update the rowBytes when reconfiguring to match the new imageInfo.

bug: 20872840
Change-Id: Ic98a9d16e095c27ddcc193a18641732c1ee4bad0
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.cpp
c6e2e8ff474ae44bab5b9eb665851118abd27b68 15-Apr-2015 John Reck <jreck@google.com> Move AssetAtlas off of SkBitmap*

Switched to SkPixelRef*

Change-Id: I4a1d9dc6c55c1ebcce6b0b8c585e69559e523898
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
7809f835cae637c12eebdc92103ad88890228d97 17-Apr-2015 John Reck <jreck@google.com> Revert "Move AssetAtlas off of SkBitmap*"

This reverts commit 87ffb63d90fb6dd2689fe72dcb24fda9a6156220.

Change-Id: I92adfcee454a0a19020cdd9e96a134be0ee529aa
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
87ffb63d90fb6dd2689fe72dcb24fda9a6156220 15-Apr-2015 John Reck <jreck@google.com> Move AssetAtlas off of SkBitmap*

Switched to SkPixelRef*

Change-Id: I4a1d9dc6c55c1ebcce6b0b8c585e69559e523898
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
ec419e0b731d2aa32f7f570e4021fe18b8be228d 11-Mar-2015 Leon Scroggins III <scroggo@google.com> Make Bitmap_createFromParcel check the color count.

When reading from the parcel, if the number of colors is invalid, early
exit.

Add two more checks: setInfo must return true, and Parcel::readInplace
must return non-NULL. The former ensures that the previously read values
(width, height, etc) were valid, and the latter checks that the Parcel
had enough data even if the number of colors was reasonable.

Also use an auto-deleter to handle deletion of the SkBitmap.

BUG=19666945

Change-Id: Icbd562d6d1f131a723724883fd31822d337cf5a6
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
3d4eed7f1aa99401dabe2e45b82f98fb4fc2d754 04-Dec-2014 Derek Sollenberger <djsollen@google.com> Update HWUI to store its own SkBitmap objects

This enables us to...

1) simplify the lifecycle/ownership between Java and HWUI
2) remove DisplayListRenderer::drawBitmapData and associated logic
3) track pixel lifecycle using standard SkPixelRef refcounting
4) Remove uncessary calls to ref/unref the bitmap's pixels and colorTable

Change-Id: I3c95078da20995444f6388a029414280fd654318
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
71487eb0ceb2b7dea02649e78d99bb5952f5eaef 19-Nov-2014 Mike Reed <reed@google.com> Merge frameworks/base changes from master-skia to master.

Adaptations to changes in Skia upstream since Oct 2014.
(https://code.google.com/p/skia/issues/detail?id=2377)

cbb922d use new roundOut signature
77082de Call SkColorTable::readColors().
5456ab1 Handle the result of SkMatrix::asAffine.
25cfc78 Remove dependence on SK_LEGACY_PICTURE_SIZE_API.

BUG:18468293

Change-Id: I5a4d274e854298843891410b1ffd5e24f038b88a
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a2732a2bf98f7dbd063f4e5679f5b8bfcbec2698 18-Dec-2014 John Reck <jreck@google.com> Stop pretending USE_OPENGL_RENDERER is a thing

Change-Id: I732b490431fe90eafa00a00f3b5429f0d3a067e6
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.cpp
a35778c799e8073a42b9e22191bde9d838327ab7 06-Nov-2014 John Reck <jreck@google.com> Yank ResourceCache out of Caches

Bug: 17947547

Pull the ResourceCache (aka, ref-counting side channel) out of
Caches so that DisplayListRenderer doesn't use Caches, avoiding
the risk of instantiating Caches on the wrong thread or
without a GL context

Change-Id: I7d63b70b3b0a0163308c5dedd6ef255eadebe8fd
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
f23f5de1731be798f03a7808cf205457522e5d2e 22-Jul-2014 Chris Craik <ccraik@google.com> Merge "[Bitmap] Add null pointer protection in Bitmap_sameAs()" into lmp-dev
53001ca3a629c0069f4fdac44f7711ad4a0c395a 03-Jul-2014 henry.uh_chen <henry.uh_chen@htc.com> [Bitmap] Add null pointer protection in Bitmap_sameAs()

Symptom: SkBitmap::getAddr(int, int) may return NULL due to unrecognized config
(ex: kRLE_Index8_Config). This will cause memcmp method to crash. Since bm0 and
bm1 both have pixel data() (have passed NULL == getPixels() check), those 2
bitmaps should be valid (only unrecognized), we return JNI_FALSE to warn user
those 2 unrecognized config bitmaps may be different.

Cherry-pick of 3a1bffa835f279628e50385af3c85789bc737f64 from AOSP

Change-Id: I6970c27de412110a3035d0a783112c4cd3ebc35b
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
6ba30b85ddfbe37c338ee8dde3dd33322eb38d47 15-Jul-2014 Behdad Esfahbod <behdad@google.com> Add android.Paint that inherits SkPaint

The idea is that extra paint parameters that only affect text layout
(not rendering) will go in android.Paint instead of going into
SkPaintOptionsAndroid. We will eventually move those out of SkPaint
too.

This is currently implemented in PaintImpl.cpp. Will be renamed when
current Paint.cpp that has JNI bits is moved to android_graphics_Paint.cpp.

Change-Id: Iba66c34dea5da503a13b9c864cb9f2211ac4ba7d
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
1103b3255945d2eb2fa9c191e84e2270b343cca9 08-Jul-2014 Mike Reed <reed@google.com> SkBitmap::Config is deprecated, use SkColorType

Change-Id: Ic953741325607bf85598c097bb3ab648d4a08996
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
57ee620ced8caed1eb8651717f6a6d2d5f1f9a5b 05-Jun-2014 Leon Scroggins III <scroggo@google.com> Read premultiplied status from the SkBitmap.

Replace the Java variable with mRequestPremultiplied, to better
reflect what it represents. In both native and Java, the SkBitmap
is used as the decision maker of whether a Bitmap is premultiplied.
When changing other settings, mRequestedPremultiplied is used to
determine whether it should be premultiplied (if the new config/
hasAlpha-ness etc supports it).

ChooseFromColorProc now reads both the colortype (instead of the
deprecated Config) and alphatype on the SkBitmap. Same with
ChooseToColorProc. In the process, this caught a bug, where the
wrong procs were being used for Index8.

Replace instances of SkBitmap::Config with SkColorType where I
was already changing code.

Use the new versions of setConfig/allocPixels that take an SkImageInfo
as a parameter.

Document isPremultiplied's return value for ALPHA_8.

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

Change-Id: Ic75b5fc6996578e9d95bd3a220439ec1541d7c3b
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
17a8bfc38a565ae96f43d36b223779be840bb50c 03-Jun-2014 Leon Scroggins III <scroggo@google.com> In Bitmap.reconfigure, update the pixelref's info.

This fixes CTS tests which are crashing on an SkASSERT due to a
mismatch of SkImageInfo between the SkPixelRef and SkBitmap.

Also directly call ref() and unref() instead of SkSafeRef/SkSafeUnref,
since we would already crash if the SkPixelRef in question was NULL.

Also if the user attempts to reconfigure to 4444, use 8888 instead.

Change-Id: I473ef225c6cd1c92d67ae103c53c6cff0dad92de
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
32054b0b3edb350a5444c47753b2982312dd7ffd 09-May-2014 Chris Craik <ccraik@google.com> Fix Bitmap.cpp line endings

Change-Id: Icc0b067437fffaa599c92841518ad0d526112f59
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.cpp
2d5cf4f6db75d00285306b2d53bc6c0c6532d86e 20-Feb-2014 Derek Sollenberger <djsollen@google.com> Update framework to enable Skia to run in debug mode.

Change-Id: I8ba605cfae61b584dad27e3245c4482c8dfdff2e
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
73c04711ca13c99f29a84de8cfc6c780811a8f63 13-Feb-2014 Leon Scroggins <scroggo@google.com> Remove call to setIsOpaque (again).

The call was removed in I1b36b0b0ce7126031eb7b769b563c17dcd4b306a,
since setIsOpaque was deprecated in Skia.

It was accidentally reintroduced in
Id5793fa0ebc17ee8b1eecf4b3f327977fdccff71. This line is redundant
with the lines above it (which call the replacement for setIsOpaque,
setAlphaType).

Change-Id: I6520f796d639721987418ec0ecae82b3674dcbfd
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.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/Bitmap.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/Bitmap.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/Bitmap.cpp
ed79ff0026a44741237a6eb5e3810dbf5d765154 20-Nov-2013 Derek Sollenberger <djsollen@google.com> framework changes needed to support Skia at r12108.

Change-Id: I231e187e7d2db84fa06bd6783c9b49abba5b4e70
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.cpp
3ed72781a0b155a88e52c8d295f50daab8cfb9ae 15-Aug-2013 Romain Guy <romainguy@google.com> Convert 4444 bitmaps to 8888
Bug #10206452

Change-Id: I928c9189b0d80741490b01a739959d8c2d5312a7
(cherry picked from commit a2cdb59b186d0ee51f110c1a7d358911573d48bf)
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
c84d203da21c3ae3ded94c79c035d41b27809b3b 13-Jul-2013 Chris Craik <ccraik@google.com> Add reconfigure method to Bitmap

bug:9797004

Grants a means to reuse a bitmap's allocation for different
width/height/Config without going through
BitmapFactoryOptions.inBitmap

Change-Id: Ib62319f3bd96c451fc1636288adf06a8275b4e3d
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
547e66531d521eb1eadac87edb0f79f8c2f1bbe0 23-Oct-2012 Chet Haase <chet@google.com> Don't null the reference to Bitmap pixels until we're really ready

A change in the VM triggers a native memory error more aggressively than before,
showing that there's a bug in the logic of recycling bitmaps. Since the pixel
memory is allocated on the Java heap, nulling out the reference to that memory
in the Java level Bitmap object can cause that memory to get collected at any time.
Meanwhile, we may have a reference to that memory at the native level for rendering
purposes, causing an error if/when we access that memory after it has been collected
by the VM.

The fix is to avoid setting the reference to the pixels to null unless we are
not referring to it in native code. This is determined at the time we call
recycle() - we return a boolean to indicate whether the native code is still
using the memory. if not, the Java code can null out the reference and allow the
VM to collect it. Otherwise, it will get collected later when the encompassing
Bitmap object is collected.

Issue #7339156 HTML5 tests crash the app (Vellamo)

Change-Id: I3a0d6b9a6c5dd3b86cc2b0ff7719007e774b5e3c
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
713e1bb9df6bdfc21bd5c40d1a6ecf6c822a4be5 17-Oct-2012 Romain Guy <romainguy@google.com> Add API to enable mipmaps on Bitmap
Bug #7353771

This API can be used when scaling large images down to a small size
to get nicer looking results.

Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
038953da05c641f6551134f710ac0e4f46b624b7 12-Oct-2012 Keun young Park <keunyoung@google.com> fix wrong read size in ToColor_S4444_Opaque

- S4444 takes 16bits, not 32bits
- This caused sporadic failure in CTS BitmapFactoryTest#testDecodeStream4

Bug: 7179389
Change-Id: Ib36a3a569b3149d74f36ae67a069a7b65a72e895
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
35ef567140e42f354be4a98cce6a7666ac085c13 08-Jul-2012 Michal Stawinski <michal.stawinski@sonymobile.com> Fix SkBitmap::fPixels not being locked correctly

In some cases bitmap's pixels where freed during encoding, which
caused a null pointer dereference.
This fix makes sure that underlaying buffer is locked for the whole
process of compression.

Change-Id: I0ac56821f5d333072271dc2670fa30f1562adfa3
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.cpp
d84e1ce0b535128f03416145554fb405f9fade3e 07-Mar-2012 Jeff Sharkey <jsharkey@android.com> Split Parcel JNI details away from Binder.

This is purely a refactoring, with no change to the underlying
functionality.

Change-Id: I41b59f14e57d1cc144274a01f77658d99a1bfe02
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
2c183fa5bf666c5f6b2221fd04db8ee3c738d1fd 19-Oct-2011 Romain Guy <romainguy@google.com> Notify a Bitmap is has changed when calling copyPixelFromBuffer

Change-Id: Ibff1a162edfe11473c5c167e764405bf83ec5822
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
6579a9d6fe2302fa149452f66c4062ebc60c2523 24-Sep-2011 Jeff Brown <jeffbrown@google.com> Transfer large bitmaps using ashmem.
Bug: 5224703

Change-Id: If385a66adf4c6179a0bb49c0e6d09a9567e23808
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
b6377170960d40e66858d8b4d335a95eac773762 25-Sep-2011 Bart Sears <bsears@google.com> Revert "Transfer large bitmaps using ashmem. Bug: 5224703"

This reverts commit 56c58f66b97d22fe7e7de1f7d9548bcbe1973029

This CL was causing the browser to crash when adding bookmarks, visiting the bookmarks page, and sharing pages (see bug http://b/issue?id=5369231
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
56c58f66b97d22fe7e7de1f7d9548bcbe1973029 24-Sep-2011 Jeff Brown <jeffbrown@google.com> Transfer large bitmaps using ashmem.
Bug: 5224703

Change-Id: Ic7481dd9f173986f085a8bbdcc59bbe9830d7a44
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a2c8a7b5739c1febf8ffbf9461334343bdadab16 27-Jun-2011 Jean-Baptiste Queru <jbq@google.com> am ec5039b3: am 99c070d8: am 4fea5373: Merge "Add WEBP to the list of Image formats that support Compression."

* commit 'ec5039b3720ee9b92fb2a2c6dd9f468d2dcd7172':
Add WEBP to the list of Image formats that support Compression.
ec5039b3720ee9b92fb2a2c6dd9f468d2dcd7172 24-Jun-2011 Jean-Baptiste Queru <jbq@google.com> am 99c070d8: am 4fea5373: Merge "Add WEBP to the list of Image formats that support Compression."

* commit '99c070d8eb9f1ff9ea5c38991f15f091040226c2':
Add WEBP to the list of Image formats that support Compression.
2305ac9e4a262ed09fd034ae417e9b1dda4c0ccb 23-Jun-2011 Vikas Arora <vikasa@google.com> Add WEBP to the list of Image formats that support Compression.

Note: The integrator of this change to Android internal code-repo will
have to run one extra step 'make update-api' to update 'api/current.txt'
file corresponding to approved API. The AOSP branch didn't have this
file, hence I could not add the same to this change. The updated file
'api/current.txt' has to be submitted along with this change.

Change-Id: I29909e907a2e82d801e16654322190a808c5bda9
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
c9e22e9affec97a8c68f838de29dc7f685d9247b 12-May-2011 Jean-Baptiste Queru <jbq@google.com> Switch to SkSafeUnref for better portability

Change-Id: Ia146a4728b5eb92626462effe42521ca73454a7d
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
4cb1753ec6e90d7e747880c599dc1c164a568cf3 13-Apr-2011 Elliott Hughes <enh@google.com> Remove useless forward declarations.

Change-Id: I8f191367acb18ea9a3f807e791099e0485b1b249
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
1a81aea8144b92ebaf807af9de69a0ab3415a5aa 21-Mar-2011 Romain Guy <romainguy@google.com> Update GL textures when changing a Bitmap's pixels
Bug #4146495

Change-Id: I4fe3f8501373b86b164af11ae51642b140035bb8
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
447ee77431ddd68634bd49508de8573ab6c7065a 24-Feb-2011 Eric Hassold <hassold@google.com> Merge "Detect out of memory in extractAlpha"
ef7be262e5859efdf805d1b9612bc2b250d5971e 24-Feb-2011 Eric Hassold <hassold@google.com> Detect out of memory in extractAlpha

When extractAlpha() native method in Skia fails to allocate pixels,
it resets target bitmap. This change detects when such empty bitmap
is returned, and throws a OutOfMemory Java exception.

Depends on https://android-git.corp.google.com/g/97793

Bug: 3418381
Change-Id: I65a84998be089c49ed5005f6995bdc4f4d1669bc
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
6062c5912dc79704b489fc8c289b78a400ed05ee 22-Feb-2011 Derek Sollenberger <djsollen@google.com> Skia Merge (revision 808)

This is a companion CL to the one found in /external/skia

Change-Id: If81748545435cab20a5d8479329ab333cb973e16
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.cpp
dee4cb07a3652457e18a0bf4be57d2cedeca7359 13-Dec-2010 Jack Palevich <jackpal@google.com> Avoid SIGSEGV in Bitmap_writeToParcel.

SkBitmap::getPixels() can return NULL. The rest of the JNI Bitmap
code treats this NULL as if the SkBitmap has transparent black
pixels. Bitmap_writeToParcel now does the same.

Change-Id: I5e70b42b3d22a8aea898ce342e590000325bd0f9
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
27f0b17d853d8bef918c3d869044e50cf3904ee3 22-Oct-2010 Chet Haase <chet@google.com> Fix native resource leak when OpenGL renderer is not being used.

Native resources (bitmaps, matrices, paints, shaders) are shared when display lists
are used, and a refcounting system is in place to take care of disposing when all
clients are finished with them. But the cache where these refcounts are tracked is
not enabled when the Open GL renderer is not being used. This results in the native
destructors not being called, and the resources are leaked.

Change-Id: Ic7aeb55e4636dcad229846601407e596160346e6
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
5c13d89c1332fcc499379b9064b891187b75ca32 08-Oct-2010 Chet Haase <chet@google.com> Optimizing display lists by referencing pointers to resources instead of copying them

Change-Id: I81ad3551d74aa1e5bb64d69e33d2eb29a6c1eb6a
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a2341a9f6addcd79723965ec5b1a1c5ae0f8bd65 09-Sep-2010 Romain Guy <romainguy@google.com> Purge Skia objects from GL caches as needed.

Change-Id: I754c671cf790ad5ae8bf047ad328034217da4ecc
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
9aaa8269a3e7291aab84d01c3fc9c744d8f2d2f4 09-Sep-2010 Romain Guy <romainguy@google.com> Fix possible infinite loop when purging textures.

Change-Id: Ib05b398ae03e734da2dab0496df416fed4570b1c
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
0bbae0836426ba2704e38e7f90a9d0ca502ab71d 16-Jun-2010 Romain Guy <romainguy@google.com> Add new API to check whether a Bitmap was modified.

Bitmap.getGenerationId() can be used by caches to find out if a Bitmap has been
modified. This simply exposes an existing Skia API.

This change also adds a small test app for Canvas hardware acceleration. The new
Bitmap API is required to implement a texture cache.

Change-Id: I8547b146cd14c8afe1a2327fcd6d71b1b1cb68fc
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
76d1e01d5e65c4631c827831e98ad4e300d99eab 05-Mar-2010 Mike Reed <reed@google.com> hidden api sameAs() to compare the pixels of 2 bitmaps for equality
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
a78b0a2d9ebb38b86ed802b3d86de07d0b301262 07-Oct-2009 Mike Reed <reed@google.com> add (hidden) setHasAlpha() to allow clients like the view's cache to hint that a bitmap is opaque.

Knowing that a 32bit bitmap is opaque is a performance boost for some blits.
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
de0dfb7b65a02d4dd74c271b558adee0973fc267 23-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2125720 Weather Forecast Widget - graphics do not scale

I forgot to add the new density field to the Bitmaps' parcelable data.

Change-Id: I77cf3e93e356297e0caed6fc71b62b5cd8f79124
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
c634fdd8035cc06c34663b77ab199d29697273b4 18-Jul-2009 Android (Google) Code Review <android-gerrit@google.com> am 09a903ab: Merge change 7696 into donut

Merge commit '09a903ab5b8d940605783ae4ee591c0f090a31d1'

* commit '09a903ab5b8d940605783ae4ee591c0f090a31d1':
add hidden Options field for native allocations
1b22b979256cf163ab9bbfd4fcfa16a8ce862ed1 17-Jul-2009 Mike Reed <reed@google.com> add hidden Options field for native allocations
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
ce1311a3a0806d39dc675a3c702eebbfe741dec8 22-Jun-2009 Android (Google) Code Review <android-gerrit@google.com> am 766d7236: Merge change 4737 into donut

Merge commit '766d7236c84f636b816d71189e309e67db1f593a'

* commit '766d7236c84f636b816d71189e309e67db1f593a':
Add prepareToDraw() to Bitmap for fixing http://b/issue?id=1907995.
8cdcb12752b716d0407733fecefcf1d9e926310a 18-Jun-2009 Wei-Ta Chen <weita@google.com> Add prepareToDraw() to Bitmap for fixing http://b/issue?id=1907995.

The function is used to rebuild any caches associated with the bitmap.
In the case of purgeable bitmaps, this call ensures that the pixels
are decoded for drawing, and therefore prefetching techniques
implemented by callers can be leveraged.
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
0795272aa226f4e965968a03daddc53ce30b7cda 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.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/Bitmap.cpp
f1e484acb594a726fb57ad0ae4cfe902c7f35858 22-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127436
/frameworks/base/core/jni/android/graphics/Bitmap.cpp
b798689749c64baba81f02e10cf2157c747d6b46 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/frameworks/base/core/jni/android/graphics/Bitmap.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/Bitmap.cpp
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/jni/android/graphics/Bitmap.cpp