History log of /frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
98019652d24a92fa80af9353438dbb3ec63cc03c 09-Feb-2018 Jerome Gaillard <jgaillard@google.com> Update Canvas_Delegate following commit 7717e22

Change I48bdcf3d introduced a new native method in Canvas.java. This
adds a corresponding delegate for it.

Test: layoutlib tests
Change-Id: I11373c9547e57137d0bceb9384390650746258a0
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
dcc3e373c444b488f84a97654ef14667d183a423 29-Aug-2017 Jerome Gaillard <jgaillard@google.com> Update layoutlib following Changes I6674d1ac and Ie49d14a3

Test: layoutlib tests
Change-Id: I67da967edcbc1936e9a6a2793178f258ce39d808
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
09b2291d2e2638485bf267642faa76d1e871c864 01-Feb-2017 Jerome Gaillard <jgaillard@google.com> Update Canvas_Delegate after Change I3edc963a

Test: layoutlib tests
Change-Id: I1f285c3baac267bd47324802c12b33d34f8b581f
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
66c18b55d240ab007c1bfa33d5f857b5bd97f150 16-Jan-2017 Jerome Gaillard <jgaillard@google.com> Delete Canvas_Delegate.nClipRegion after Change I71f9bd68

Test: layoutlib tests
Change-Id: I9c04fa258cdaf06972b205e5dd5d3b505e5bea17
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
989f4cb6da0c1d20f74a278878bc173c690d0848 24-Nov-2016 Jerome Gaillard <jgaillard@google.com> Fix layoutlib to reflect recent changes in platform code

Test: Layoutlib tests
Change-Id: I81964233a9e580ccee9c9e9b0cf3525babf30bd4
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
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/Canvas_Delegate.java
3f05ee4582c24b84deff038d63e93dc33451f922 31-Oct-2016 Diego Perez <diegoperez@google.com> Remove refSkPixelRef

Change-Id: I4d6e7076d2b87dd208c0eba27491c13f56567420
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
e4cf18face6980b0c7ac42761512cd93b89927c3 23-Feb-2016 Diego Perez <diegoperez@google.com> Implement native methods in VectorDrawable

Most of the VectorDrawable implementation has been moved to native code.
This CL implements most of the required functionality that existed in
Marshmallow.

Change-Id: I009bcd5c166f2bfa0795d2718fabab4a549eba9f
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
fbe158f5e1f77cea2a335834a1c91fea1c4680aa 07-Oct-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib fixes for N

Moves LayoutLib to Java 8 - YAY!
Fix delegates

Change-Id: I098996e43e330e995d33f12df1c16355bbc02f0f
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
a1c6015169815e90684917ac215926ae22e61d7a 18-Dec-2015 Diego Perez <diegoperez@google.com> New path interpolation to paint vector drawables

Before this CL, PathMeasure_Delegate would use Path_Delegate.approximate
to get a path segment to draw. Path_Delegate.approximate uses a
flattening iterator to do the path approximation.
Unfortunately, because we do not control the stroke mode while painting,
in some cases the approximation would draw unwanted artifacts caused by
the rough approximation and the use of wrong miter values.
This CL does a much better calculation of the path and interpolates the
segments of the curves instead of replacing them with line segments.

This also fixes an issue with the calculation of empty paths.

Bug: http://b.android.com/187256

Change-Id: I450f7aa4c3d9efcbf902a40c3b4d6d388546893f
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
308156c08905013c114663694f7f0caac804aec9 07-Oct-2015 Deepanshu Gupta <deepanshu@google.com> Skip drawing empty shapes to keep Apple JRE happy.

Bug: http://b.android.com/178278
Change-Id: I693912678ed79e9c6690560b618a605da5a807c6
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
442aee6bc1abfb143dcfa1ba60d696e576d066c4 22-May-2015 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Change nullity annotations.

Switch from using tools nullity annotations (com.android.annotations)
to android framework annotations (android.annotation).

A new sdk-common prebuilt is required for LayoutLib tests. The new
sdk-common requires an updated tools-common. The updated tools-common
doesn't have nullity annotations. So, instead of adding the annotation
dependency, just reuse the platform ones. This also paves the way to
include other platform annotations like IdRes etc.

Change-Id: I87b8f767d3681d914abe7d1329e26a87f49f50a7
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9fe7fca9bcdceade9c654c6a8dcf0c48be16d78d 12-May-2015 Deepanshu Gupta <deepanshu@google.com> Add missing delegates for M preview.

- Remove ICU dependency (use the version bundled with platform).
- Restructure intelliJ project to move dependencies to module.
- Minor fixes to layoutlib tests.

TODO:
- Load ICU data.
- Hyphenator doesn't work.
- High quality line breaker not present.

Change-Id: I965e096e17bfc97ee995a649c3f4f6f64bb4f70d
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
223eb7f5038271cac88e2c75ce26878243f23fcf 28-Apr-2015 Deepanshu Gupta <deepanshu@google.com> Merge "Fix view outline for shadows in LayoutLib." into mnc-dev
a91059a7754fd3a5e9b13718599138fba054ebc2 24-Apr-2015 Raph Levien <raph@google.com> Expose drawTextRun publicly

For correct low-level drawing of low level text, a method that
includes context for shaping is necessary, and it's similarly useful
to provide the direction explicitly rather than running the BiDi
algorithm on the text. The drawTextRun method (in both char[] and
CharSequence variants) has provided this functionality for several
major releases but has been internal. This patch exposes the
methods publicly, and also improves the doc strings for both
the new method and some related ones.

Bug: 20193553
Change-Id: I9be33ca5ae3e7db2b69a56298400671d5ef8ad05
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
ddf486d3a74e0742eabc851e666920d9c0df0ae3 20-Apr-2015 Deepanshu Gupta <deepanshu@google.com> Fix view outline for shadows in LayoutLib.

Set the bounds on the drawable before getting the view outline for
shadow. Also, reuse the temp outline object in AttachInfo rather than
allocating a new one each time.

Change-Id: I69793d38d60c5b9f9050569f2b22fbc7b90620bf
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
fa1b082165dcbbc956e2aa598a3f8b3f82d90ece 24-Mar-2015 Deepanshu Gupta <deepanshu@google.com> Fix RoundRect radius.

Android APIs use radius for measuring the corner's curvature, but Java2D
APIs use diameter. Add the missing conversion.

Change-Id: I630fc8712e8301324c641885c0c4adf644d13b7e
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
a74fdf0ffb09c977ebb47a67e45504252b71f2f6 31-Jul-2014 Deepanshu Gupta <deepanshu@google.com> Fix Delegates

Change-Id: I2b6a6b679b7a5b2532b76b723155bc2763b70768
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
faf06eb066e8ba5f3a58fde94bff1bb8b0a2ba02 16-Jul-2014 Deepanshu Gupta <deepanshu@google.com> Use BlendComposite for advanced PorterDuff Modes. [DO NOT MERGE]

Not all PorterDuff modes are supported by Java's AlphaComposite. Use
BlendComposite for such modes.

Change-Id: I51486a40f09186cf8a87ce1e6a3d1cfcf39fb2d3
(cherry picked from commit b15709cd36d28c47660b0ae30918642bfd3d85f7)
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
237740ba09c2dc38ea37e6e5ca1fe1d90e26c298 26-Jun-2014 Deepanshu Gupta <deepanshu@google.com> Update text rendering delegates.

The flags for RTL and LTR are simplified in commit
0a1d91862a3822dcbbb412bcd6d69b0f5f079f8b. This change follows up the
same in LayoutLib.

This also fixes the following bug which incorrectly computed runs with
'en-dash' (\u20132) as RTL.

Bug: http://b.android.com/69432
Change-Id: Iaed62d13ce31f107773576ed2ef412be6037cd04
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
00774ed34f31ee4161b38b2c7de421ff8a8061c0 26-Jun-2014 Deepanshu Gupta <deepanshu@google.com> Sort delegates in Canvas_Delegate

The order of the methods match the order of the declaration in the
Canvas file. This makes searching for the methods easier.

Change-Id: I230621d3999024cb2ff42a1aacd60908c7f0b161
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
f587825e94af5200aadc77a86e9f5084ac1a4e94 26-Jun-2014 Deepanshu Gupta <deepanshu@google.com> Update LayoutLib delegates.

Change-Id: I64828bfb963048effbc49a622f5f2aa0203665e6
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
6a750916fa7faedefdc6c4efb163d7108da649ed 24-Jun-2014 Deepanshu Gupta <deepanshu@google.com> am e558d180: Merge "LayoutLib: Support PorterDuffColorFilter" into lmp-preview-dev

* commit 'e558d1806b29385aa14ba60f18e103e2c9aeef1b':
LayoutLib: Support PorterDuffColorFilter
1128e789ab65efbc69405b2fd3455f4cd2fc45ec 22-Jun-2014 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Support PorterDuffColorFilter

Add support for select modes for PorterDuffColorFilter.

Change-Id: Ia7b4a6a92c326be977dd87a70f54c1f8954b546d
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
53148e25a98d6c536dca5eb3243e7b6f9deb72e2 06-Jun-2014 Deepanshu Gupta <deepanshu@google.com> am ee001119: Merge "LayoutLib: Add assertions for typeface." into lmp-preview-dev

* commit 'ee0011198ff150f972c8afbc5dff695bce2af1f1':
LayoutLib: Add assertions for typeface.
b1ce7c1c2d22e1455f1a2f741d38424988aa6be6 05-Jun-2014 Deepanshu Gupta <deepanshu@google.com> LayoutLib: Add assertions for typeface.

Framework passes typeface along with the paint object at many places.
Paint_Delegate is supposed to have the typeface object with it. Add
assertions to ensure that the two typefaces are indeed the same.

Change-Id: I68193513c2d99f269c0458d6493f23025bbda385
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
7aca43390f64ee5bd82c17552c03accb0745b5b2 08-May-2014 Florin Malita <fmalita@google.com> Add a native Canvas wrapper.

Instead of storing a direct SkCanvas reference, Canvas now tracks
an opaque native wrapper class. The native wrapper can be used to
store additional info for emulating deprecated Skia features
(at this point it only stores a canvas).

Some notes:

* all native handle -> SkCanvas conversions are routed through a
handful of native utility methods.
* safeCanvasSwap() refactored as a lower level setNativeBitmp() - which
is what clients need.
* removed unused get_thread_msec() (Canvas.cpp)

Change-Id: I715a5a6f1e1621c1cfc1e510ae4f2ea15cf11114
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
ce5414e0eb1aeb76e6df5f6c9c6385c5f45141bc 20-May-2014 Deepanshu Gupta <deepanshu@google.com> Layoutlib fixes for L

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
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
0bec685a9bde5e23ee2e9ce598e948e2aec8bcf0 15-May-2014 Deepanshu Gupta <deepanshu@google.com> Layoutlib: Update delegates for L

Update delegate method signatures for L.

Change-Id: Ie607293bcae60b2d3a61d1cad3ac5f04bda2a238
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
b6d0da46a4c0d7a62dbdd68729614748bd36ce38 07-May-2014 Florin Malita <fmalita@google.com> Encapsulate Canvas.mNativeCanvas

Currently, the native canvas is accessed/manipulated from several
unrelated classes.

In order to facilitate SaveFlags emulation, this CL encapsulates
the field and refactors its external users.

Two main changes:

* new getNativeCanvas() getter for use in Java-level clients.
* JNI canvas swappers (GraphicsBuffers, Surface, TextureView &
AssetAtlasService) are refactored based on the exising/equivalent
safeCanvasSwap() Canvas method.

Change-Id: I966bd4898f0838fb3699e226d3d3d51e0224ea97
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
f9a823540ce0e23e3bbdd7c1fb8bf2639e20a8bc 22-Feb-2014 Deepanshu Gupta <deepanshu@google.com> Update layoutlib tests to check methods return value.

The test in layoutlib bridge has been updated to check the return
value of the delegate method match the value of the overriden method.

This changeset also fixes the problems found due to this change.

Change-Id: I87cef323c4eaee4e9f60475f01156b276593fa50
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
8b0a25ace60fc087d4ea87b920ce766508843297 06-Feb-2014 Deepanshu Gupta <deepanshu@google.com> am 1bcc286d: am db0427a0: am 5800b19a: am 50b0ce4e: am fd8cba3a: Merge "Fix the measurement of text bounds." into klp-dev

* commit '1bcc286def646f98747bce2c4dedb0737d5fcf9d':
Fix the measurement of text bounds.
22731b0cff46dd4094520881f06ea3b46a8e50ad 06-Feb-2014 Deepanshu Gupta <deepanshu@google.com> am db0427a0: am 5800b19a: am 50b0ce4e: am fd8cba3a: Merge "Fix the measurement of text bounds." into klp-dev

* commit 'db0427a0ac986e0823e7bbe9b7c12a97aabe133e':
Fix the measurement of text bounds.
6b363a16a9a46cc7e37dfac87fa656414611ef64 06-Feb-2014 Deepanshu Gupta <deepanshu@google.com> am 50b0ce4e: am fd8cba3a: Merge "Fix the measurement of text bounds." into klp-dev

* commit '50b0ce4e8ed353ed841782aeb58963bc084f2e16':
Fix the measurement of text bounds.
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/Canvas_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/Canvas_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/Canvas_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/Canvas_Delegate.java
97ba95f72ef9e5fa3e37ec0ad5c6a2da698e0a1f 05-Sep-2013 Deepanshu Gupta <deepanshu@google.com> Fix text rendering

There are still some errors
1. Little vertical clippping for extra tall glyphs.
2. Breaking into scripts isn't perfect which results in incorrect layout
of text.

Change-Id: Ib7b008b4ab5e689038678825289199aeb4bd815b
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
eb998d3d38dfb2cab9759ce6b85d0af34f16f77c 07-Jan-2014 Deepanshu Gupta <deepanshu@google.com> Fix the measurement of text bounds.

Bug: 12366230
Change-Id: I203b678363dc7b688c744503ee10216baca658a9
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
83a14824ce79a109de4a3452a8a43e13e861e1be 05-Sep-2013 Deepanshu Gupta <deepanshu@google.com> am b50de495: am dd4efc22: am 3a762d8b: Merge "Fix text rendering" into jb-mr2-dev

* commit 'b50de4951aaea6d6f01432dc17b7c5de778a2e71':
Fix text rendering
a6b207a2cfc2f542a1f9b1eaee1a9047f25b4dea 12-Jul-2013 Deepanshu Gupta <deepanshu@google.com> Fix text rendering

There are still some errors
1. Little vertical clippping for extra tall glyphs.
2. Breaking into scripts isn't perfect which results in incorrect layout
of text.

Change-Id: I54de3c05eca5e8affb1135c120eea24c3afe8a47
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
0be5d2130030f599deb0110ba3702450f62b2e62 03-Aug-2013 Jonathan Dixon <joth@google.com> Refactor Canvas.drawPicture() to delegate to Picture

Bug: 9814370

To allow WebView.capturePicture() to return a subclass, we need to
ensure the subclass is always consulted when being drawn into a canvas.

Change-Id: Ia0357f95b6fafb3ac81e6bcfaef05739e619897a
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
c398f18739cb807c353545f39458148213c52ca6 24-May-2013 Deepanshu Gupta <deepanshu@google.com> Add missing native methods.

Change-Id: I7b34e2ec0164520efc658053a80f307791a992b1
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
85e7d4f5d5c0dca7afd7d505e184fa26864ffbfe 09-May-2012 Xavier Ducrohet <xav@android.com> Add missing native method to Canvas_Delegate.

Change-Id: I86288c942004e5489eacc43ba5e112cf56f94487
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
d98e133b3911b8db3430ce9d85efd5a6adcf70bf 03-Feb-2012 Xavier Ducrohet <xav@android.com> Make Layoutlib compile on Java 6.

Change-Id: Ic8f0e321c6c218de83664fc01f253a07fa80852c
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
9bfec182d66928f5142c40dc0057fed7f0eba695 19-Jan-2012 Xavier Ducrohet <xav@android.com> Fix broken drawCircle LayoutLib.

Change-Id: I5e23bbe0119e385fa2f77854a8f88128351d3759
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
0fb362cbd32fd4fc68a35ef79df50f2d65d823ca 20-Jul-2011 Xavier Ducrohet <xav@android.com> Layoutlib: misc fix + start of AndroidBidi support.

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

Change-Id: I49306868cd8a41b6b7d919c3e8b108d5c014530e
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
35cd9992e5e757d9b4f2829ef4b67b75c3ef74b5 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
dc8045be66658aeb37809a2456edf838b6cc22c9 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
49bac00d30de753407b92a4f7d9ed5ae30139826 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
b2de8394cdb18593f27601b5736ec299a6851371 24-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Add debug mode.

Change-Id: If4263c7dba63a063f84e0c6988c270eb6d291ac3
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
f4d52a6152baf569aab9afba2471d3fbd2dfd9d3 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/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
1eeaea0f020e05a208abbcfbbf99f3777e681bdb 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/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_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/Canvas_Delegate.java
6d13be2394315a1bfeb837b308591e636d40b60b 14-Jan-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Fix multi-line text rendering.

Stupid indices.

Change-Id: I1dbdd04b8f25a5769de8dc21e6c513cef3e35635
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_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/Canvas_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/Canvas_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/Canvas_Delegate.java
942529660883aacb9971e0e07b7c12d108978988 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
b97612483440e28c44d0a6ca98760aa7f34dc7fc 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/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
be4eb8294c99e063c91d3512ef9b579d3e784054 22-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: improve bitmap support.

Change-Id: I703c2bdf51380b54fd5c20b08d3bc74833d9bc6e
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
66225224938402d96919bf3ddfb0a296eed91598 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/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_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/Canvas_Delegate.java
df67eabecc99e318d4057145a957a7549d95e0a3 14-Dec-2010 Xavier Ducrohet <xav@android.com> LayoutLib: implement more of Canvas/Paint.

Change-Id: I8e2a7a3bddbce08db5eb641b5075bedd75f7be27
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
3054fe698a6be732e24128541a1db867ec606a59 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
1392615c49943383baf51262e2df6975266b4c2f 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/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
e4d978793ab8b4fdf88c7a6235d9ba17860c7bda 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
f7c92077f0fa54a75dc03d788a344a8c8b5c6760 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
70a04aa097ff6548ffa6efd07d19f2a0424fc3ea 12-Nov-2010 Xavier Ducrohet <xav@android.com> Layoutlib: Fix alpha support in Canvas/Paint.

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

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

Change-Id: Iafaac6dbaf452e2dba3e77c801089dad33ac4ea9
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
a313b65bd4d0cc38f2237003e770b28aad39d136 02-Nov-2010 Xavier Ducrohet <xav@android.com> More layout Canvas/Paint implementation.

Change-Id: Ib3da4a4b2259dc7c53b24444b5c0b78cee15d387
/frameworks/layoutlib/bridge/src/android/graphics/Canvas_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/Canvas_Delegate.java
ef44aead46faf1bbc4120825cd6e457ac8ddba1b 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/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java