History log of /frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/NinePatchDrawable.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/NinePatchDrawable.java
d253797588f6847d582078bc6a4171e3dc5d8405 23-Mar-2016 Sergey Vasilinets <sergeyv@google.com> Fix NinePatch insets scaling

bug:27323867
Change-Id: I33c0007eb9259703c73d2e3672ae1427a2155037
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
a856e96eb543c0d2de63921b148015fc32c9d6ba 18-Mar-2016 Alan Viverette <alanv@google.com> Ensure nine-patch uses the best available target density

Bug: 27507887
Change-Id: Iddab4fdd2fe8fbf201dbb8ed42657a00509f42cc
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.java
921ec4464720ebe5f07a4dcb6e18b86e27baba6e 23-Feb-2016 Alan Viverette <alanv@google.com> Fix NinePatchDrawable handling of density changes

Scaling is now manually applied when the canvas density is not set.

Removes set/getNinePatch accessors that were added in N, since these
are not used and setting the nine patch directly will break padding.
Also removes local NinePatch, which was not necessary.

Bug: 27038114
Change-Id: Ie8b2e485b54d1ed1521081b329a09915fd0a95c1
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
41551849e698129d4bd8861a1de9cb58f1300ec5 14-Aug-2015 Alan Viverette <alanv@google.com> Add missing accessors on GradientDrawable, NinePatchDrawable

Bug: 13248977
Bug: 13249029
Change-Id: Ia8817a264b7063926e75b2f2a238d5ba36e14ab5
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
a5e1301bf5b501350b94d0308989c876c766e245 20-Aug-2014 Alan Viverette <alanv@google.com> Update toggle switch asset to include content area

Remove optical bounds workaround from NinePatchDrawable, which was
incorrect anyway since we were missing a content area rather than
missing padding.

BUG: 17114103
Change-Id: I51461be666f59534dfdea7ab79bc867ee3eb3c92
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
ad55abdc748f2cba6955e9e60cf7964dc027f2b5 12-Aug-2014 Alan Viverette <alanv@google.com> Fix NPE in NinePatchDrawable, propagate theme in StateListDrawable

BUG: 16979150
BUG: 16957778
Change-Id: I5e7116fe7fd3d5d177bafa88aad08ab21ae1677d
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
ac1f5884fb171f8a81819e9c0ce3402ad621f534 07-Aug-2014 Alan Viverette <alanv@google.com> Fix CTS test for nine patch padding sanity check

BUG: 16826969
Change-Id: I96628a38300dec58eb8523559741c28fed35eba2
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.java
01af516a8768cf3c544afb02283c9d8f1dba786c 06-Aug-2014 Chris Craik <ccraik@google.com> Fix nine patch crash

bug:15598400

Prevent destroying a NULL chunk

Change-Id: Iea0ac5311ca8061f60c02669cd9b87eededf1b1d
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
8e554924c527183962fc908c5f916f390f806c74 01-Aug-2014 Chris Craik <ccraik@google.com> Merge "Add outline alpha" into lmp-dev
77b5cad3efedd20f2b7cc14d87ccce1b0261960a 31-Jul-2014 Chris Craik <ccraik@google.com> Add outline alpha

bug:16140822
bug:16566746

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

Change-Id: I49698cc7c1bf4b2b55ffe2f82899543ca62bc61c
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
0c0dde7171c7ea35bbc6d64a41f94b428cb4d1f6 30-Jul-2014 Alan Viverette <alanv@google.com> Update switch assets, fix SearchView asset 9-patch areas

BUG: 16606037
BUG: 16467249
Change-Id: I9a5888e37317d1f8a6481f9733f784bbd37268f3
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
9b38f6c2cd1d97bb0d1a21e2f9545e02fae851e0 30-Jul-2014 Alan Viverette <alanv@google.com> Revert "Update switch assets, fix SearchView asset 9-patch areas"

Missing updated current.txt

This reverts commit dbf6b0d68a3d502430d061cd14f03f344b50f019.

Change-Id: I70846883f56be661fa89f9eaf20f5d103f2833c6
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
8bb399069da4e46b231333cff6880a0cf35b9417 30-Jul-2014 Alan Viverette <alanv@google.com> Update switch assets, fix SearchView asset 9-patch areas

BUG: 16606037
BUG: 16467249
Change-Id: Iabdf1634f4d8f87031ab3e5579140cdd428173de
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
31ba192dd201df2cad96a8c503f730130ab0d80f 18-Jul-2014 Chris Craik <ccraik@google.com> Tweaks to outline API

b/15283203
b/16142564

Remove boolean return value chaining, as it's redundant with
the data in the Outline itself.

Change-Id: I3116e57cd1b35c98b74e95195117edd7e39fb2df
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
47cd8e921db73e894f94ec4729ade90da50996f5 09-Jul-2014 Chris Craik <ccraik@google.com> Implement outline support for nine patches

b/15856895

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

Change-Id: I226e328a97873010d9e1adb797ac48f93a31183c
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.java
c054966b719c8a7255f7cf4120cca5050acb68bd 04-Jul-2014 Alan Viverette <alanv@google.com> Make optical insets actually work

Change-Id: I9fabf4cb939cc7a868f95580e7229745acde0418
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
a2992f44bc3787f37c3cad98f79dcfe67fb1aa81 17-Jun-2014 Alan Viverette <alanv@google.com> Fix tint filters in NinePatchDrawable and ShapeDrawable

BUG: 15678325
Change-Id: I57066e7a44498c88a270c76b7880f36825a25bb8
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
dcf7b59f845297c6e96950615e439d96ce3fb739 03-Jun-2014 Alan Viverette <alanv@google.com> Update theme colors, fix EditText state transition

BUG: 11218747
BUG: 15200201
Change-Id: I94368897ea9466ae971b25fc80d6ca43433aadd5
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
09ceac298cc12471e4575fe49f97766c1ed7b2a1 27-Feb-2014 Alan Viverette <alanv@google.com> Clean up tint API

Change-Id: I56056e7596840c563f5332922d63e8893a0cac17
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
f7a93ef3847258157d144dfefaa5757128cc807d 07-Nov-2013 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #11537133 Hideycling looks broken (KOT36), missing left padding

- enforce the Drawable boolean getPadding(Rect) contract for NinePatchDrawable
and DrawableContainer.

- as NinePatchDrawable was not enforcing it, the consequence was that the
mUserPaddingLeftInitial / mUserPaddingRitghInitial were reset to "0" (even
if they got the correct value before the reset).

Change-Id: I1efe7fad5f89c0ca47f90189f6d89940e0e9c6ae
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
ee3e1603fdbbe24b0cbf3cb85c456696cf3b7941 02-Oct-2013 Jeff Sharkey <jsharkey@android.com> Fix animations, padding in RTL mode.

Show directory animations coming in from left-side when in RTL
language. Also fix NinePatchDrawable to correctly mirror its padding
when auto-mirrored, and fix InsetDrawable to propagate the layout
direction to the wrapped Drawable.

Bug: 10987190, 11030793
Change-Id: I1213802a07d0c4ced93438df1e6ddf5aed3df677
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.java
f3187b7df158d2de36955ddcc666ba4b8544a2ce 07-Jun-2013 Romain Guy <romainguy@google.com> Remove unnecessary Rect, better reuse of NinePatch objects

Cloning drawables (which happens a lot) was creating copies of NinePatch
objects, which would cause the hardware renderer to generate more meshes
than necessary. Also avoid keeping a String we don't need (it was interned
but still.) Last but not least, remove 1 RectF per NinePatch in the system.

Change-Id: If4dbfa0c30892c9b00d68875e334fd5c2bde8b94
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
7b7578184567f4e4f0740ce935cc192765410cca 20-Sep-2012 Philip Milne <pmilne@google.com> Bug #6110465. Optical bounds support for all ViewGroup subclasses.

This CL generalizes the optical bounds support previously contained in the
GridLayout implementation and then incorporates the new form directly into
the base View and ViewGroup implementations. After this change, GridLayout is
returned to an 'optical bounds' unaware state, and all layouts (including non-platform
ones) inherit the ability to perform their layout operation by optical (rather than clip)
bounds using their existing implementations.

The "layoutMode" property of ViewGroup and its associated constants are
made public in this CL.

Change-Id: Ic1bba0e1c6fc14da4aeab0b28c975d562b5f82dd
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
908aecc3a63c5520d5b11da14a9383f885b7d126 01-Aug-2012 Dianne Hackborn <hackbod@google.com> Start moving away from DisplayMetrics.DENSITY_DEVICE.

This puts in most of the infrastructure needed to allow us to
switch between different densities at run time. The main remaining
uses of the global are to initialize the Bitmap object (not sure
what to do about that since it doesn't have anything passed in
the constructor to get this information from), and being able to
load drawables if we need a different density than what was preloaded
by zygote.

Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
7a23b49a8ceb07d3fa12c45fd42cd16131fd746a 25-Apr-2012 Philip Milne <pmilne@google.com> Fixes for optical bounds feature.

1. Make the feature opt-in (ViewGroup::layoutMode defaults to CLIP_BOUNDS) without inheritance.
2. Rename COMPONENT_BOUNDS to CLIP_BOUNDS.
3. Rename LAYOUT_BOUNDS to OPTICAL_BOUNDS.
4. Complete GridLayout implementation.
5. Change the default_gap between components to 8dp, to align with the Style Guide.

Change-Id: I8d40dfc5f4ca469f6424eb3ff60d07bec56e3a9f
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
bbd51f1e360b22eece1d74bd65c7e6a0b59dee59 19-Apr-2012 Philip Milne <pmilne@google.com> Share Insets instances between views that have the same background (Drawable)

Change-Id: I47d93ccca6f553b678d25966d10d7a0a97cfa5ea
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
1557fd7809078e421f751efc7d2539b3efdc54b2 05-Apr-2012 Philip Milne <pmilne@google.com> Fix for bug 6110465.

Add layout bound metadata to 9-patch files and make layouts take them into account.

This CL contains a proposed API for dealing with layout bounds.

This solution exposes:

1. Class: Insets - for storing layout Insets (and later possibly padding).
2. Methods: View:(get/set)LayoutInsets() - for storing layoutBounds.
3. Methods: ViewGroup:(get/set)LayoutMode() - for controlling layoutMode.

It also iuncudes the changes to GridLayout to support layout bounds.

Change-Id: I60c836b6530b61c5abf37f93ee9c44aad73573f1
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
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/graphics/java/android/graphics/drawable/NinePatchDrawable.java
68d91733c873d80eb107b6e7a46228d9397b373e 03-Nov-2011 Dianne Hackborn <hackbod@google.com> Some optimizations for view inflation.

Change-Id: I8e5e6dda4d4c9776961d4a070549d5753588e582
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
61fd1e8d8c3ccf2d6b7d4af1c19e8f0988d5a1ec 26-Oct-2011 Joe Fernandez <joefernandez@google.com> docs: add developer guide cross references, Project ACRE, round 3

Change-Id: I6125315ecdf0f78dd947c514a9944729d723e95d
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
4a123c4d69a1a73d0e16834700c3fe95034fe66e 26-Apr-2011 Romain Guy <romainguy@google.com> Allow bitmap filtering on NinePatchDrawable.

There's no reason to not allow it anymore.

Change-Id: Id1881784e6abb49f1965af6595a77391b88b426f
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
9db91243c5ace4421091557b76a0b1cbd2312fec 12-Oct-2010 Romain Guy <romainguy@google.com> Simplify black texture fragment shader.

Change-Id: If2d43f92f4c98ec128692761a670b0f31207a3c0
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
81859bc3d4d18f558b903db1306e76d0db115cf6 26-Sep-2010 Jean-Baptiste Queru <jbq@google.com> am ca3f968c: am 7d9c73fb: Merge "Prevent unhandled exception in NinePatchDrawable"

Merge commit 'ca3f968c6f0acbf94988d00bf21a82a2e8f49b86'

* commit 'ca3f968c6f0acbf94988d00bf21a82a2e8f49b86':
Prevent unhandled exception in NinePatchDrawable
279d006b1d194c597a4c6b0a72f66ea6128851fa 15-Sep-2010 Sonia Serafimova <sonia.serafimova@sonyericsson.com> Prevent unhandled exception in NinePatchDrawable

Added null check in computeBitmapSize() to avoid unhandled
exception "java.lang.NullPointerException" at
android.graphics.Rect.<init>(Rect.java:72).

This problem was discovered in the wild.

Change-Id: I8a4729ceadcfc9744f11b8ceafdf24d6de88c645
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
deba785f122a47915756ffd991f5540d952cf937 08-Jul-2010 Romain Guy <romainguy@google.com> Add support to draw 9patches in OpenGL.

This change only adds the necessary API and stubs. The implementation
will be added in another change.

Change-Id: Ie50b8aff5868e78796cee331df15bdbf990d2ea1
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
e57b7b09b198699adea91b6f9729007fda00834e 06-Jan-2010 Cary Clark <cary@android.com> set nine patch padding initially to an empty rectangle

Formerly, the padding state was set to null. Copying the padding
state fails when the null rectangle contents are referenced.

fixes http://b/2219785
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
b8a9f12802ca5d1738a098a1769a8ed7959f248b 23-Sep-2009 Dianne Hackborn <hackbod@google.com> Fix #2101821: Cut labels of menu items in "SnapTell" market app.

Ummmm... this turns out to be pretty bad. NinePatchDrawable was not
scaling its reported padding for compatibility mode, causing spacing
to be off. All over the place. This change should improve things quite
a bit (and magically makes nearly all of the menu flaws go away).

Change-Id: I94a8310d95b908b6f087db97d9afaed654ca6de5
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.java
8cae124af2142687a6833dbaab8a43df6dd67b43 10-Sep-2009 Dianne Hackborn <hackbod@google.com> Various cleanup around resources and nine-patches.

Remove the stuff that doesn't use preloaded drawables when in
compatibility mode, since this works fine ever since we were able
to deal with drawables in a different density than the canvas.

Change the snapshot function on View to return a snapshot at
the same size that will actually be drawn on screen (when in
compatibility mode), to be able to show scaling artifacts and
all.

This change was original an attempt to fix issue #2101917: Text
field edges appears to be improperly rounded. That turns out to
probably be something deeper in the graphics system, but also
included here is the debugging code I did to try to track down the
problem to make it easy to turn on again later.

Change-Id: I34bfca629639c7ff103f3989d88874112ef778d9
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
211db4a2874f1a2d0e7a8cb8d33e81fa08801763 11-Sep-2009 Mike Reed <reed@google.com> change default for dither to true
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
d9512a30d8e5c7780c3faf2fa59c076010f67b9e 10-Sep-2009 Mike Reed <reed@google.com> default dithering to ON (cheap, looks good)
officially ignore filtering (expensive, no real improvement)
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.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/NinePatchDrawable.java
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.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/NinePatchDrawable.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/graphics/java/android/graphics/drawable/NinePatchDrawable.java