diff options
author | Xavier Ducrohet <xav@android.com> | 2010-12-23 07:16:21 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-12-24 00:21:51 -0800 |
commit | d43909c7503e11eb335a452d296a10804bb01fd6 (patch) | |
tree | f9dc11c23a34227d094e7340a05f268032224cfc /tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java | |
parent | 20805343296eef04081fee82fd04547f51225fe3 (diff) | |
download | frameworks_base-d43909c7503e11eb335a452d296a10804bb01fd6.zip frameworks_base-d43909c7503e11eb335a452d296a10804bb01fd6.tar.gz frameworks_base-d43909c7503e11eb335a452d296a10804bb01fd6.tar.bz2 |
LayoutLib: add support for unsupported drawing modifiers.
DrawFilter, Rasterizer, ColorFilter and MaskFilter
are not supported but we need to provide their
JNI counterparts anyway, to at least display warnings
when they are used.
Also improved the API to query Paint for Shaders
and PathEffects, and clean up some code by
moving asserts into the DelegateManager.
Change-Id: I8942514565d28576d5608c6373bda25d86d42ff2
Diffstat (limited to 'tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java')
-rw-r--r-- | tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java index 3759b26..7903ac9 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java @@ -82,27 +82,16 @@ public abstract class Shader_Delegate { // get the delegate from the native int. Shader_Delegate shaderDelegate = sManager.getDelegate(native_shader); if (shaderDelegate == null) { - assert false; return false; } - Matrix_Delegate localMatrixDelegate = null; - if (shaderDelegate.mLocalMatrix > 0) { - localMatrixDelegate = Matrix_Delegate.getDelegate(shaderDelegate.mLocalMatrix); - if (localMatrixDelegate == null) { - assert false; - return false; - } - } - - Matrix_Delegate destMatrixDelegate = null; - if (matrix_instance > 0) { - destMatrixDelegate = Matrix_Delegate.getDelegate(shaderDelegate.mLocalMatrix); - if (destMatrixDelegate == null) { - assert false; - return false; - } + // can be null if shader has no matrix (int is 0) + Matrix_Delegate localMatrixDelegate = Matrix_Delegate.getDelegate( + shaderDelegate.mLocalMatrix); + // can be null if the int is 0. + Matrix_Delegate destMatrixDelegate = Matrix_Delegate.getDelegate(matrix_instance); + if (destMatrixDelegate != null) { if (localMatrixDelegate != null) { destMatrixDelegate.set(localMatrixDelegate); } else { @@ -120,7 +109,6 @@ public abstract class Shader_Delegate { // get the delegate from the native int. Shader_Delegate shaderDelegate = sManager.getDelegate(native_shader); if (shaderDelegate == null) { - assert false; return; } @@ -130,14 +118,8 @@ public abstract class Shader_Delegate { // ---- Private delegate/helper methods ---- protected java.awt.geom.AffineTransform getLocalMatrix() { - Matrix_Delegate localMatrixDelegate = null; - if (mLocalMatrix > 0) { - localMatrixDelegate = Matrix_Delegate.getDelegate(mLocalMatrix); - if (localMatrixDelegate == null) { - assert false; - return new java.awt.geom.AffineTransform(); - } - + Matrix_Delegate localMatrixDelegate = Matrix_Delegate.getDelegate(mLocalMatrix); + if (localMatrixDelegate != null) { return localMatrixDelegate.getAffineTransform(); } |