OSDN Git Service

New path interpolation to paint vector drawables
authorDiego Perez <diegoperez@google.com>
Fri, 18 Dec 2015 16:01:24 +0000 (16:01 +0000)
committerDiego Perez <diegoperez@google.com>
Tue, 19 Jan 2016 10:14:46 +0000 (10:14 +0000)
commitb9c48d8f49d35e2682c7205a9d8d5fcc25d7c736
treee4ab1ceefbaed1d6b482092c13f0b9565bcb4e18
parentf5984d5fce511a669e8d4bb6eaeb9679ff2ba9f0
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
tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
tools/layoutlib/bridge/src/android/graphics/PathMeasure_Delegate.java
tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/CachedPathIteratorFactory.java [new file with mode: 0644]
tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/vector_drawable.png [new file with mode: 0644]
tools/layoutlib/bridge/tests/res/testApp/MyApplication/src/main/res/drawable/multi_path.xml [new file with mode: 0644]
tools/layoutlib/bridge/tests/res/testApp/MyApplication/src/main/res/layout/vector_drawable.xml [new file with mode: 0644]
tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/Main.java