History log of /frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c85057c14c7679c177555914dcf81159614c5769 19-Apr-2018 Selim Cinek <cinek@google.com> Made the DrawableWrapper return the right ColorFilter

Previously it simply returned null

Test: atest cts/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
Change-Id: Ia4694e8dee08449262bbe1cfd719795fd86e1ee0
Fixes: 78252558
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
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/DrawableWrapper.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/DrawableWrapper.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/DrawableWrapper.java
781fbf28c70868d803a6caf13a2209c785fa4fce 14-Mar-2016 Alan Viverette <alanv@google.com> Merge "Ensure all Java-side usages of config flags are using Java flags" into nyc-dev
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/DrawableWrapper.java
f6d87ec193f17e8dad82c9994ba7a58e975d364b 11-Mar-2016 Alan Viverette <alanv@google.com> Add consistent @NonNull annotations for drawable callbacks

Bug: 27599515
Change-Id: I33fdc5392302403bfff9cc74a8226173ec962af6
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
7e3ede288926bdfb79b1571fed74cad614935821 28-Oct-2015 Alan Viverette <alanv@google.com> Support for changing density of DrawableWrapper subclasses

Includes a refactoring of DrawableWrapper classes so that the wrapper
super class handles both drawable management and inflation. This allows
us to immediately call through to super() in inflate and applyTheme,
which simplifies density management.

Bug: 25081461
Change-Id: I8c157d340fd1f28a3a2b786c56850a67cdd452e4
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
0b6cfe22fda3396b4790ac79fc90488bec4a49a4 14-Sep-2015 Alan Viverette <alanv@google.com> Revert "Use floating-point value for Drawable level"

This reverts commit 3da32b768899e7dabe3a16333edf5eca2b9ebe93.

Change-Id: Ie75ce0c285e0f59a7a086f64c0cfe088edb5df04
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
3da32b768899e7dabe3a16333edf5eca2b9ebe93 02-Sep-2015 Alan Viverette <alanv@google.com> Use floating-point value for Drawable level

This allows us to run fine-grained level animations.

Backwards compatibility:
Another CL will add DrawableCompat.setLevel(float) to forward calls to
the existing integer-based method. For callbacks, developers can override
onLevelChanged(int) and use DrawableCompat.getLevelFloat() to obtain the
floating-point level. Overriding onLevelChanged(float) will only work on
current API.

Bug: 23566299
Change-Id: I431fe6f3679c8f23f9cf3c2bb1f92a4059ee68e3
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
b63b93dee7744f00280ea998ef24d0a1d57d3934 28-May-2015 Alan Viverette <alanv@google.com> Fix drawable CTS breakages

1. ClipDrawable.getOpacity() now correctly respects the current level
2. DrawableWrapper checks the contained drawable's changing config even
if it doesn't have a constant state
3. DrawableWrapper gives priority to the last valid child drawable
rather than the drawable attribute

Bug: 21406104
Change-Id: I442fe90d0a3865bfdc6b2d14a7358178310dde02
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
dfa4646eca54511a28f2c61e1f4b9c697e05a913 27-May-2015 Alan Viverette <alanv@google.com> API Review: Drawable

Renames boolean getters to isZzz(), callback from onChange to onChanged.

Bug: 21342040
Change-Id: I9700d645453354b608fd97a832359211d828b52f
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
e922f49b627912c113250bd8506830bb69943025 15-May-2015 Alan Viverette <alanv@google.com> Allow getChangingConfigurations() on DrawableWrapper with null drawable

Change-Id: Iecf39b53419e07927a3fe3096036a57afd69439a
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.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/DrawableWrapper.java
1b23240f96bd5318933accf6b212b62f803bee13 20-Mar-2015 Alan Viverette <alanv@google.com> Only propagate state changes if wrapped drawable is stateful


Always update layer bounds if the contained drawable changed in any
way. Also adds null annotations in LayerDrawable and throws a more
useful exception when the layers argument is null.

Change-Id: Iae0cba68257e48b6a45fe081c3d4b0509d2dedd5
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.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/DrawableWrapper.java
a12962207155305da44b5a1b8fb9acaed358c14c 21-Feb-2015 Alan Viverette <alanv@google.com> Unify wrapper-type drawables

Fixes several issues with constant state and propagation of drawable
property changes to wrapped drawables. Also un-hides the layout
direction accessors and hotspot getter.

Change-Id: Iff19db6a95059cbcfcbde7af0ac33871ccd41615
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
c80ad99a33ee49d0bac994c1749ff24d243c3862 20-May-2014 Alan Viverette <alanv@google.com> TouchFeedbackDrawable is now RippleDrawable

Change-Id: I59f5f04b73089215c6320560556ac21beb03db06
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
860126b78aa4d6e8db5208c7f96764a8556cf95f 09-Apr-2014 Alan Viverette <alanv@google.com> Make Drawable hotspot APIs public

Change-Id: I8377ed735f73f7083636947aa08a5427f1dc3bf6
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
840dede901e6247f3bb55009c1500f8623829375 25-Mar-2014 Alan Viverette <alanv@google.com> Unhide touch feedback drawable and wrapper

Change-Id: I98926d4adfb6e8c6130b31c8f4534a1a382d0f3b
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java
ba346f9d8d681c3c8166609382eb882e538b9b05 11-Mar-2014 Alan Viverette <alanv@google.com> Unify touch feedback drawable and reveal drawable

BUG: 13030730
Change-Id: I65a50a00bd76b80bb242b1573b89e443e2e143fe
/frameworks/base/graphics/java/android/graphics/drawable/DrawableWrapper.java