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/ComposePathEffect_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/ComposePathEffect_Delegate.java
|
c226e571fd6ce7db74fce87dbf300a70f8a58c29 |
|
03-Jan-2011 |
Xavier Ducrohet <xav@android.com> |
LayoutLib: Misc javadoc fixes. Change-Id: Iabe081c20b361b034c2e66b975b8756c0fdcd3d1
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_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/ComposePathEffect_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/ComposePathEffect_Delegate.java
|