History log of /frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7fa71f524c86d6224fb95b571d3a9e32edb32f22 11-Nov-2016 Jerome Gaillard <jgaillard@google.com> Rename native methods that were changed in the platform

This is following commits f22859757b, 94931bd87e, 4387190d8e
and caa08ff5e9.

Test: Run TestDelegates
Change-Id: If90028492c036fc5f69913e4dcad5a1a5fca4b55
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
e5581b5c1972fb7b23fddceb2027084bf06cb2fb 03-Aug-2015 Deepanshu Gupta <deepanshu@google.com> Fix Matrix_Delegate.native_getValues()

The bug manifested itself by not rendering the wifi icon in the status
bar.

Change-Id: I7debf3eef387965d774bf66e856812e67c8552a7
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
dba76ab779821ebb404cd5d725e0b852b9619ed5 02-Oct-2014 Neil Fuller <nfuller@google.com> resolved conflicts for merge of ee665151 to lmp-mr1-dev-plus-aosp

Change-Id: I2588c65b7a9fa43f968151a206924a804f0595a7
2460c57a7ac1c2a491a62d0321ac24d9f6bd4fda 01-Oct-2014 Neil Fuller <nfuller@google.com> Switch from FloatMath -> Math and Math.hypot where possible

The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.

That said...

Math is faster than FloatMath with AOT compilation.

While making the change, occurances of:

{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))

have been replaced with:

{(float)} Math.hypot(x, y)

Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:

Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().

hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.

Different implementations measured on hammerhead / L:

AOT compiled:

[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials

[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials

[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials

[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials

[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials

[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials

Interpreter:

benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
017c06241e22e290406ae53402f96e3e2a9597b8 20-May-2014 Deepanshu Gupta <deepanshu@google.com> Layoutlib fixes for L [DO NOT MERGE]

This adds the new delegates that were missing. This starts the work on
changes related to Minikin Fonts.

There are some changes related to TypedArray that still need to be
fixed.

Change-Id: Ic2397b64aa3f1f48926e849b14689c47d9ee7f8c
(cherry picked from commit 7ca3612094270183243938e79337c84effea7ad0)
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
678cd7fa884002bc6b746fa543baf41db323a453 21-Apr-2014 Deepanshu Gupta <deepanshu@google.com> Update Matrix_Delegate native methods.

Update the Matrix_Delegate native methods in layoutlib. The original
change is I5cdcea827ebff587df0bbddc0965e3e0fbf48002.

Change-Id: I2c94741fdaeb0c2279caefee0188f432267bb37d
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
cd0ed56f8a5f7788bcff050ab8aa42b0504e8535 29-Jan-2014 Deepanshu Gupta <deepanshu@google.com> Fix native method signatures

Some new methods have been added which are yet to be implemented.

Change-Id: Ie5a0657c7ccbe95200c270d5c15b516a385b083b
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
7e047b0f59388535e9d6a2c7458c866a5642a79e 29-Jan-2014 Narayan Kamath <narayan@google.com> Fix a few more delegate methods in layoutlib.

Change-Id: Icd7069452b9ac66498af69ec705d12c3acd1c848
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
633d68816b468e887eb630aa0a87962d57a0805c 27-Jan-2014 Narayan Kamath <narayan@google.com> Track 64bit changes to android/graphics.

All pointers are now 64bits wide, so should be
represented as java longs and not ints.

Also changed DelegateManager and SparseWeakArray to
reflect the new world order.

(cherry picked from commit 88a8364c386c694f7ad56662ef89713dbf7c9d63)

Change-Id: Ic2f55dd6235751169c5014f9d2ccf3f544259a87
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
ec4118922fa844ef31b73d16adc76f4da4c6c8e6 27-Jan-2014 Narayan Kamath <narayan@google.com> Track 64bit changes to android/graphics.

All pointers are now 64bits wide, so should be
represented as java longs and not ints.

Also changed DelegateManager and SparseWeakArray to
reflect the new world order.

Change-Id: Ic32b6b53818dbae9b949f03004c4fb6dae26cdbe
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
ab775ecdd189b32e35b0d3f4a821502f88b03a4b 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
f62edc74939ada0abb63b4cb517433bb5e8850cb 06-Feb-2012 Xavier Ducrohet <xav@android.com> Setup ActionBars in layoutlib the same way the platform does it. do not merge.

Instead of using a simple ImageView for the icon, this uses the platform
layout/action_bar_home which uses a custom class to position and resize
the icon (and also supports the Up icon that we don't yet support).

This ensures that the icon is properly positionned and sized like
on devices.

(cherry picked from commit 7396348dfcfb45b7ad055f4c18cabbe5e8270d26)

Change-Id: Ie7fde04c6598bfa1b9c9f789233e1215ea3eb950
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
b2de8394cdb18593f27601b5736ec299a6851371 24-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Add debug mode.

Change-Id: If4263c7dba63a063f84e0c6988c270eb6d291ac3
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
9167279573bb4365f90423ff6fff9af5a88b399d 22-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Hold onto delegate references.

When an object is given a delegate to hold onto, keep
the reference to the delegate instead of its native integer.

Also change the way the finalizer works by not explicitely deleting
the delegate. Instead we want the delegate to be deleted when
nothing holds a reference to it. To do this, instead of using
a regular SparseArray, we use a SparseArray of WeakReferences.
Because the main Java object that "owns" the delegate does not
actually holds a reference to the delegate, we fake this by
having the delegate manager hold a reference to delegates for
the main object. This is added/removed as the object is created
and the native finalized is called.

This makes layoutlib behave more like the JNI code where the native
objects are reference counted, and where the Java object can be
deleted but the delegate it owns is kept around (usually because
another type of delegates hold a reference on it.)

To properly handle the WeakReferences, we need to be able to
regularly clear the SparseArray of WeakReference that were
referencing objects that have been GC'ed.
Since the SparseArray is regularly being compacted (actually only
when items are removed), we use a custom SparseWeakArray (started
as a straight copy of SparseArray) that handles the WeakReference
and takes care of compacting the array by removing deleted indices
and WeakReference that returns null. Since our specific use case
doesn't call actually delete() or remove(), the compacting
only happens when the array needs to be resized.

Change-Id: Iacc5c1ff5b21732b8816fda87eb090da12d034e0
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
94c80bfaff4e9f503817254237e1538096a018ef 10-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Annotate the custom delegate methods.

Every method implementing a delegate needed by the
layoutlib_create bytecode modification must now be
annotated with LayoutlibDelegate.

The methods in the original source code that are delegated
are already automatically annotated. Now with the implementations
being annotated we can do bi-directional tests and find not
only missing implementations but also dead obsolete code.

This will be useful when backporting to earlier versions of
Android, or when native (non public) method disappear. In fact,
the new test detected one such method in Shader.

Change-Id: I491708b68ac2736ca5669aa86cd5e930a00f9db3
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
f69bb29490b24ed4c31ad248e87bffbf923fd4da 15-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: update logs to use new data bundle

Also change some resource.resolve tags to resource.format

Change-Id: I3f0b0d2eb69a5ec98375e4014a3bb1bfceb8c855
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
3f9b0376c69a5f679661d773ea7b59b1e6787090 13-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Use the new log tag constants from LayoutLog

Change-Id: I29dd578ae16405358d3673caf13528be393f0967
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
ef78fd2b92ad4155d48b02d194ebc2925e9e579b 13-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: use tags in logs.

Change-Id: Ib85272249d285ecef409bf063903bcd91514a424
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
18e518bc7591024b34235c1d001dec7d62a8cf1d 08-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: add a few misc implementations.

Change-Id: I586f1d5ecc4f254fc04ea1171eb499d06ac592eb
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
0fe68c85bfb4994b62ed00a2888b5c72c981df1c 07-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Finish the matrix delegate.

Change-Id: Ife70a4707c113f4a2aed18e303cb2f221c73db2a
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
a6e51d549710d42f8ee4776fa5fefa08277c8e57 23-Dec-2010 Xavier Ducrohet <xav@android.com> 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
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
cf2030ca2a3d127bb965a3c3df92b96a9184732a 21-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: support for layers.

Layers require that drawing methods potentially
draw in more than one bitmaps.

To handle this this patch offers the following:
- move all drawing methods to use Drawable
- Drawables are now handled by GcSnapshot since
its the one handling the layers
- moved Canvas_Delegate.createCustomGraphics to
GcSnapshot which does not expose the Graphics2D
objects anymore so its draw() methods are the only
way to draw.
- handles creating layers in GcSnapshot.save() and
blitting them in restore()

Other changes:
- Clean up the create/save API in GcSnapshot
- Fixed drawing bitmaps with alpha and other
composite modes.

Change-Id: I1e230087493d044a10de71f4b6d29083e3f3bf64
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
c810bea18e3f0e42aed4afb5e5159fba678a95e1 20-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: support for Path and BitmapShader using delegates.

Also created delegates for all missing shader, xfermode
and patheffect classes. Moved the logic of the xfermode,
and patheffects that was in Canvas_Delegate into the
xfermode/patheffect classes, and added support (in all
3 clases) for knowing if the shader/xfermode/patheffect
is actually supported or not. Make use of fidelityWarning
in LayoutLog if they are not.
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
cf02123cf911a67f914563c74af2e2c7bc874860 15-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: replace the stack of Graphics2D with custom snapshots.

The first step is to allow the canvas to save only the matrix or
the clip. Previously, since the graphics2D were created completely
new on each save, everything was saved.

Also allows to set transform/clip on the Canvas when no bitmap
has been set (and therefore no Graphics2D exists).

This is required by BitmapFactory.

Change-Id: I37eff6dde1ca708d58ba317b40e9b3236f3ef3d0
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
8f1cbe090f822e91a01bf4b1a8ca85c8b8570aa0 14-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Fix gradient rendering.

- fully support canvas transform
- fully support shader local transform
- fix repeat/mirror issue in the negative values.

Change-Id: Ib2aa7ade1c2702da4364cbda9a5a3ae72c1d3174
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
a8efb42dea9cc6f96b31b1c4bf57db21dd543566 14-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Misc fix to rendering.

Change-Id: Ia73fab1be3c01e6ce5791973e636e45a0f75ceb6
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
ddea50d03cdda807bbaea54beffd7a341c51f770 24-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: Animation support.

New locking mechanims to prevent concurrent renderings.

There's now a thread specific prepareThread() method (only
prepares the looper) and its associated cleanupThread().

For the rendering itself, acquire must be called before doing
any type of Android specific work on the scene (inflate or rendering)
After instantiation, init() must be called, which also acts as acquire.

Added a lot of checks to make sure method aren't called without
acquire or if scenes try to be rendered while acquire was called
from the same thread but on another scene.

Animation implementation:
- Handler delegate to use our own queue (since the animation runs
through handler messages). This uses a callback to process
the message. This callback is per-thread and only used in
animation threads.
- SystemClock delegate to provide clock implementation.
- AnimationThread to handle playing the animation and calling back
to the animation listener.

Change-Id: Ia39aba7ed476759df1da3200e413fe3e92590d15
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
22ab255db9a39292abe3c446584ce3b18663eadd 19-Nov-2010 Xavier Ducrohet <xav@android.com> LayoutLib: fix some tests

Change-Id: Iacd641e2fac663ff12fe2a08ba093c4eaa2e8862
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
3bd98986a97e4e1921616a0a86983307e68ceb6c 10-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: New bridge implementation using the new API 5.

Since the new API prepare for stateful layoutlib, major
reorganization of the code.

New "android" sub-package for all extended android classes.
Also moved BridgeInflater in here so that all extended classes
are in this package. Only delegates and classes replacing
renamed classes are in their original android.* packages.
Also created full file for the empty implementations of
IWindow and IWindowSession.
New "impl" for the dirty work implementation.
Main package contains the basic implementation of the API.

Most of the code that was in Bridge is now in .impl.LayoutSceneImpl,
with the main init/inflate/render code split into the contrustrutor,
inflate() and render().

Change-Id: Ie15b15e5a1b2388cd6ef82e518345b1fc02ec981
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
f1a1745224b8b6af23e15d2bf93631da80adc355 02-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib native delegate: primitive shapes and shaders

Change-Id: Id2b0c6231589e82d8e96c9f019042eba348a6583
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
37f2180272fcb5a862c0009fbb41bb48d51a735a 02-Nov-2010 Xavier Ducrohet <xav@android.com> More implementation of the layoutlib Paint/Canvas delegates.

Change-Id: I0c0029b9a679af4ae0178488f70b2a90292ea42d
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
221f6782615b9bebd4a531611c00c1d9be947927 30-Oct-2010 Xavier Ducrohet <xav@android.com> Implement the layoutlib Bitmap through a native delegate.

This does not implement all the native methods of the
android.graphics.Bitmap class, only what's needed to draw an
ImageView object. The rest will be implemented after Canvas and
Paint have been moved to the native delegate.

Change-Id: Ia0c3b2cafa03871c298deaef5817a25ac1c35521
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
48ab1a32897947a1d44ee280fa6f1397df882dba 22-Oct-2010 Xavier Ducrohet <xav@android.com> Reimplement the native matrix method using the new delegate way.

Instead of renaming the old Matrix class into _Original_Matrix
and have layoutlib provide a full new implementation of Matrix,
we keep the old one by only modifying it to implement the native
methods which calls out to a new Matrix_Delegate class.

The goal is to not have to maintain the java portion in
sync between the framework and the layoutlib version.

Change-Id: I3e1aefffbae45e91b75331c0c6ff2260323deacd
/frameworks/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java