History log of /frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ec4a50428d5f26a22df3edaf7e5b08f41d5cb54b 04-Apr-2012 Amith Yamasani <yamasani@google.com> Embed layout padding in nine patch images

- Added a new custom PNG chunk that carries the layout padding ints.
- Extract the padding ticks from .9.png images and store in the chunk.
- Load the padding information at runtime into Bitmap and NinePatchDrawable.

- The new chunk is ordered first so that it doesn't cause a problem in older
versions of the platform.

Bug: 6087201

Change-Id: I5de46167a1d44b3ec21065b0c165e594b1dc8399
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
7f9f99ea11051614a7727dfb9f9578b518e76e3c 11-Aug-2011 Xavier Ducrohet <xav@android.com> Make some methods/fields package private so that layoutlib can access them.

Change-Id: I4aeadfbaf8a4f6a459fa19937c21ac23d9e5fb64
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_Delegate.java
779c906592b67867fee83a6527d474c333a701ff 05-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Replace custom BitmapFactory by a simpler delegate

Change-Id: Ie61a0a5b4426e64bb71a22d76d05efa4c0865e5e
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
16584225125acba18b74920b902c798dfead0328 28-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Properly compute available space to layouts.

Also display placeholders for status/title/action bars depending
on if the app is a tablet and its theme.

Change-Id: I651c1a2e5cfde165e004c11b236e6df056853dec
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_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/Bitmap_Delegate.java
19a021038f2f4683dddef651543d7298f5bd7218 16-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Update layoutlib with revised API.

Change-Id: I78929df621f48e85d9cbefe1f5590f9ce99bbaff
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
22ff4ef09fc80a85992d8a911fff03a4712187e7 15-Dec-2010 Patrick Dubroy <dubroy@google.com> Fix build break due to additional arg in Bitmap ctor
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
ffb42f6c5043de226f02318a1311669d35a90711 10-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: Adapt to new LayoutLib

API now uses ResourceValue instead of IResourceValue
Capabilities renamed Capability

Change-Id: Ia5d2b6c8d536e020a1f5496fb2285f67fc4346c4
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_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/Bitmap_Delegate.java
5a09488a158b669577cd8eb557ce4feb62929e75 19-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: Properly dispose of bitmap delegate.

This is done by initializing the android.util.Finalizers that's
reponsible for calling out to the native bitmap destructor.
Also implemented the native bitmap destructor

Also fix Bridge by removing obsolete API methods, and removing
some unneeded synchronized blocks now that the whole rendering
(and scene creation) is protected by a synchronized on the bridge
object anyway.

Change-Id: Ie1792da6db354836542dfc11f457fe4a6d78ddfb
/frameworks/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_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/Bitmap_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/Bitmap_Delegate.java
5de11a18e9151e6bc9b3e81cf31fc43dc63dffbf 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/base/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java