77 Commits

Author SHA1 Message Date
Derek Sollenberger
2d14213849 Initial implmentation of AnimatedImageDrawables on the RenderThread.
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
2018-01-24 13:11:39 +00:00
Leon Scroggins III
671cce2605 Make ImageDecoder return animated Drawables
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
2018-01-17 17:06:57 -05:00
John Reck
1bcacfdcab Format the world (or just HWUI)
Test: No code changes, just ran through clang-format
Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2017-11-03 10:57:44 -07:00
Stan Iliev
0b58d99283 Optimize Canvas::drawGlyphs
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
2017-04-04 15:43:12 -04:00
Derek Sollenberger
792fb3252f Use SkPaint.nothingToDraw instead of PaintUtils helper.
The PaintUtils helper is now shared between all pipelines and was
missing a quick reject test for drawLoopers which are used in
view.setShadowLayer and supported in the Skia pipelines.

Bug: 35809097
Test: added hwui unit test and verified in DocumentsUI app
Change-Id: I3c4a988f1c42b7f421f78ac3659af1daee910ea2
2017-03-03 14:24:58 -05:00
sergeyv
3e9999bd86 Explicitly destroy Layer in DeferredLayerUpdater on destroyHardwareResources()
Change-Id: I0987104eabda9a2a302b9e765213aad48f93aea4
Test: refactoring CL. Existing tests still pass
bug:33753499
2017-01-30 16:42:41 -08:00
Greg Daniel
8cd3edfa15 Break Layer class into Gl and Vulkan subclasses
Test: manual testing
Change-Id: Ibd2beed39de3ac6da7448e96496253cfe427dfbb
2017-01-10 15:05:07 -05:00
Derek Sollenberger
b29b16e542 Remove clipRegion from the public API.
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
2017-01-04 14:57:43 -05:00
Mike Reed
6e49c9f007 switch over clip calls to use SkClipOp instead of SkRegion::Op
Change-Id: I67d23c487b5249bc31d96e3b2393f693c0b2bcff
2016-12-07 10:34:39 -05:00
sergeyv
98fa4f9e7b Use Bitmap in Texture.upload
Test: refactoring cl.
bug:32216791

Change-Id: Ib0b16c878d8371e0471e9a502f55626ec5999c60
2016-10-26 13:57:38 -07:00
sergeyv
ec4a4b13ea Use Bitmap in DisplayList & RecordedOps instead of SkBitmap
Test: refactoring cl.
bug:32216791

Change-Id: I1d8a9a6e772e2176b6c2409409a910478b45f8db
2016-10-21 12:11:44 -07:00
sergeyv
5fd2a1cb27 Pass Bitmap instead of SkBitmap in drawNinePatch & drawBitmapMesh
Test: refactoring cl.
bug:32216791

Change-Id: I5adcd59daf752d36012456b0a9960c59d07e2e3d
2016-10-20 15:04:28 -07:00
sergeyv
fc9999505a Pass Bitmap instead of SkBitmap for bitmap rect operation
Test: refactoring cl.
bug:32216791

Change-Id: I66d19194c57b3aa2c400aa87acffc774a533776a
2016-10-20 14:04:35 -07:00
sergeyv
aed7f58fb0 Pass Bitmap instead of SkBitmap in canvas.drawBitmap(Bitmap, float,float,Paint)
Test: refactoring cl.
bug:32216791

Change-Id: If9f9fbc19e683b14cce6c3c268258bd832d495d2
2016-10-20 09:50:49 -07:00
TreeHugger Robot
0154feef22 Merge "Initial refactoring to enable reuse of SkiaDisplayList on a per RenderNode basis. With Skia renderer we see 30% speed improvement in Invalidate Tree UI Jank test, when SkiaDisplayList objects are reused." 2016-10-19 20:36:00 +00:00
Stan Iliev
c0e7a90f1f Initial refactoring to enable reuse of SkiaDisplayList
on a per RenderNode basis. With Skia renderer we
see 30% speed improvement in Invalidate Tree UI Jank test,
when SkiaDisplayList objects are reused.

Test: manually built and run on angler-eng.
Change-Id: Ie4ec50ddb2015150e3ec678dde7ebed0c8d90067
2016-10-17 16:30:28 -04:00
Mike Reed
260ab72648 use SkBlendMode instead of SkXfermode
use sk_sp versions of paint setters/getters

Change-Id: I86591a0a8ec92e6039776cbf00424ea24f585b28
2016-10-13 17:14:52 -04:00
Chris Craik
97ec95c212 Prevent EndLayerOps when Begin was rejected am: 3c53ec51ef am: 152f76ee50
am: 674965822b

Change-Id: Icfa8cb2ad7c97fdbbf37f01abe7b5a22f6b33cfd
2016-08-09 00:20:12 +00:00
Chris Craik
3c53ec51ef Prevent EndLayerOps when Begin was rejected
bug:30537130

BeginLayerOps were being rejected in a way that allowed the associated
EndLayerOps to still be recorded. This was a violation of DisplayList
content expectations, and caused crashes in FrameBuilder when trying to
play these DisplayLists back.

Change-Id: I531b840aa5c4ffb1ee458da3f4b366978eaeafbe
2016-08-08 15:15:58 -07:00
Chris Craik
919645aded Reject fully transparent paint-fill ops at record time am: 814ee6a921
am: 1cfc4b1f46

Change-Id: I0d04b00ccf3d109ea5ab55ba52122fd4506147ea
2016-07-27 21:34:09 +00:00
Chris Craik
814ee6a921 Reject fully transparent paint-fill ops at record time
bug:30342762

Avoids unnecessary work for each transparent operation.

Change-Id: I80b1eeca34ae32249433fde55e9fe93d02c411db
2016-07-26 16:22:51 -07:00
Yuqian Li
afc221499d More efficient text rendering on path
Change-Id: I004c15473b527df0f296c54a6a3e9b29505fd9b9
2016-07-25 13:44:14 -04:00
Chris Craik
5e00c7ce06 Delete old rendering pipeline
fixes: 30002246

Change-Id: I45df0e924708526cee045b14c291bd23aa1a92db
2016-07-07 15:53:50 -07:00
Chris Craik
e4f6d968f5 Fix savelayer rounding
bug:29456451

Change-Id: I8022163d2c004510da5db74efdca27582484224d
2016-06-28 09:53:04 -07:00
Doris Liu
718cd3eb70 Handle hidden RT VectorDrawable animators
This CL changes the target of VD specific animators to VectorDrawable,
instead of RenderNode. The benefit of doing so is that animators can
now detect whether the animation is meaningful by checking whether
their VD target is in the display list. If not, that means the VD is
not drawing for the current frame, in which case we can be smarter
and more power efficient by removing the animator from the list and
posting a delayed onFinished listener callback.

By setting VD as the animation target, when an ImageView decides to
update its drawable from one AVD to something else, we'll be able
to detect that the previous AVD is no longer in the display list,
and stop providing animation pulse to the stale AVD, which is
something we couldn't do previously.  This change also
handles the case where one AVD instance could be drawn in two
different views.

Bug: 27441375
Change-Id: Iaad1ed09cfd526276b95db0dd695275c28e074e8
2016-06-09 10:27:59 -07:00
John Reck
cd1c3eba69 Add a callback for when a gl functor is released
Bug: 27709981

Change-Id: Id5be3e8f88d6d84a9c59c7ed23e7e8862feefbe8
2016-04-15 10:56:53 -07:00
Chris Craik
d645640180 Apply clip at reorder barriers to shadows
Fixes: 28004930

Change-Id: I208b78430c770a3135afd68c53cf8ff3fba50c52
2016-04-11 12:32:41 -07:00
Doris Liu
1d8e194661 Make AVD thread safe
This CL introduces staging properties to VectorDrawable, which holds
properties coming from UI thread. When staging properties are changed,
they are marked dirty, and the staging properties then get pushed to
RenderThread at sync point. In cases where no staging property has
been changed, at sync point we sync the render thread properties back
to staging properties to reflect the latest render thread animation
value change.

Also, update Vector Drawable bitmap only when it's dirty

Bug: 27343970
Bug: 27385912
Bug: 27263667
Bug: 27927674
Bug: 27774383

Change-Id: Ia864f5400a53a08dbfb284fae581fb1aac4fff87
2016-04-04 14:40:17 -07:00
Chris Craik
aafb01d8ad Consume TextureView matrix safely
Fixes: 27825042

TextureView's matrix may not be set at record time - delay using it
until on RenderThread, when deferring the op.

Change-Id: Icf8b55d656e304ec049ca803b042dc2359482db2
2016-03-28 10:12:37 -07:00
Chris Craik
a204848b1d Create first class unbounded ColorOp
bug:27810783

Previous drawColor->drawPaint conversion failed to preserve unbounded
nature of drawColor from old pipeline.

Change-Id: Ifd7a7b9d645f0887e252e48ca95d3195ee31615f
2016-03-25 15:13:23 -07:00
John Reck
417ed6d433 Fix missing first frame
Bug: 26776366
Change-Id: I46258c0ff35fdefe5c9f2ee610c904b2dbe8c5d9
2016-03-23 07:59:10 -07:00
sergeyv
dccca44ffd Reland: Move text logic from jni to hwui level
Initial CL: https://googleplex-android-review.git.corp.google.com/#/c/886854/

Change-Id: I9dfd85fe1d2a2c44f4360c8a29fd58d80e6f31c8
2016-03-21 15:55:46 -07:00
Sergei Vasilinetc
6847953955 Merge "Revert "Move text logic from jni to hwui level"" into nyc-dev 2016-03-21 21:06:47 +00:00
Sergei Vasilinetc
afbd0f1fef Revert "Move text logic from jni to hwui level"
This reverts commit a7f6bba1a3565c19715e878dfe7f0e01022944ff.

Change-Id: If4f36f87a85411b6128fd92d391313803ccaf9dd
2016-03-21 21:03:40 +00:00
Sergei Vasilinetc
49658d4380 Merge "Move text logic from jni to hwui level" into nyc-dev 2016-03-21 20:11:27 +00:00
Chris Craik
4c3980b6e4 Handle unbounded drawPaint/drawGLFunction operations safely
bug:26591194

Also, revert to using current clip bounds as drawColor/drawPaint bounds
for simplicity in new pipeline.

Change-Id: I1a6b3f9716b564b46df41d57dfe14475fdd24de0
2016-03-18 16:16:38 -07:00
sergeyv
a7f6bba1a3 Move text logic from jni to hwui level
bug:25865834
Change-Id: I2d8c9c9544afcb5ce1784f732aed3e54e0eda372
2016-03-17 09:48:57 -07:00
Chris Craik
2dbb4c46ee Unrounded round rects are just rects
Change-Id: I66517390943192e4725251b316a3d8c332c2b77d
2016-03-14 15:58:44 -07:00
Chris Craik
e83cca3a3a Merge "Fix node rejection crash" into nyc-dev 2016-03-10 23:45:20 +00:00
Chris Craik
1367d2550e Fix node rejection crash
bug:27598131
Change-Id: Iea05c22ec10f92beef9c47236929eb5f860d84f9
2016-03-10 15:43:13 -08:00
Chris Craik
223e3b6c2b Fix WebView disappearing
bug:27528563

Change-Id: Ib9fefa18ef9fb8eb11edd097cbadf8ab2b911576
2016-03-10 10:49:45 -08:00
Chris Craik
a154f47307 Improve handling of undefined-at-record-time bounds in new ops
bug:26591194
Change-Id: Ifc695d285d688903e2ef6aa3f0cb9e7ebf1f68d6
2016-03-03 14:16:31 -08:00
Chris Craik
261725fdb2 Fix matrix mapping of negative rects
bug:27381362

Also rejects ops with empty clip at record time, and short circuits clip
intersection, when one is empty.

Change-Id: I842612da14ad8fd9f1ba5e9e4fd027ba4e08d365
2016-02-29 13:10:25 -08:00
Chris Craik
388e43f419 Merge "Fix drawColor/drawPaint bounds" into nyc-dev 2016-02-23 23:33:53 +00:00
Chris Craik
339fc0a1d2 Merge "Add create_trivial_array" into nyc-dev 2016-02-22 21:40:58 +00:00
Chris Craik
caa2418473 Support drawing circles with drawArc in new pipeline
bug:26764636

Change-Id: I37d2384fa5e6c1074bb8de85821d58c15659b762
2016-02-19 16:12:53 -08:00
Chris Craik
7a89600bac Add create_trivial_array
Change-Id: I5e4236ff59fdaceb95105c5590f4deeda6d0b4c8
2016-02-19 15:51:02 -08:00
Chris Craik
1713c7773c Fix drawColor/drawPaint bounds
bug:26591194

Change-Id: Icda9b6e6cdd0c12a10e06469ace02b4a89df044b
2016-02-18 17:49:46 -08:00
John Reck
7df9ff2a08 Fix all LA memory leaks forever!
Bug: 27072626

Or at least fix this one and make it harder to leak
going forward. static_asserts are cool, use them liberally

Also makes allocation via LA (slightly) faster by fixing create*
variants to use rvalue references & std::forward, preventing
an accidental pass-by-value

Change-Id: I18fd696a93dd6ea49c8d8c587d4c8bee56dbfdf5
2016-02-11 00:42:23 +00:00
John Reck
e537330ead Revert "Fix all LA memory leaks forever!"
This reverts commit 499d83f21e7ffb687788bba1668b05fe38f6ebaf.

Change-Id: Ia893ae16ebbeae68e49cd13a20587104b73d39a0
2016-02-11 00:36:34 +00:00