Add force-dark support to RippleDrawable by modifying the ink color.
Test: manual
Test: atest CanvasOp
Fixes: 186130682
Change-Id: I89eaaf3afa5ec53a74d2d08de8cff6484e55a912
The sparkle loop animation was happening on the UI thread and is poses
some interesting challengers:
- Animations freezes when UI thread is busy, for example when
startActivity is called.
- onDraw calls add unnecessary work to the UI thread, leading to jank
in some cases, like PIP
Test: manual
Fixes: 184760248
Change-Id: Ie2840c767da61476678839eaac215dc3aff95b5c
Update RenderNodeDrawable to hole punch areas into
layers created for SurfaceView
Bug: 184297961
Test: Added CTS test to SurfaceViewTests
Change-Id: I1f03a4fe34c5a8b7411ebe728ea3d4195fcd1fac
Removes complication of copy-on-write intermediate class, and
allows for shaing a single applyLooper() function.
Test: make
Bug: 178700363
Change-Id: Ia74cb8e7c650e469b8429de1d7cf9204821d8f11
uniforms are no longer set as single block of bytes where the caller
has to know the offset, but instead by the string identfier in the
shader. This CL only supports floats, but future expansions of this
will provide helpers for ints, colors, and byte[].
Also by storing the shaders and uniforms in the RuntimeShaderBuilder
we can more easily copy them. This enables Canvas.drawRipple to not
just copy the compiled SkSL effect, but also all the uniforms and
other input shaders set on the RuntimeShader.
Bug: 177051137
Test: HwAccelerationTest
Change-Id: I4733f42ba662546be6bebc37f0b89832778e66ce
Make DisplayList its own type instead of an alias,
pushing the Skia aspect behind it mostly. Removes a bunch
of manual memory management and opens the door to DisplayList
being a union type with multiple implementations
Test: builds (somehow), boots, hwuiunit passes, CtsUiRendering passes
Change-Id: I1d7806aa3afc5d9ece08b06959920078a5814c59
This also adds the ability for RenderThread to animate a few
predefined shader uniforms.
Bug: 177051137
Test: demo in ag/13296877
Change-Id: I6e58e671ad1242a07ecb1cf4cdb48031f85c2088
This has been hardcoded as ALL_SAVE_FLAGS for a couple releases now.
Since it's now permanent behavior, remove the last bit of plumbing
for SaveFlags on saveLayer
Test: builds & boots
Change-Id: Iec92f27199d0b4781c2293dcdcfd45a1562a1b4e
The bounding box information is not used for drawing glyphs, so
removing them from Canvas.
Bug: 169114687
Test: hwui_unit_tests
Change-Id: I512717cd00fe56e5b74fcc32fbdf2319e273074e
Bug: 155422223
Test: make
insertInOrderBarrier and insertReorderBarrier are @hide and deprecated.
Remove them and update all callers to enableZ and disableZ, which are
already public.
Update native code to refer to enableZ instead of insertReorderBarrier.
In addition, remove @hide Canvas#isRecordingFor. This method was
originally used to prevent a single RenderNode from being in two display
lists. This is now supported, so there's no reason to avoid it. The one
caller used it to determine whether to reorder drawing its child Views
(which, as the comment says, makes sense to determine based on whether
the Canvas isHardwareAccelerated) and whether to call
insertReorderBarrier/insertInOrderBarrier (now enableZ/disableZ). In the
latter case, there is no need for a conditional, since enableZ/disableZ
only work on a hardware Canvas.
Change-Id: Ib216a19d6aeff40b2e23532bacd62d1795c2ab27
The purpose of this is to be able to use the native graphics code from
the Android platform directly in Android Studio (running on desktop) to
do layout rendering.
This creates a host library that is a subset of libandroid_runtime
including only the JNI files relevant to Android graphics. It also
includes LayoutlibLoader.cpp which is used to load the JNI when using
it as part of layoutlib (the graphics library for Android Studio).
This also creates libhwui-host, a host library that is a subset of
libhwui.
Bug: 117921091
Test: lunch sdk && m libandroid_runtime
Change-Id: I3850020d2d4c13c85e377476bc463d3eb6a01c6d
Instead of allocating a separate renderTarget and switching
between them on each draw the new implementation follows the same
pattern that the old HWUI renderer used. The area of the layer is
now copied to a buffer on the GPU, the area is then cleared, rendered
as normal, and finally the texture is redrawn using dst_over blending.
This results in no render target switches and is considerably faster
on some hardware.
Test: CtsGraphicsTestCases, CtsUiRenderingTestCases
Bug: 119222339
Change-Id: I716aac1fc31e4c7a171373d37dee82034c01cf18
Also for a canvas wrapping a bitmap the colorspace of the bitmap
will be used to correctly blend content.
Test: CtsUiRenderingTestCases
Bug: 111436479
Change-Id: I63ad7a30605a7f725cc0ef4716d42ea978fb03e3
Exposed Skia's underlying drawDRRect method used to draw a double
rounded rectangle
Bug: 117181396
Test: Added test case to verify Canvas#drawDRRect and re-ran CanvasTests
Change-Id: I4e1954c8ffc82811dc541488d1df9b37309faf51
The current implementation schedules the next frame of the images
to be decoded after the current frame completes but potentially
schedules tasks that will result in a no-op execution if a new
frame is not yet needed.
Test: HwAccelerationTest
Change-Id: I0510cb5a1b801abd651327e924deb586af0306d6
Bug: 63909536
Bug: 63908092
Test: TODO
If ImageDecoder.decodeDrawable is called with an animated image Source
(currently GIF or WebP), return an object of a new (hidden) Drawable
subclass. The new Drawable animates, and it implements Animatable (TODO:
implement Animatable2) so users have some control over the animation.
In addition to the normal features of Drawable, this new one supports
many of the features of ImageDecoder, including scaling, cropping and
PostProcess, which enables circle masks/rounded corners and other
arbitrary after-effects. It does *not* support decoding directly to a
Hardware Bitmap, since it cycles through frames and reuses the same
bitmap memory. But it could be made to use shared memory (TODO?).
TODO: Use a better number for the native allocation registry
TODO: Use the RenderThread to drive the animation, and remove decoding
on the UI thread.
TODO: Add support for modifying the loop count
Android.bp:
- build new AnimatedImageDrawable.cpp
AndroidRuntime.cpp:
- register new native methods
AnimatedImageDrawable.java
AnimatedImageDrawable.cpp:
- new Drawable that handles animated images
Canvas.h, SkiaCanvas.h/.cpp
- New virtual method and implementation for drawing SkAnimatedImages
RecordingCanvas.h/.cpp
- Stub implementation of drawing SkAnimatedImages
ImageDecoder.h/cpp
- Allow code sharing with AnimatedImageDrawable.cpp
- postProcess
- access the ImageDecoder struct
Depends on https://skia-review.googlesource.com/c/skia/+/94660 in Skia.
Change-Id: Ie2ec98d9c52deda4d439c6ef8e5dea2861bb93a3
For picture-backed canvases, we will defer the xform
until playback.
Test: Unit tests and cts test.
Bug: 32984164
Change-Id: Ib74663bcb688b74b6ba8792b403b0475126732af
This allows Skia to remove
SK_SUPPORT_LEGACY_CANVAS_VERTICES
SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF
SK_SUPPORT_LEGACY_PIXELREFFACTORY
Test: Existing CTS cover these changes
Running CtsGraphicsTestCases, there were 6 failures w/ and w/o this CL.
None of the 6 seems related to this CL.
Change-Id: I724082357d9f6cb699770df3c0b9ef555b957697
Avoid one memcpy in Canvas::drawGlyphs for all pipelines.
Test: CTS passed with exception of SweepTests#testBasicDraws
shadowtext, which fails with and without this CL.
Change-Id: I0841232dc7a6173eb3b03f939dbde15a84186296
This API is difficult to support for printing and has other negative
effects as it does not respect the current matrix/clip.
Test: compile
Bug: 14650725
Change-Id: I71f9bd687d446c7ce8910d755421aad8e09458db
Implement SkiaRecordingCanvas, RenderNodeDrawable, GLFunctorDrawable,
LayerDrawable, StartReorderBarrierDrawable, EndReorderBarrierDrawable.
Move AnimatedRoundRect and AnimatedCircle in a separate file.
All Skia pipeline files are moved in hwui/pipeline/skia folder.
Add unit tests for RenderNodeDrawable, StartReorderBarrierDrawable,
EndReorderBarrierDrawable and SkiaRecordingCanvas.
Test: I tested manually on 6P devices and did run the unit tests.
Change-Id: If2a347bd1fc4689953822294ce5bf98c7f3f57c7
Most changes are taken from ag/1407698, ag/1336660, ag/1488900.
Test: Built and run manually on angler-eng.
Change-Id: Id4e464b9a83c62b6bc7ea31a30e5ca6cd53b659d