History log of /frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
50954d2b4ea938d787ef5021d75f6bc02826607a 15-Apr-2017 Adam Lesinski <adamlesinski@google.com> Propagate density through AdaptiveIconDrawable and BitmapDrawable

Resources#getDrawableForDensity now propagates the overridden
density through to AdaptiveIconDrawable so that the density can be
propagated to leaf BitmapDrawables correctly.

This enables AdaptiveIconDrawable to support higher resolution
foreground/background bitmaps for use in Launcher.

Bug: 36039665
Test: bit CtsContentTestCases:android.content.res.cts.ResourcesTest
Change-Id: Iaa9a5592626e38e1ff839a76f7c6cfb9e16e5dc1
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
4a81674b45b7250c4e2a80330371f7aa1c066d05 02-Feb-2017 Jiaquan He <hejq@google.com> Detect unhandled keyboard focused state.

A View uses a Drawable as its background, which changes
its appearance according to the View's state. This commit
adds an algorithm to detect undefined state_focused in
state specs for those Drawables.

Test: cts-tradefed run singleCommand cts --skip-device-info
--skip-preconditions --abi armeabi-v7a -m CtsGraphicsTestCases
-t android.graphics.drawable.cts.DefaultFocusHighlightTest
Bug: 35096940

Change-Id: I5e9f07141679881fe88f9040aa116ea2f9d537c9
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
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/graphics/java/android/graphics/drawable/BitmapDrawable.java
0d2a46b7336b6d255f202b878003be59ecbae52b 07-Oct-2016 Alan Viverette <alanv@google.com> Scale bitmap shaders for target density

Also fixes progress bar sample tile to reflect density and ensures
that ProgressBar.tileify() clones inner drawables into the correct
density.

Bug: 31841123
Test: BitmapDrawableTest#testPreloadDensity()
Test: ThemeHostTest
Test: Visual inspection of ApiDemos
Change-Id: I9dcb9817d8d91d61ff0215987247e9e7fb089c46
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ac85f90466dd60d2af8ffc3942d503a0de606726 11-Mar-2016 Alan Viverette <alanv@google.com> Ensure all Java-side usages of config flags are using Java flags

Previously we were using native config flags in some places that expected
Java flags, and vice-versa. All usages of config flags are now annotated
to ensure we're using the right type.

Cleans up annotations on most methods that were touched.

Bug: 21161798
Change-Id: Ifd87dfb12199fc8258915d8a510e03ddb681ca89
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
7cd1f0d39ada62669fb9bcd0a71fab059386fcd3 10-Feb-2016 Jorim Jaggi <jjaggi@google.com> Do not invalidate drawable if tint doesn't change

Change-Id: I99d7a679ba3aa4978f2915f1a52f23dbce7fd971
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
c078c605ab904b0e4a5d793cbeffd78c340f2816 08-Dec-2015 Alan Viverette <alanv@google.com> Attach drawable resource ID and name to getDrawable() exceptions

Wraps the entire getDrawable() method in a try/catch block. Clears the
stack trace from the re-thrown exception, since we only need the trace
from the original exception.

Also clears stack traces from re-thrown RuntimeExceptions in applyTheme
implementations.

Change-Id: I92396abf9e748eef78777174b297a09e118f5e70
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ce52037e0ae0c380f5b834fb3dad105bfaf5e374 30-Oct-2015 Alan Viverette <alanv@google.com> Support for changing density of GradientDrawable

Refactors density resolution and offset/size scaling into static
helper methods.

Also fixes VectorDrawbale insets to be treated as offset-type pixels
rather than size-type.

Bug: 25081461
Change-Id: I10fcb9ebb6c67f853a27ca0ee008c31af4b85da0
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
82af13ea831bbf8dbb8caf06b8ecbee5a31fc446 14-Jul-2015 Chris Craik <ccraik@google.com> Remove ImageViewBitmapDrawable class

Change-Id: Ie25b4b39cb5d0984981c153b036ea9ade95a10f7
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
b7ba1220a3dc3012d2e22825eaeb0e643333f5a4 10-Jul-2015 John Reck <jreck@google.com> Teach ImageView to recycle internal drawables

Bug: 22289362

It's pretty common for ImageView#setBitmap to be called
repeatedly. Avoid re-creating the BitmapDrawable in this scenario
as that has high object churn of semi-expensive objects like
Paint.

Change-Id: Ib77719cd0366d02c1a42f774850bf3b9caa9c288
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
81e7dbddf10ecae99f65641d8774ca6b1aceac30 23-Jun-2015 Alan Viverette <alanv@google.com> Remove isDither(), deprecate setDither()

Bug: 22013358
Change-Id: I37b11a94edc431a88522c6c056b76b045daa61d6
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
373954a1fd371a23c420aeeea9ccbc4d983733d7 17-Jun-2015 Alan Viverette <alanv@google.com> Refactor Drawable.getDither() to isDither()

Bug: 21342040
Change-Id: I801970c2a25289d670636ad5387ddf244fb48225
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
63a39ffe489e1411f96ab54002b83c7d28bb5ffc 17-Jun-2015 Alan Viverette <alanv@google.com> Ensure first load for bitmap and nine-patch gets correct density

Remove unnecessary lines setting target density on bitmap and nine patch,
since we'll do this later in inflate().

Bug: 21774853
Change-Id: I5ea316bee81f82192ce20f2f1bee0e62c6ec8ccb
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ea1363910bf2138f633ef8a310a65d608ef94407 14-Jun-2015 Chet Haase <chet@google.com> Add isFilterBitmap() overrides where appropriate

Issue #21825791 add isFilterBitmap() override to appropriate Drawable subclasses

Change-Id: I5cbd72c034be79b0aa53815c7a5a8ea499e6e02d
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
e0f95f39c5a669a48ee3ebb8dc45bf2d7ee940f1 01-Apr-2015 Alan Viverette <alanv@google.com> Fix issues with theming of preloaded ColorStateLists

Ensures changing configurations mask is propagated to the host drawable
so that it can be properly cleared from cache on configuration changes.
Also fixes constant state handling of the mask in the Inset and Rotate
drawables.

Hides new ColorStateList methods related to theming, since they should
only be used during preloading or internally by framework drawables.

Fixes bug where the cached versions of themeable ColorStateLists were
modified by calling applyTheme() on the host drawable.

Also cleans up some docs and naming in GradientDrawable.

Bug: 19966397
Change-Id: I8c8d3cabbaf94b488c2b8fe9fd423e07d824c19c
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ee7c65d539cb12fe7f8b753fa4b94c2734469fdf 27-Mar-2015 Alan Viverette <alanv@google.com> Only verify resolved theme attributes

Bug: 19962473
Change-Id: I62eb2faea7b09fd483194b41e815179cb2141fcb
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
bd3bfc5285dcacff0a69fecf3baeeeb90d887a58 02-Mar-2015 Chris Craik <ccraik@google.com> Improve docs for drawable tint and color filters

bug:19564477
Change-Id: I7e11baae2d4dd245965904c85b8855de71f6b6ac
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
f4c068b72e2dee2e6944488ef00b64c93217d7e8 06-Jan-2015 Alan Viverette <alanv@google.com> Add getDither, getFilterBitmap to Drawable for CTS testing

Also removes unnecessary overrides from PictureDrawable.

Change-Id: I13539b5204e8c0d8b9912da14de7ceae62720e3f
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
45c4bbbbce6bbad50a033efcba7948a23f1f117a 05-Jan-2015 Alan Viverette <alanv@google.com> Allow use of theme attributes in color state lists

BUG: 17384842
Change-Id: Ibdc413acbd00e37b908432abd55f6521c22b8fc9
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
dad7d84c04c5954b63ea8bb58c52b2291f44b4df 09-Dec-2014 John Reck <jreck@google.com> Teach AssetAtlas about more drawables

Bug: 18317479

Change-Id: I16868ee204d24af72af9a2efc987f7e9eb1d266b
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
17cd4dfe3a05c2eddbcbc76066ff3b13fc3f2c8b 14-Oct-2014 Alan Viverette <alanv@google.com> Update preload list, clean up drawable theming

Removes all implementations of three-arg ConstantState constructor, since
we handle mutation and applyTheme() in Resources now. Moves progress bar
tinting to android:tint attribute. Correctly implements applyTheme() and
canApplyTheme() in all drawable wrapper and container classes.

Change-Id: Ic9cb43d0d6228aa4914f3124bed234b837beaa41
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
727cae197b123ef764a1f8fbe08a995b000d14c3 08-Oct-2014 Alan Viverette <alanv@google.com> Mutate and apply theme if needed before caching themed drawables

This ensures that drawables are completely separated from their cached
constant states before applying a theme. After this, we can remove the
implicit (and incomplete) mutation in the clone constructors.

Also implements missing mutate() method on ClipDrawable.

BUG: 17646144
Change-Id: If0d66b0a85724d76e0a4f506758c7ba3c0aa3410
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
607bd848269fb802550e63aa61945790616f97a7 12-Sep-2014 Alan Viverette <alanv@google.com> Update icons to vectors, fix preload theming & vector tinting

Adds a missing JNI binding to AssetManager, ensures drawables have
default tint modes as documented, and updates vector tint appropriately
when state changes.

BUG: 17385604
Change-Id: Ice92885989ebc13b95952f5dc3b7904cc956da12
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
fe7a18eeada1bf2553ca00afb71b372bd79666dd 20-Aug-2014 Chris Craik <ccraik@google.com> Make getOutline account for gravity BitmapDrawable

bug:17112454

Also cleans up several subtle bugs in updating gravity/tile mode/insets.

Change-Id: Idbd2c52e5f572d11b651f5e93d000535880f5708
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
9745de0f0559bccd7b4a2f80b5ff8c8f118c7bfc 18-Aug-2014 Chris Craik <ccraik@google.com> Fix BitmapDrawable outline crash

bug:17103753

Change-Id: Ia3d2c7d61b3f3b9ea8879f941d726d8627e155bb
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
e222e359a0aab985488a711f6edb76820fe8c6df 14-Aug-2014 Chris Craik <ccraik@google.com> Disable shadow casting for transparent BitmapDrawables

bug:17013977
Change-Id: I26328c21360432bb34d3f19858dfdc0e6aede057
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
a426445dfdab43886dd894f2ba8a1d55bfcbb278 29-Jul-2014 Alan Viverette <alanv@google.com> Separate tint and tintMode properties

BUG: 16054922
Change-Id: I820fb857b671faf9eb27612e470e820c5c4cd6b5
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
4f64c048505a432e549ccb756634ecebf28f9e80 22-Jul-2014 Alan Viverette <alanv@google.com> Clean up view tinting APIs, tileModeX/Y attribute docs

BUG: 16400590
BUG: 16403307
Change-Id: Ie924815a39eb0e683d1982b08ec478ed3edbfb7b
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ab87983a11e0bd2e08d752d86d5e945ea7d39a04 09-Jul-2014 Leon Scroggins III <scroggo@google.com> Simplify Shader.setLocalMatrix.

Previously, calling setLocalMatrix updated any Paint that had the
Shader attached. This depended on deprecated behavior in Skia. Use
new Skia APIs, and do not modify any Paints that use the Shader.

In addition, update callers to call setShader (again) after modifying
the Shader.

Sample app at ag/499573 for testing.

Depends on I673801444f0a8fd4f192b5b7effdde1aa83e702b in external/skia.

BUG:14315916
Change-Id: I3c3316377874e89fccc85afb864bc038b0ef3890
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
8e5e11b99fac942122ee2d6cdd30af51564861ae 07-Jul-2014 Alan Viverette <alanv@google.com> Handle configuration changes in drawable attributes

Adds themeable attribute support to InsetDrawable, adds support
for attribute configuration changes to all themable drawables.

BUG: 16045735
Change-Id: I3dc62d28801760ac69d303be81b6c78bb9bb5aca
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
22594f097242d9de0a538a9b8142f77da9df7ebd 21-Jun-2014 Alan Viverette <alanv@google.com> Add tileModeX/Y attrs to BitmapDrawable, tint to ShapeDrawable

Change-Id: I1c9efe39bfd5286230cee8354822db81f05186e4
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
5adf8ee451085ed6106b7dbadc6d8dcd9d90722b 18-Jun-2014 Alan Viverette <alanv@google.com> Fix bitmap tinting

BUG: 15716407
Change-Id: I4008c9763fedc2f716040cd3f73ad79d77343960
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
b3c56086d802ae28888dd97ba1f49bd6cee0b673 14-Jun-2014 Alan Viverette <alanv@google.com> Add support for setTint in all Drawables, clean up lint warnings

Change-Id: I962089ca59684cef28cb4a648d4a91e542bdf5d4
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
cda212d79d449468384cc7744878b8c99984059c 14-Jun-2014 Jeff Brown <jeffbrown@google.com> Revert "Add support for setTint in all Drawables, clean up lint warnings"

This reverts commit 381f83b613f7b6e71180983dbb992ff62f8dd6e3.

Change-Id: I1181f436c647216ac46162260d9d886197b24568
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
4b17118aca1e67963254ab83504b0753a3eac7ce 14-Jun-2014 Alan Viverette <alanv@google.com> Add support for setTint in all Drawables, clean up lint warnings

Change-Id: Ia38b9d3e9d5c0072382050e815bdd9232b672e50
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
06318a0869b9f214bc97cabf1d2b6854acb6431b 06-Jun-2014 Alan Viverette <alanv@google.com> Update drawables to fix CTS test failures

Change-Id: I78617aedab450f5bc18807c03d07ee776584ece0
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
d30241541c3adcb126bb263ad8596e7902a6b5ae 23-May-2014 Alan Viverette <alanv@google.com> DO NOT MERGE Fix build.

Change-Id: I2e9f7f27c94b9f9240a5ca76952024055ff79878
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
2356c5e69b0911e6334ebf6374217898371be5ac 23-May-2014 Alan Viverette <alanv@google.com> Update switch, checkbox, radio button, button, and toggle button

Add optical inset support to BitmapDrawable with gravity. Fix optical
inset support in DrawableContainer. Fix visibility change support in
AnimatedStateListDrawable. Adds a whole bunch of missing drawable
support to CheckedTextView.

BUG: 15127013
BUG: 15126976
BUG: 15125529
BUG: 15025806
BUG: 14597955
BUG: 14594498
BUG: 15152746
Change-Id: Id2d99e10838d25b6f927ca1e49996c8da8e78ab1
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
e7772d313b88e9fd3366670a9c8d1b145edef344 22-May-2014 Alan Viverette <alanv@google.com> Move setTint into Drawable, unhide getDirtyBounds on Drawable

BUG: 15089957
Change-Id: Ib622ba24b3f4bcf430e1d524895ac5cb104a232e
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
0cfb877f5a0a1bff82d9c3ee969195bf7812c0b5 15-May-2014 Alan Viverette <alanv@google.com> Simplify attribute extraction for themed Drawables

Also fixes a bug in GlowPadView that randomly popped up.

Change-Id: Id20508a44ea02b4a14c8f794de36e13a2c06587c
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
307ad09228ebf70f1b456f5f00540c0126277850 18-Apr-2014 Alan Viverette <alanv@google.com> Add alpha to bitmap, nine patch drawable, fix container hot spots

Also fixes primary text disabled state alpha.

BUG: 13818888
Change-Id: I9ae2e25216014177c2dac24f5c9095df87724a43
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
2f8ba8f7fad2b608102a9282219aaea2223e94f5 09-Apr-2014 Alan Viverette <alanv@google.com> Update supported Drawable tinting modes and docs

Change-Id: I9c20d2bc4dc499f91c21a348871cf209c1065ba6
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
52b999f0721b53e9c6e18a4bd664e89aeb65b2d5 25-Mar-2014 Alan Viverette <alanv@google.com> Implement APIs for obtaining, caching themed Drawables

When Drawables are inflated during preload (or otherwise without a theme)
they cache their themeable attributes in their constant state as an array
keyed on attribute index. Drawables inflated with a theme will simply
resolve theme attributes as part of normal inflation, and they will not
cache any themeable attributes.

Drawables obtained from Resources are pulled from theme-specific cache
when possible. If an unthemed Drawable exists in the preload cache, a
new constant state will be obtained for the Drawable and the theme will
be applied by resolving the cached themeable attributes and overwriting
their respective constant state properties. If no cached version exists,
a new Drawable is inflated against the desired theme.

Constant states from themed drawables may be cached if the applied theme
is "pure" and was loaded from a style resource without any subsequent
modifications.

This CL does not handle applying themes to several Drawable types, but it
fully supports BitmapDrawable, GradientDrawable, NinePatchDrawable,
ColorDrawable, and TouchFeedbackDrawable.

BUG: 12611005
Change-Id: I4e794fbb62f7a371715f4ebdf946ee5f9a5ad1c9
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
af7c240b99506d2c81a72be738eb270ecaa39699 27-Feb-2014 Alan Viverette <alanv@google.com> Restore getTintMode() method on BitmapDrawable

Change-Id: I8fffc90ce3f0811d75b517d2dfc71de731188da6
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
09ceac298cc12471e4575fe49f97766c1ed7b2a1 27-Feb-2014 Alan Viverette <alanv@google.com> Clean up tint API

Change-Id: I56056e7596840c563f5332922d63e8893a0cac17
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
813d85b82cb7cbaa5dbe05496d1038caa17a1698 27-Feb-2014 Alan Viverette <alanv@google.com> Fix progress bar tinting, add tint support to ShapeDrawable

Cleans up APIs a little, since I think we may want to add tinting
modes beyond what Porter-Duff can provide. Plus we don't actually
support some of the Porter-Duff modes in hardware.

Change-Id: I2cea1b737cc93607a24842c54eb9f0d8346b29d4
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
12b97f5d2b15194ed6673c9838b13c8312157709 24-Feb-2014 Alan Viverette <alanv@google.com> Change colorFilterColor to tint, allow use of ColorStateList

BUG: 13149901
Change-Id: I6487bec372cb74db53d7bbdfa35de071764763b0
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
16f1d81d47beb1e04504a76de66e2919dde08c33 31-Jan-2014 Alan Viverette <alanv@google.com> Revert "Cache display lists for Drawables"

This reverts commit c062c7003f34999632fe4ad721dcd47cd71b2159.

Change-Id: I96d4f0482b927101f52140b667f4c38ffc8687f5
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
c062c7003f34999632fe4ad721dcd47cd71b2159 15-Jan-2014 Alan Viverette <alanv@google.com> Cache display lists for Drawables

Change-Id: I86e2dd4cd4ac8871f4131450cb9082c2b8de2eed
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
d9e788c4f0528e46db4a035cfac043736becb0d1 07-Jan-2014 Alan Viverette <alanv@google.com> Add support for specifying Drawable color filter in XML

BUG: 12178044
Change-Id: Ie118aebf56bb4580c97b625e20f4e76bed4b6f6f
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
31049d76c55b18a6d9993f0d9687598740b16014 07-Oct-2013 Adam Powell <adamp@google.com> Use SCREEN Xfermode for keyguard badges; update SeekBar

Plumb through the necessary API features through Drawables and
ImageView but leave it hidden for now pending future API review and
plumbing through the rest of the framework Drawable implementations.

Update SeekBar assets used for keyguard transport control.

Set selected status directly instead of finding views by id.

Bug 10531608
Bug 10784913

Change-Id: Ia38bd04ad1bc26e9e6da1dda8a374c9ba3ceccb3
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
3f5a90b2fbba2a83a8a2c5babd5d466a5e0ad2aa 25-Jun-2013 Fabrice Di Meglio <fdimeglio@google.com> Add automatic Drawable mirroring capability when in RTL layout direction

- default value is "no mirroring"
- introduce android:autoMirrored as a new attribute for Drawable,
BitmapDrawable, LayerDrawable, StateListDrawable and NinePatchDrawable
- setting android:autoMirrored="true" means that the drawable will
be mirrored when the layout direction is RTL (right-to-left)
- also fix an issue with ImageView drawable layout direction not
updated correctly when RTL properties were changed

See bug #7034321 Need Drawable RTL support

Change-Id: If595ee5106c786f38e786d3a032e182f784a9d97
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
3b748a44c6bd2ea05fe16839caf73dbe50bd7ae9 18-Apr-2013 Romain Guy <romainguy@google.com> Pack preloaded framework assets in a texture atlas

When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.

This CL introduces an asset server that provides an atlas to all processes.

Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.

WHAT IS THE ASSETS ATLAS

The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)

HOW IS THE ASSETS ATLAS GENERATED

Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.

There are several steps that lead to the atlas generation:

1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas

2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.

3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.

HOW PROCESSES USE THE ATLAS

Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.

It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)

Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.

Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
3fc184cf6e6f3e1d3e3360be11c76e0d081afaa1 26-Apr-2013 Scott Main <smain@google.com> am 01e48e7d: am 22f6a60e: Merge "add docs for new attributes, including account restriction for restricted profiles" into jb-mr2-dev

* commit '01e48e7d1541920ece358257e4c2481936497835':
add docs for new attributes, including account restriction for restricted profiles
b40c1fdaee6e6cabea8d1ed78f56d5b6bd133cfb 23-Apr-2013 Scott Main <smain@google.com> add docs for new attributes, including account restriction for restricted profiles

Change-Id: I737ea55bfa58562b1b384e52626e95b479759376
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
b1af7f3d4be6cd6bc6e1e805f22c209e19bf928f 08-Mar-2013 Chet Haase <chet@google.com> add getAlpha() to Drawable

Drawable has setAlpha(int), but no getAlpha() (although some subclasses have added the
method). This makes it more tedious to use the property. For example, animations that wish to
animate this property must explicitly give it a start value since this value cannot be queried
from the object.

The trick is that setAlpha(int) is abstract, only implemented by subclasses. We cannot take this
approach for getAlpha(), as we would break all subclasses of Drawable until they implemented the
method. Instead, we'll add a default method which returns an invalid value, making it easier for
clients of the method to detect whether the value is valid.

All subclasses of Drawble in frameworks have been changed to add an override of getAlpha() when
appropriate.

Issue #7485875 Drawables is missing getAlpha()

Change-Id: I06b6e35f1a56d202838eca44759c85c82595020a
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
7ac40e38696aa74d7b7938add8fdbc47180ae424 08-Feb-2013 Romain Guy <romainguy@google.com> Deprecate useless BitmapDrawable constructor
Bug #2590549

Change-Id: Icb45bf2d9836c43ed0825105f64d7b98afcdcdac
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
5769fcd88a6b53aa9394d869a9428c80e61a1565 27-Nov-2012 Romain Guy <romainguy@google.com> Add new mipMap attribute to BitmapDrawable

This attribute can be used to enable/disable mipmapping on bitmaps.
See Bitmap.setHasMipMap() for details.

Change-Id: I13cc800a258b6876a94e2a9605dcec4ea4f1ea48
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
684385ddde2ac0c26de0862390ad713aff3fb149 19-Sep-2012 Romain Guy <romainguy@google.com> mutate() didn't work as advertised
Bug #7162705

Change-Id: I15b2663fa7f1c71a2a3479134b8b7f37bfcbc607
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
5f49c3023a512efbef8bc9515d310c7a72be4af2 07-Sep-2012 Romain Guy <romainguy@google.com> The drawables cache strikes again
Bug #7117785

Draawables created from the ConstantState cache found in Resources must be
mutated before they can be safely modified by apps. Failure to do so results
in all drawables sharing the same constant state to be affected by the
modification.

In the case of the bugreport above, the status bar code plays tricks with
a background drawable and modifies its color to implement a fade in/out
effect. This drawable comes from a cached resource (color 0x0) and the
modifications made by the status bar apply to other clients of this drawable,
most notably the recents panel.

This change fixes several things:
- Simplifies colors caching by removing the assetCookie from the key. This
should result in better reuse of cached drawables
- Makes View.setBackgroundColor() honor the mutate() contract
- Ensure StateListDrawable properly mutates its children before modifying
them
- Optimize Bitmap/ColorDrawable to mark them mutated when they are not
created from an existing ConstantSate. The same optimization should be
applied to other drawables in the future

Change-Id: I54adb5d5b914c7d8930bf9b46f7e3f9dcbf4bcab
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
b03b434089cf2106c467b2827a65e5c589c91d01 04-Jun-2012 Fabrice Di Meglio <fdimeglio@google.com> Revert "Revert "Clean up layout direction APIs for Drawable""

This reverts commit c96132ff53e5c26f5b0170edd85072006fb2bc70
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
c96132ff53e5c26f5b0170edd85072006fb2bc70 02-Jun-2012 Jean-Baptiste Queru <jbq@google.com> Revert "Clean up layout direction APIs for Drawable"

This reverts commit c1da65187a4b9de8f72bd617ef937030187c0a92.
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
c1da65187a4b9de8f72bd617ef937030187c0a92 01-Jun-2012 Fabrice Di Meglio <fdimeglio@google.com> Clean up layout direction APIs for Drawable

- see bug #6427629

Change-Id: I3119db3022bba0ee325b6d0d4471bfebd850ec10
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
b1216dd916e0f5fdec29684120c5bcc904800916 02-Aug-2011 Romain Guy <romainguy@google.com> Copy constructors should actually copy stuff.
Bug #5027094

Change-Id: Iab6bf652e0b9bdd1bbc794e7c4218f46bafdd1a4
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ad4f70306b2089a273635b73a101fe48aa36cbe2 22-Jun-2011 Chet Haase <chet@google.com> Fix flashing artifacts caused by invalidation bugs

Therea re 2 fixes here:
- We sometimes cleared a flag in ViewAncestor too soon that controlled
how invalidated areas were redrawn (related to whether the invalidates
happened on opaque views or not).
- TransitionDrawable was always setting/restoring alpha values on its
drawables every time it was drawn. setAlpha on BitmapDrawable causes
an invalidation, so essentially this was an infinite invalidation/redrawing
loop. The fix was to notice when the animation was done and to simply
draw the appropriate drawable[s].

Change-Id: I1849a5a909b0039a0e9bce0aa3cfc33c50f8f854
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
c0053223bedf33581b0830fb87be32c1f26e5372 13-Jun-2011 Fabrice Di Meglio <fdimeglio@google.com> Add View.getResolvedLayoutDirection()

- update Callback2 interface
- update Gravity.getAbsoluteGravity() and Gravity.apply() to be more generic
by changing "boolean isRtl" parameter to "int layoutDirection"
- fix BiDiTests for RTL FrameLayout

Change-Id: I97bb456c22d5fd3ecb34f08564ce4dbed37e7459
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
6a03640539405afbdefe72894759281b98aa6e6f 23-May-2011 Fabrice Di Meglio <fdimeglio@google.com> Add support for Gravity BEFORE and AFTER

- update layouts
- add Callback2 for RTL aware Drawable
- add unit tests

Change-Id: Ic64d0291e262170aff7297c6580b0b422eaa8d89
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
17f83df9604ef9239694e8fd5a9efb894fd28453 30-Apr-2011 Conley Owens <cco3@android.com> am 7dcdfd79: am f26ec38c: am 501f7bca: Merge "Eliminating dead logic - bitmap state simply cannot be null here."

* commit '7dcdfd7988d1e57c7a705a2d7294e8bfa2b8afc9':
Eliminating dead logic - bitmap state simply cannot be null here.
7dcdfd7988d1e57c7a705a2d7294e8bfa2b8afc9 29-Apr-2011 Conley Owens <cco3@android.com> am f26ec38c: am 501f7bca: Merge "Eliminating dead logic - bitmap state simply cannot be null here."

* commit 'f26ec38c344af8cf91575b461028a3033b940d49':
Eliminating dead logic - bitmap state simply cannot be null here.
e42143aa575dcb8ab0616080b2e9b4614a1a4167 19-Apr-2011 Jozef BABJAK <jozef.babjak@gmail.com> Eliminating dead logic - bitmap state simply cannot be null here.

Change-Id: I33fdf650b06242efa22ca30b3f7252f6854b42f6
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
2660a3ec8564918a243b1b02e3652c514bc93bfc 30-Mar-2011 Romain Guy <romainguy@google.com> Move the drawable state to the correct class.
Bug #4170455

The state tracking whether the Paint's shader should be rebuilt was kept in the
wrong class. This lead to the Drawable keeping track of the dirty status of the
Paint stored in the ConstantState. This of course does not work properly when
several drawables are inflated form the same ConstantState. This change fixes
the issue by moving the dirty Paint state to the ConstantState class. This is
allowed to work because of the single-thread rule enforced by the UI toolkit.

Change-Id: I9bb31d8e7335d6bb418470b59ae25d9085d7bd23
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ee0c116ab2bd5acdfe50db36441cf4784d3a10b4 24-Mar-2011 Romain Guy <romainguy@google.com> Always apply the tile mode.
Bug #4170455

Change-Id: Id537a226a0b59bfa65b54bcea062aa5bf1a730b8
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
6efd2bad954e0e5bd74916a32f036a0f149dcd4d 13-Jan-2011 Christopher Lais <chris+android@zenthought.org> Don't drop the drawable cache completely on configuration change

There was a lot of fancy code just above the clear to ensure
that drawables that aren't affected by the change are kept,
then the entire array was cleared. This patch removes the
clear, so that the drawables that haven't changed are really
kept, matching the logs, comments and larger part of the code.

This patch also fixes the various constant states to return
correct ChangingConfigurations.

Change-Id: Ic11f6179537318d3de16dc58286989eb62a07f15
Old-Change-Id: I22495e6ed232dfe056207ce5155405af1fa82428
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
8d71769b9bc3d0e72b26217d9059ce4473a91fe5 13-Jan-2011 Christopher Lais <chris+android@zenthought.org> Don't drop the drawable cache completely on configuration change

There was a lot of fancy code just above the clear to ensure
that drawables that aren't affected by the change are kept,
then the entire array was cleared. This patch removes the
clear, so that the drawables that haven't changed are really
kept, matching the logs, comments and larger part of the code.

This patch also fixes the various constant states to return
correct ChangingConfigurations.

Change-Id: Ic11f6179537318d3de16dc58286989eb62a07f15
Old-Change-Id: I22495e6ed232dfe056207ce5155405af1fa82428
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
9891e1fce5f29d0421d34aa481037417bd70853d 11-Nov-2010 Chet Haase <chet@google.com> Add invalidation to Drawable when its properties change

invalidateSelf() already exists on Drawable. This triggers a call to
callback listeners so that they know the drawable has been invalidated.
For example, the background drawable on View will cause the View itself
to be invalidated.

Change-Id: I45b231a7600dcf3bc139e4059b7c9940ff49f60c
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
dfe5c204403bc56c29bb36410574eab8b1950417 09-Jun-2010 Scott Main <smain@google.com> docs: lots of additions to the resources docs
new drawable resources
add <merge> and <include> to layout resource
update drawable class descriptioons to point to resources guide
add ID resource type

Change-Id: I733eec50bb2671f28c9e6dd7dec14eb6586f5193
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
29e4a3c566f435c32f0b95e4ac8e8b33cac6faba 01-Oct-2009 Dianne Hackborn <hackbod@google.com> Update from API review.

Change-Id: I16b1c566f91167aac9615ac59dd297a154c828ea
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
ffff38420c8b4713470011b909ae2238b5675f7c 16-Sep-2009 Romain Guy <romainguy@android.com> Build the BitmapShader if it hasn't been built yet.

This was causing a bug in the InCall UI where the background would be stretched.

Change-Id: Ie25a7d09f4779f166e267b2f921d40441ce361d2
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
c2974809373697147cbe5754835cc871fb93aef1 14-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix issue #2116977: buttons are huge and bent

Now that we are using preloaded drawables in compatibilty mode, when
constructing them from their constant state we need to set the new
drawable's target density appropriately.

Change-Id: I3665cbea09d38b9ac5f45f8c380dc8641f86b266
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
211db4a2874f1a2d0e7a8cb8d33e81fa08801763 11-Sep-2009 Mike Reed <reed@google.com> change default for dither to true
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
4a51c20ce607c74914f90fd897f04080121ac13b 22-Aug-2009 Dianne Hackborn <hackbod@google.com> I am getting tired of the java doc warnings, so fix them.

Change-Id: I2205eebae419eaf4a0992c9f5b7cd807eb843fe1
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
11ea33471e1a14a8594f0b2cd012d86340dd3bd8 23-Jul-2009 Dianne Hackborn <hackbod@google.com> Allow for screen density drawables in compatibility mode.

This change allows us to use drawables that match the current screen
density even when being loaded in compatibility mode. In this case,
the bitmap is loaded in the screen density, and the bitmap and
nine-patch drawables take care of accounting for the density difference.

This should be safe for existing applications, for the most part, since
they shouldn't really be pulling the bitmap out of the drawable. For
the small rare chance of them breaking, it worth getting the correct
graphics. Also this will only happen when there is actually a resource
of the matching density, and no existing apps should have resources for
anything besides the default density (though of course all of the
framework resources will be available in the native density).

As part of this, the bitmap density API has been changed to a single
integer provider the DPI unit density.
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
b798689749c64baba81f02e10cf2157c747d6b46 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/graphics/java/android/graphics/drawable/BitmapDrawable.java