History log of /frameworks/base/graphics/java/android/graphics/Shader.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
52ca75011b6a636ac3485e58305b102787fd08e9 24-May-2017 Tenghui Zhu <ztenghui@google.com> Merge "Add documentation about 0 scale matrix to Shader" into oc-dev
6f085f60e929f4bb5ae7ccbc04cbc23c99ee8850 19-May-2017 ztenghui <ztenghui@google.com> Add documentation about 0 scale matrix to Shader

fix:36989035

Test: build
Change-Id: Id1134d5d31ea6a17dc56f24d26eb5da9a78a2c2d
/frameworks/base/graphics/java/android/graphics/Shader.java
3915e25d41ce40f24fd41d8bcd6a058403d0bbc5 19-May-2017 John Reck <jreck@google.com> Convert Shader to NativeAllocationRegistry

Bug: 38258699
Test: manual
Change-Id: I1537dee3187ea0366f2c236f3e6825196d738a37
/frameworks/base/graphics/java/android/graphics/Shader.java
f6b0e60bd07436edb033ffe975030b7c1ee91626 19-Apr-2017 Chris Craik <ccraik@google.com> Fix compose shader child local matrix mutation

Bug: 37495696
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ComposeShaderTest

Adds back the verify step that discards a stale native ComposeShader if a child
changes.

Change-Id: I44f40c1edfdb7633994a69efb583cf28ee2c26b2
/frameworks/base/graphics/java/android/graphics/Shader.java
8a6ad4a89d1b9ed61d3ec6f5bc12d479bc8d9f3b 18-Apr-2017 Chris Craik <ccraik@google.com> Re-hide shader mutation, remove colorfilter mutation

Bug: 36025103
Bug: 37327129
Test: boots, CtsGraphicsTestCases passes

Change-Id: I937f8ae26ed47b4811dc033ed91c257670fc3a39
/frameworks/base/graphics/java/android/graphics/Shader.java
6097eca72134034fcc6086c110673b5df94913b0 08-Mar-2017 Chris Craik <ccraik@google.com> Expose color filter mutate methods

Bug: 36025103
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases

Now, similar to Shaders, we defer native creation until Paint is being
used, and ensure that we have an up to date filter when drawing.

Also implements ColorMatrix#equals to behave like Matrix#equals.

Change-Id: I5f74addd97f5662800802e6f660fead58d518725
/frameworks/base/graphics/java/android/graphics/Shader.java
957b3372f2b6c1c50ca50d4b6b22f5a041d08f04 11-Mar-2017 Chris Craik <ccraik@google.com> Add comment to Shader#mLocalMatrix

Test: just comments, none

Change-Id: Idd337deef5fa796f3d83ffbddca58949b27d5169
/frameworks/base/graphics/java/android/graphics/Shader.java
b581e6704fc1478bc1dda517502abd3eab2558d6 08-Mar-2017 Chris Craik <ccraik@google.com> Support for shader mutation

Bug: 36025103

Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases
Test: cts-tradefed run singleCommand cts-dev --module CtsUiRenderingTestCases
Test: manually inspected for leaks via SK_TRACK_SHADER_LIFETIME and forcing a GC after ComposeShaderTest

Change-Id: Ib5d33a80d2f9f468705806b05832e753508143cc
/frameworks/base/graphics/java/android/graphics/Shader.java
dbee9bb342cdfaa5155b1918f90262c05e2464cb 15-Dec-2015 Teng-Hui Zhu <ztenghui@google.com> Gradient for VectorDrawable's fill and stroke

Add ComplexColor interface for both GradientColor and ColorStateList.
Set up constant state, factory, theme attrs for GradientColor, while
refactoring the ColorStateList's similar code. (Functionality in CSL should
be the same).

Support themeing in both the root and item level in GradientColor.
For example, both startColor in <gradient> tag or color in <item> tag can
have theme color.
Add tests for both simple and complex cases with themeing etc.

Hook up the native VectorDrawable implementation using 2 extra JNI calls for
simplicity. Such calls only happen at inflate and applyTheme call.

b/22564318

Change-Id: Ibdc564ddb4a7ee0133c6141c4784782f0c93ce0e
/frameworks/base/graphics/java/android/graphics/Shader.java
58c27e3e53ef64072412515792433e570a176f15 10-Sep-2015 Hans Boehm <hboehm@google.com> am c0ce6c42: Merge "Reduce risk of memory corruption due to finalization."

* commit 'c0ce6c422cfe089e7a8e209ac924e37bed3ca770':
Reduce risk of memory corruption due to finalization.
ffa84e008c712ceffa09d6b89a49882c88b3cca5 12-Nov-2014 Hans Boehm <hboehm@google.com> Reduce risk of memory corruption due to finalization.

Many classes in graphics/java and elsewhere deallocate native memory
in a finalizer on the assumption that instance methods can no longer
be called once the finalizer has been called. This is incorrect if
the object can be used, possibly indirectly, from another finalizer,
possibly one in the application.

This is the initial installment of a patch to cause such post-finalization
uses to at least see a null pointer rather than causing memory corruption
by accessing deallocated native memory. This should make it possible to
identify and fix such finalization ordering issues.

There are more graphics classes that need this treatment, and probably
many more in other subsystems.

This solution is < 100% effective if finalizers can be invoked
concurrently. We currently promise that they aren't.

(In my opinion, the real cause here is a language spec bug. But that ship
has sailed.)

Bug: 18178237
Change-Id: I844cf1e0fbb190407389c4f8e8f072752cca6198
/frameworks/base/graphics/java/android/graphics/Shader.java
dfba4d3d11bbf47dff45f94d61d4d97510b3034a 02-Sep-2014 Derek Sollenberger <djsollen@google.com> Mutable Java Shaders with Immutable Native Shaders

bug: 17641888
Change-Id: I0f05387423cde185dab1a1453f89d5251ca1a4f9
/frameworks/base/graphics/java/android/graphics/Shader.java
01edef10b9724fa5607d7918addc31a3b0c991dc 22-Aug-2014 John Reck <jreck@google.com> Revert immutable Shader change

Bug: 16733996

Change-Id: I51686aaf8f6ae8d0e390e298ad70f98f81c5f555
/frameworks/base/graphics/java/android/graphics/Shader.java
866cf65cc3c53f67836c9157d5c661adfdbd25e1 22-Jul-2014 Leon Scroggins III <scroggo@google.com> Make updateLocalMatrix replace the current Matrix.

Fixes a bug introduced in I3c3316377874e89fccc85afb864bc038b0ef3890.

CreateLocalMatrixShader combines the existing matrix with the new
matrix, which is not what we want. Keep track of the original
SkShader at all times, and always create the local matrix shader
with the original. Store the SkShader with a local matrix as
Shader.native_with_local_matrix.

Make Shader.native_instance private. Instead of allowing direct
access, add an init() method which sets it, and getNativeInstance(),
which returns either native_instance or native_with_local_matrix,
as appropriate.

Make Shader subclasses call init(), instead of setting native_instance
directly.

Pass native_with_local_matrix pointer to nativeSetLocalMatrix and
nativeDestructor, which unrefs it (if not null).

Since nativeSetLocalMatrix no longer replaces the original, do not
unref it.

Add a comment to Shader.updateLocalMatrix that it does not affect
ComposeShaders created with this Shader. (This should have been a
part of I3c3316377874e89fccc85afb864bc038b0ef3890.)

BUG:16293121
Change-Id: Ieb31c7e1fe99081f6b81493178f4a18d3c5df643
/frameworks/base/graphics/java/android/graphics/Shader.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/Shader.java
d1ad5e62fda248c6d185cde3cb6d9f01a223066c 05-May-2014 Leon Scroggins III <scroggo@google.com> Inspect SkShader to determine hw shader.

Instead of duplicating internal info about SkShader, inspect the
SkShader installed on the SkPaint.

core/java/android/view/GLES20Canvas.java:
Remove setupModifiers, nResetModifiers, and nSetupShader.

core/jni/android/graphics/Shader.cpp:
Remove calls to create/destroy the (previously) attached SkiaShader.

core/jni/android_view_GLES20Canvas.cpp:
Remove native code for setupShader and resetModifiers.

graphics/java/android/graphics/BitmapShader.java:
graphics/java/android/graphics/ComposeShader.java:
graphics/java/android/graphics/LinearGradient.java:
graphics/java/android/graphics/RadialGradient.java:
graphics/java/android/graphics/Shader.java:
graphics/java/android/graphics/SweepGradient.java:
Remove code keeping track of native SkiaShader.

libs/hwui/Caches.h:
Include Extensions.h.

libs/hwui/DeferredDisplayList.cpp:
Compare shaders on the paint, instead of on DrawModifiers.

libs/hwui/DisplayList.cpp:
libs/hwui/DisplayList.h:
Remove vector of SkiaShaders.

libs/hwui/DisplayListOp.h:
Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

libs/hwui/DisplayListRenderer.cpp:
libs/hwui/DisplayListRenderer.h:
Remove resetShader, setupShader, refShader, and mShaderMap.

libs/hwui/FontRenderer.cpp:
Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

libs/hwui/OpenGLRenderer.cpp:
libs/hwui/OpenGLRenderer.h:
Add LayerShader, a class inheriting from SkShader, to mimic the
behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on
the SkPaint so it can be inspected later.
Set a LayerShader instead of a SkiaLayerShader.
setupDrawShader and setupDrawShaderUniforms now inspect an SkShader
passed in.
Inspect SkShader instead of mDrawModifiers.mShader.
Remove resetShader and setupShader.
setupDrawColorUniforms now takes a boolean indicating whether there is
a shader.
Add an inline function for accessing the SkShader on an SkPaint.
In setupDrawBlending(Layer*, bool), do not check the shader (which will
never be set), but do check whether the color filter may change the
alpha (newly fixed behavior).
In setupDrawBlending(SkPaint, ...), check the SkShader and whether the
color filter affects alpha (the latter is new behavior).

libs/hwui/Renderer.h:
Remove pure virtual functions setupShader and resetShader.

libs/hwui/ResourceCache.cpp:
libs/hwui/ResourceCache.h:
Remove functions for refing/unrefing shaders.

libs/hwui/SkiaShader.cpp:
libs/hwui/SkiaShader.h:
Much of this code was redundant and has been removed.
Convert structs into class with nothing but static functions for
calling describe/setupProgram.

libs/hwui/TextureCache.cpp:
libs/hwui/TextureCache.h:
Use the SkPixelRef as the key to the bitmap Lru cache, since shader
inspection will provide a different SkBitmap pointer (though it will
hold the correct SkPixelRef with the correct generation ID).

tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java:
tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java:
Update manual test to have more shaders: radial, sweep, compose,
invalid compose.

BUG:10650594

Change-Id: Iaa7189178bda1c55f96da044d2a9fa602ba36034
/frameworks/base/graphics/java/android/graphics/Shader.java
36bef0bf30d6bae48cf3837df351075ca4fce654 20-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make graphics classes 64-bit compatible

This a merger of two commits submitted to AOSP by
the following authors:

ashok.bhat@arm.com, david.butcher@arm.coma
craig.barber@arm.com, kevin.petit@arm.com and
marcus.oakland@arm.com

Due to the very large number of internal conflicts, I
have chosen to cherry-pick this change instead
of letting it merge through AOSP because the merge
conflict resolution would be very hard to review.

Commit messages below:

================================================
AArch64: Make graphics classes 64-bit compatible

Changes in this patch include

[x] Long is used to store native pointers as they can
be 64-bit.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
yet. Specifically mAtlasMap member has to be converted
to hold native pointer using long. Added a TODO to
AssetAtlasManager.java to indicate the change required.

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

==================================================================

AArch64: Use long for pointers in graphics/Camera

For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

===================================================================

Change-Id: Id5793fa0ebc17ee8b1eecf4b3f327977fdccff71
/frameworks/base/graphics/java/android/graphics/Shader.java
7023df08f14ec5dee76ac54c03e870f84e297636 27-Jan-2014 Narayan Kamath <narayan@google.com> Revert "AArch64: Make graphics classes 64-bit compatible"

This reverts commit 18b4cbeedef21c1fa666a110a157bab66edff976.

Change-Id: I0c52983a3ab1ace3ff743de546a43eca28e5cb0e
/frameworks/base/graphics/java/android/graphics/Shader.java
18b4cbeedef21c1fa666a110a157bab66edff976 20-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Make graphics classes 64-bit compatible

This a merger of two commits submitted to AOSP by
the following authors:

ashok.bhat@arm.com, david.butcher@arm.coma
craig.barber@arm.com, kevin.petit@arm.com and
marcus.oakland@arm.com

Due to the very large number of internal conflicts, I
have chosen to cherry-pick this change instead
of letting it merge through AOSP because the merge
conflict resolution would be very hard to review.

Commit messages below:

================================================
AArch64: Make graphics classes 64-bit compatible

Changes in this patch include

[x] Long is used to store native pointers as they can
be 64-bit.

[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
yet. Specifically mAtlasMap member has to be converted
to hold native pointer using long. Added a TODO to
AssetAtlasManager.java to indicate the change required.

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

==================================================================

AArch64: Use long for pointers in graphics/Camera

For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

===================================================================

Change-Id: Ib3eab85ed97ea3e3c227617c20f8d213f17d4ba0
/frameworks/base/graphics/java/android/graphics/Shader.java
e3c526f4f603e83c5fa8b9e399506b085f5648b7 31-Jul-2013 Fabrice Di Meglio <fdimeglio@google.com> Fix Paint Shader copy

- Paint.setClassVariablesFrom(Paint paint) was using the same Shader
for the copy as the initial Paint. Make sure that we are using a copy.
- implement a copy() API for shaders

See bug #7034321 Need Drawable RTL support

Change-Id: I4b9cee386edc72ad670723266333b85f4d2b0ab8
/frameworks/base/graphics/java/android/graphics/Shader.java
9454fe1080458812db76599dd02a8b91a2e1e8f4 12-Jan-2011 Romain Guy <romainguy@google.com> Fix CTS test.
Bug #3345445

Change-Id: I3e9fa6002d173e6c9182ee5798420829e4bd2e30
/frameworks/base/graphics/java/android/graphics/Shader.java
a9ebfa6bcce62d7fee69693fe3dee6027afd3f0e 05-Jan-2011 Romain Guy <romainguy@google.com> Keep a reference to the local matrix.
Bug #3299324

This is needed for ADT, which does not rely on Skia's reference counting
to correctly keep track of the native objects.

Change-Id: Ia2fc5c1ec2b80bad226bc549fefc6bb064784609
/frameworks/base/graphics/java/android/graphics/Shader.java
ee916f14cbd1fe1422c063ce2ef7b185e2bc5c6f 21-Sep-2010 Romain Guy <romainguy@google.com> Add support for SweepGradient in the GL renderer.

Change-Id: I7aa397ed4e34655ead9ba1f5b4ce087665e0f022
/frameworks/base/graphics/java/android/graphics/Shader.java
06f96e2652e4855b6520ad9dd70583677605b79a 31-Jul-2010 Romain Guy <romainguy@google.com> Refactor Skia shaders handling.

With this change, Skia shaders can easily be applied to any mesh. This change also
supports ComposeShader. For instance, this can be used to blend a gradient and a
bitmap togehter and paint a string of text with the result.

Change-Id: I701c2f9cf7f89b2ff58005e8a1d0d80ccf4a4aea
/frameworks/base/graphics/java/android/graphics/Shader.java
f9764a4f532561f6e2e985ff3b25112f1132ce44 17-Jul-2010 Romain Guy <romainguy@android.com> Add program for linear gradient.

This change adds a new DrawLinearGradientProgram class to enable the drawing
of linear gradients. Two new vertex and fragment shaders are introduced,
based on DrawTextureProgram's shaders.

Change-Id: I885afc076bb6cef8cd3962ae21a086fa6a03bf96
/frameworks/base/graphics/java/android/graphics/Shader.java
d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895 15-Jul-2010 Romain Guy <romainguy@google.com> Add support for BitmapShader.

This change also fixes an issue with the clip and layers.

Change-Id: I5fd9832098d8cf7ae8eb781ff9bffe7defaea279
/frameworks/base/graphics/java/android/graphics/Shader.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/Shader.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/Shader.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/graphics/java/android/graphics/Shader.java