History log of /frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
af64556de0064eeb5a4d4e6d634c3f074f5f40ce 20-Jul-2011 Xavier Ducrohet <xav@android.com> Layoutlib: misc fix + start of AndroidBidi support.

Change-Id: If2ce0b683da8cce01679322d503eed8dd474e521
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
66743a1ec0dddadec7cd8f026f9b6a2239f515be 15-Jun-2011 Xavier Ducrohet <xav@android.com> Fix changed native method delegates in layoutlib for ICS.

Change-Id: I49306868cd8a41b6b7d919c3e8b108d5c014530e
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
fb93ce9684120a36862b5b5e67b1865a652907e9 04-Jun-2011 Xavier Ducrohet <xav@android.com> Import the Layoutlib from hc-mr1.

This is squash commit of all the missing patches.

Change-Id: Ie081c46a173290646deddbde503a720d50c4400f
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9d76581faf9eb5f47eff922c14807e51702f363b 14-Mar-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Fix Arc rendering.

Looks like Java2D and Skia go in different directions for angles.

Change-Id: Ia0c9c70cd66c9a0941fa9921fecf8e4e83538af3
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
a4510a75757b82207f677609b970010f59c774ba 25-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: fix incorrect indices in one of the 2 native_drawTextRun methods.

Fixes http://b.android.com/15007

Change-Id: Iff06180def92c5fa25e82520b76192c089edd8cc
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
f0a53435f14d23d9555fc46014352ee6a7baa647 24-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Add debug mode.

Change-Id: If4263c7dba63a063f84e0c6988c270eb6d291ac3
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
c6083f2c9eadb1f8a502ea9806868f5b0148667e 23-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: misc fixes.

- implement some Paint methods that are needed for 2.x
- fix the phone system bar to display the icons on the right.

Change-Id: I3a938b14ec9a449dbc23a33303a3c8405a5369a8
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
cc4977d0fdaf657907912fd6cc2f9426dc8d2e36 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
8a80a8555238cc564f445f902aff5231993a8f96 10-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: remove some exceptions.

We need to move away from throwing anything and instead
log errors/warnings.

Change-Id: Ib1af71a90c06e8565fbd0c061ba56f4d19baa3df
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9a4fe29c8d92014d2d9a848e9116b8cc9d0842f9 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
51a7e5447de94791c464cda5cc6ebbf616d73c80 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
bbefc8662ac733fd6abfae54d97730506b5e2bd6 14-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Fix multi-line text rendering.

Stupid indices.

Change-Id: I1dbdd04b8f25a5769de8dc21e6c513cef3e35635
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
918aaa5717fce6081557c82ce1c439b6922737d5 13-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Use the new log tag constants from LayoutLog

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

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

Change-Id: I586f1d5ecc4f254fc04ea1171eb499d06ac592eb
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
10af738336cb18c5d86710b2961d91e2d3e8d410 07-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Finish the matrix delegate.

Change-Id: Ife70a4707c113f4a2aed18e303cb2f221c73db2a
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
a7cac5e0542779cadf0f5ccf71584e4b4425f7a6 07-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: fix clipping issues.

There were two issues:
- Graphics2D.setClip only works on rectangular shapes.
This means doing a setClip on a non rectangular shape should
basically reset the clip and intersect with the new shape.

- the current clip can be null, so the combineShape method
must handle it.

Change-Id: Id2cd7475e991d8b533ff2e8850cc2c27663f9e52
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
b44b43b1579486ff7ecd0f7528f17711acdeae98 23-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Support Region through delegates.

also finish supporting some clip operation
on the canvas.

Change-Id: I743b9e52a7aa6e9340506f1c904cc1cfbf3ff81f
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
d43909c7503e11eb335a452d296a10804bb01fd6 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
b1da1afa7418960b650780250bbd34c81af61aa3 22-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: improve bitmap support.

Change-Id: I703c2bdf51380b54fd5c20b08d3bc74833d9bc6e
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
d38e776a3cc8cb53945cbebafbe6f6c2e3501fa5 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
63fd87113cea6abec97a6cd966e090e9b590fc3b 21-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Misc rendering fixes.

- always set up the stroke. Paint may not have the proper
style when drawing lines. stroke should still be setup.

- Fixed vertical linear gradient. Old code generated
a gradient ratio of NaN

- Fixed alpha rendering when using shaders. In that
case the alpha channel from the paint color should be
used in conjunction with the shader.

- Fixed miter limit. Java expects the value to be multiplied
by the stroke width

- Fixed support for drawing ALPHA_8 bitmaps. Java2D doesn't
have bitmaps with only alpha channels, so we keep using
ARGB bitmaps but when drawing them into a bitmap we erase
the color information.

Change-Id: I4f04341fc843e3f7dadd1fdbf709b11a4f1e24b9
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
d348b6eaa98e23cb38d90906df109aaa2d20ea7f 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
cfdc784b6cdcbbb2bf2ba4d53d9a9eb2c37278a3 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
8da36314fd76ae6fe4549773ad00dc1883cb6bff 14-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: implement more of Canvas/Paint.

Change-Id: I8e2a7a3bddbce08db5eb641b5075bedd75f7be27
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
168677c9e2f8438ec5687e3c6b0e41b986c5b230 06-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Fix logging.

- Use the new logging API
- remove log object reference everywhere but in Bridge
- all logging code accesses Bridge.getLog()
- prepareScene sets the current scene log object in Bridge.

Change-Id: Ib0517ccd6454c4baf218b6baa978a126f91671e7
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9eb6d412af6859b6c0bb969c76bbfc48eec8fd4b 01-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Reuse canvas when possible.

Also moved the prepare/cleanupThread methods to Bridge
as they are not really specific to the scene anymore.

Change-Id: I7b93821913ce4d2fcbe3d8be489be6533ff87e57
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
2eea6fab1cbb0a5c8f913491c2d622c904759893 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
2d56b273ef6e2984a4e8914fb67772b173d0a154 23-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: use default nine patch classes.

Move away from using our own implementation of NinePatchDrawable.
Now use native delegate for a few methods of NinePatch.

The byte[] used to describe the 9-patch chunk is entirely controlled
by the delegate. Therefore, while the default version (JNI) use the
array as a representation of a C struct, this version uses the array
as a serialized version of NinePatchChunk.

A cache mechanism using SoftReferences allows us to not deserialize
the array every time rendering needs to access the chunk itself.

The Bridge-level cache mechanism for bitmaps and nine-patches as
changed. Since the new nine-patches doesn't hold the bitmap
data anymore (it's stored in a normal Android bitmap which
is cached itself through the cache), then the nine-patch cache
has been changed to only contain the nine patch chunk.

Also initialize the canvas with the display metrics to prepare
for correct scaling when density of the assets don't match the target
density.

Still to come: actual density support in the 9-patch drawing code.

Change-Id: Ibefcccf4432e1986e8436e0c41a0107741593536
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9223b6737c56619c02125ce988bb21fc4fde264b 20-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: support for editing embedded layouts.

When Resources.getLayout(int) is called to return a parser
for an embedded layout, this queries the current parser for
a custom parser (Eclipse will provide one on top of the current
XML model being edited)

Change-Id: Ia9e837358f67daed0a835e1b3f4f50c0516ceee9
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9e27936e4ab227126e48c4d92a4352dad987e672 12-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: Fix alpha support in Canvas/Paint.

Change-Id: I359098cfc542a7a0b7d99478c0eb13587b4439d0
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
c2e9651bf386a1f7bf7fc706cf5424950570470c 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/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
e0c763f54f5848a2513990fe37791b6f60ef7760 05-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: more text drawing.

Change-Id: I32f46d23e746b095be0577a53b61567a868f0b8a
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
4b606da91d2d76dd90a427cb3e37ea7df655e8e0 04-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib native delegate: path effects and xfermode.

Change-Id: Iafaac6dbaf452e2dba3e77c801089dad33ac4ea9
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
251d2e99245095369b52d891a660b2ed270f02e0 02-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib native delegate: primitive shapes and shaders

Change-Id: Id2b0c6231589e82d8e96c9f019042eba348a6583
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
abff653ce84e5079f35afab008c906063b0b2b6c 02-Nov-2010 Xavier Ducrohet <xav@android.com> More layout Canvas/Paint implementation.

Change-Id: Ib3da4a4b2259dc7c53b24444b5c0b78cee15d387
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
5802deabf06a0754c36e990ce2af7b5c8727e543 02-Nov-2010 Xavier Ducrohet <xav@android.com> More implementation of the layoutlib Paint/Canvas delegates.

Change-Id: I0c0029b9a679af4ae0178488f70b2a90292ea42d
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9f63ff263b0a97f0fa63e97136c18f6abccbfc68 28-Oct-2010 Xavier Ducrohet <xav@android.com> Layoutlib Canvas and Paint implementation through native delegates

Also fix native delegate generation to put "this" parameter even
for methods that don't have any parameters.

Change-Id: I5dd0c505871370ff7b4cda16de84a5b3ae438f73
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java