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
- When drawing is not clipped to the top layers,
drawing should not happen automatically on all
existing layers. Instead each layer's flags dictate
whether drawing should happen on layers beneath, starting
with the top layer.
- upon restore, the same mechanism is taken. Only blit
a layer into the layer beneath if it was drawn into
using the logic above.
Also fixed:
- saveLayer() does not, in fact, always save matrix
and clip info. The flag dictate this, the same way
it does in save()
- drawing code didn't properly detect the case of drawing
into layers if a save() was called after saveLayer().
Now the code only looks at the layer list which provide
all the needed info (flags mostly), and doesn't rely
on mLocalLayer (which is used during restore only now).
- Properly handle HAS_ALPHA_LAYER_SAVE_FLAG (or lack
thereof) when creating the BufferedImage for the layer.
Change-Id: I2fbbcc0f5d3a3dd208763705bc23e6658fd4e573
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
- 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
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.
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
- fully support canvas transform
- fully support shader local transform
- fix repeat/mirror issue in the negative values.
Change-Id: Ib2aa7ade1c2702da4364cbda9a5a3ae72c1d3174
* commit '0ccc8b7345eac0b507c221be47e55926cbda8957':
GL texture filtering changed from AND to OR, so rename tag name to match. (<uses-foo> == AND, <supports-foo> == OR, e.g. uses-feature vs. supports-screen).
* commit '5441a9ff2128cf2c5088974c74b79d2d1734f755':
GL texture filtering changed from AND to OR, so rename tag name to match. (<uses-foo> == AND, <supports-foo> == OR, e.g. uses-feature vs. supports-screen).
The asset system and supporting libraries were using off_t instead of
off64_t to access files larger than 2GB (32-bit signed). This change
replaces all off_t with off64_t and lseek64.
There is a new utils/Compat.h added for Mac OS compatibility.
Also fixed some size-related compiler warnings.
Bug: 3205336
Change-Id: I9097b3cb7a602e811fe52f245939d8975da55e9e
- 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
Use Vendor ID, Product ID and optionally the Version to
locate keymaps and configuration files for external devices.
Moved virtual key definition parsing to native code so that
EventHub can identify touch screens with virtual keys and load
the appropriate key layout file.
Cleaned up a lot of old code in EventHub.
Fixed a regression in ViewRoot's fallback event handling.
Fixed a minor bug in FileMap that caused it to try to munmap
or close invalid handled when released if the attempt to map
the file failed.
Added a couple of new String8 conveniences for formatting strings.
Modified Tokenizer to fall back to open+read when mmap fails since
we can't mmap sysfs files as needed to open the virtual key
definition files in /sys/board_properties/.
Change-Id: I6ca5e5f9547619fd082ddac47e87ce185da69ee6
Also moved the prepare/cleanupThread methods to Bridge
as they are not really specific to the scene anymore.
Change-Id: I7b93821913ce4d2fcbe3d8be489be6533ff87e57
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
It seems Linux host build has a fancy strrchr overload that preserves
constness. That's nice but it broke this.
Change-Id: I3c9b57b9ce9abc5d334d1e7b2498a3248bd20a6a
Also added a validation tool for keymaps (not currently integrated
into the build system but getting there).
This change brings back Android.mk with the intent that it will
be used to validate keymaps in a later change.
Added some missing keys that are present on phones.
Bug: 3215210
Bug: 3225421
Change-Id: Id817c6e2215164616942c51a42752915d9ceacd3
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
New mipmap drawable type that does not get filtered according to
configuration. Useful for things that get built as part of the system.
Change-Id: I556033d065e504079271dce79c23c90d3c387ce4
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
When an include tag is parsed, the custom bridge
code never has access to both parsers at the same
time.
The child parser is created out of an in (representing
the layout id), and the code inflating the content of
the include layout doesn't see the parent parser either.
This changeset adds a parser stack in the BridgeContext
in order to allow access to the parent parser when setting
the viewkey. This is only used if the current parser depth
is 1 (top node), as we only want to set the include
node to the top node of the included layout.
Change-Id: I2ac3b72a0c84a269d9019f44f98cbc0b615ab959
This fixes the SlidingDrawer that failed to load.
For some reason, in case of the SlidingDrawer, when the constructor
uses android.R.styleable.SlidingDrawer it's the same values but not
the same instance as the array read from android.R through reflection.
So what works for all other widgets, and has worked since the very first
layoutlib isn't working anymore, and we'll now have to use a wrapper
similarly to what we use in ADT in the project callback.
We should probably provide a single int[] wrapper class in layoutlib
API for all to use.
Change-Id: I4d7d038540f8a24541a588696f1059a020b589e5
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