101 Commits

Author SHA1 Message Date
Jorim Jaggi
072707dfad Use RenderThread for navigation bar ripples
Bug: 17506181
Change-Id: Icf3b80f8c4bc29fe85313381d4019dda3ef85ea9
2014-09-16 17:51:55 +00:00
Chris Craik
c3e75f9d54 Update transform isolation to handle command chunks
bug:15570351

Prevent drawing transformations on a ViewGroup's canvas from directly
affecting the transformation of the children through the renderer,
since it's already baked into mTransformFromParent at record time.

Change-Id: I6310a2260dfe4def0bde1fd2c5b93791a645d586
2014-08-27 15:43:42 -07:00
Chris Craik
8afd0f245c Create z reordering boundaries around dispatchDraw
bug:16012254

This means rendernodes with a Z will no longer be drawn at the end of
their parent's DisplayList, but at the end of the associated reorder
region (DisplayListData::Chunk).

Change-Id: Ia033fee9d9a4db567b2a8d5e90fc57a4d0a64544
2014-08-25 15:35:40 -07:00
Chris Craik
83f75c88a0 Merge "Early reject drawText calls that will not draw" into lmp-dev 2014-08-19 02:43:23 +00:00
Chris Craik
947eabf42d Early reject drawText calls that will not draw
bug:17114102

Prevents high contrast text from drawing invisible text.

Also fixes stroked text bounds calculation.

Change-Id: Iaeff51ead8b7b8ef2a1a0ca8b89598564e0d443f
2014-08-19 14:14:38 -07:00
Chris Craik
2262abbd16 Respect round rect clip when determining op opaqueness
bug:17115570
Change-Id: I30184b4678d333b5d222af8b61daa07a5e865cab
2014-08-18 19:55:36 -07:00
Chris Craik
7466986d20 Fix leak of SkPathRefs
bug:15939479

SkPath objects owned by DisplayListOps weren't being torn down, and
thus weren't releasing their SkPathRef innards.

Change-Id: I2581e124600a93a399ef3251f456c02ab52839a8
2014-08-08 00:52:54 +00:00
Chris Craik
796475006f Move bitmap transforms out of bitmap ops
bug:11359533

This allows us to deduplicate a lot between the two ops, and fixes the
shader coordinate space for the left,top argument drawBitmap to match
software.

Change-Id: I53da05af9ee74c74e9e70b4ab8053190ca220b16
2014-08-06 21:11:31 +00:00
Chris Craik
af4d04cab6 Use RoundRect clipping for circle reveal animation
bug:16630975

Also, remove inverse clipping feature from reveal animator.

Change-Id: I770a4eb48cd123b0ca0f39d16a0f3eefd1be3653
2014-07-30 17:15:50 +00:00
Chris Craik
98d608dba6 Minor cleanups around color usage
Change-Id: I56733cbe933a58d5977c032f056abb35265ee252
2014-07-17 12:25:11 -07:00
Mike Reed
1103b32559 SkBitmap::Config is deprecated, use SkColorType
Change-Id: Ic953741325607bf85598c097bb3ab648d4a08996
2014-07-08 15:05:38 -04:00
Chris Craik
59744b79ec Add hack for custom re-rasterization buckets
bug:14083128

Moves all of the font transform management into
OpenGLRenderer::findBestFontTransform(), and now simply passes down
final rasterization transforms into the FontRenderer.

Change-Id: Ie02752e6af863347b142367c7d628db5f9fc2998
2014-07-07 19:14:55 +00:00
John Reck
ca1b3b83bb Cleanup
Change-Id: I8a75e6e32a4cb02e3978503305b4cdce1727e89a
2014-06-27 19:25:16 +00:00
John Reck
3b20251a35 No-fail invokeFunctor
Bug: 15513308
 Bug: 15449247

Change-Id: I13a29f9c8d4975cdda6dcb33b6332c2555ff0f7c
2014-06-23 15:26:49 -07:00
Chris Craik
a7090e0cfd Update 'DisplayList' vs 'RenderNode' naming in several places
Change-Id: I635c6627d098b661fb9b0ba1bd42fa6d7277d287
2014-06-23 09:57:07 -07:00
Chris Craik
3281442aa7 Merge "Wrap ViewGroup content in save/restore to protect composited children" 2014-06-20 02:09:17 +00:00
Chris Craik
80d4902196 Wrap ViewGroup content in save/restore to protect composited children
bug:15570351

Pos Z composited children are drawn before the primary restore for a
RenderNode. This means that without an additional save/restore (which
wraps the content) they aren't protected from transformations/clips
that happen within the ViewGroup's DisplayList.

Also changes RenderNode to use OpenGLRenderer tag for displaylist
dumping consistency, and simplifies the entry points into RenderNode
drawing, since the distinction between tree root vs tree internal is
no longer important.

Change-Id: I2621eba0592c74d71f85a91a4ab3d0da2d7468d3
2014-06-20 16:18:58 -07:00
Chris Craik
6ac174b972 Clean up tessellation cache in prep for other tesselation types
bug:15536396

Also fixes compilation warning, avoids SkPaint deep copy

Change-Id: I74334f08b1d34c6789aabf968ff62db5bacbed1b
2014-06-18 15:31:55 -07:00
Chris Craik
1e5cf9aced am b1c76a1a: Merge "Tessellate on worker threads" into lmp-preview-dev
* commit 'b1c76a1abcfb2f33e12fef37ec71d20724863b5e':
  Tessellate on worker threads
2014-06-10 17:22:31 +00:00
Chris Craik
05f3d6e511 Tessellate on worker threads
Tessellate and cache (where possible) shadow and round rect
tessellation tasks.

Change-Id: I2cfda8e11d83d51ea74af871235cf26e8f831d40
2014-06-10 01:53:17 +00:00
John Reck
ce444ca400 Cleanup
Change-Id: Ie366390272724a2c1dfda99b0e85806b7a612744
2014-06-02 15:12:36 -07:00
Derek Sollenberger
139088228f Update HWUI matrix API
1. more closely mirror Skia API by using const ref instead of ptrs
2. store SkMatrix in the drawOp instead of the linear allocation heap

Change-Id: I4b9f6f76b9f7d19325e29303d27b793679fd4823
2014-05-29 16:51:23 -04:00
Leon Scroggins III
0fa2bd699a DO NOT MERGE Inspect SkShader to determine hw shader.
cherry-pick of Iaa7189178bda1c55f96da044d2a9fa602ba36034

Instead of duplicating internal info about SkShader, inspect the
SkShader installed on the SkPaint.

core/java/android/view/GLES20Canvas.java:
Remove setupModifiers, nResetModifiers, and nSetupShader.

core/jni/android/graphics/Shader.cpp:
Remove calls to create/destroy the (previously) attached SkiaShader.

core/jni/android_view_GLES20Canvas.cpp:
Remove native code for setupShader and resetModifiers.

graphics/java/android/graphics/BitmapShader.java:
graphics/java/android/graphics/ComposeShader.java:
graphics/java/android/graphics/LinearGradient.java:
graphics/java/android/graphics/RadialGradient.java:
graphics/java/android/graphics/Shader.java:
graphics/java/android/graphics/SweepGradient.java:
Remove code keeping track of native SkiaShader.

libs/hwui/Caches.h:
Include Extensions.h.

libs/hwui/DeferredDisplayList.cpp:
Compare shaders on the paint, instead of on DrawModifiers.

libs/hwui/DisplayList.cpp:
libs/hwui/DisplayList.h:
Remove vector of SkiaShaders.

libs/hwui/DisplayListOp.h:
Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

libs/hwui/DisplayListRenderer.cpp:
libs/hwui/DisplayListRenderer.h:
Remove resetShader, setupShader, refShader, and mShaderMap.

libs/hwui/FontRenderer.cpp:
Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

libs/hwui/OpenGLRenderer.cpp:
libs/hwui/OpenGLRenderer.h:
Add LayerShader, a class inheriting from SkShader, to mimic the
behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on
the SkPaint so it can be inspected later.
Set a LayerShader instead of a SkiaLayerShader.
setupDrawShader and setupDrawShaderUniforms now inspect an SkShader
passed in.
Inspect SkShader instead of mDrawModifiers.mShader.
Remove resetShader and setupShader.
setupDrawColorUniforms now takes a boolean indicating whether there is
a shader.
Add an inline function for accessing the SkShader on an SkPaint.
In setupDrawBlending(Layer*, bool), do not check the shader (which will
never be set), but do check whether the color filter may change the
alpha (newly fixed behavior).
In setupDrawBlending(SkPaint, ...), check the SkShader and whether the
color filter affects alpha (the latter is new behavior).

libs/hwui/Renderer.h:
Remove pure virtual functions setupShader and resetShader.

libs/hwui/ResourceCache.cpp:
libs/hwui/ResourceCache.h:
Remove functions for refing/unrefing shaders.

libs/hwui/SkiaShader.cpp:
libs/hwui/SkiaShader.h:
Much of this code was redundant and has been removed.
Convert structs into class with nothing but static functions for
calling describe/setupProgram.

libs/hwui/TextureCache.cpp:
libs/hwui/TextureCache.h:
Use the SkPixelRef as the key to the bitmap Lru cache, since shader
inspection will provide a different SkBitmap pointer (though it will
hold the correct SkPixelRef with the correct generation ID).

tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java:
tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java:
Update manual test to have more shaders: radial, sweep, compose,
invalid compose.

BUG:10650594
Change-Id: I2e7182b3fc28268e7ca82fac6780540b6b45365c
2014-05-23 11:50:38 -04:00
Chris Craik
d490aa4260 Merge "Inspect SkShader to determine hw shader." 2014-05-23 00:03:46 +00:00
Leon Scroggins III
d1ad5e62fd Inspect SkShader to determine hw shader.
Instead of duplicating internal info about SkShader, inspect the
SkShader installed on the SkPaint.

core/java/android/view/GLES20Canvas.java:
Remove setupModifiers, nResetModifiers, and nSetupShader.

core/jni/android/graphics/Shader.cpp:
Remove calls to create/destroy the (previously) attached SkiaShader.

core/jni/android_view_GLES20Canvas.cpp:
Remove native code for setupShader and resetModifiers.

graphics/java/android/graphics/BitmapShader.java:
graphics/java/android/graphics/ComposeShader.java:
graphics/java/android/graphics/LinearGradient.java:
graphics/java/android/graphics/RadialGradient.java:
graphics/java/android/graphics/Shader.java:
graphics/java/android/graphics/SweepGradient.java:
Remove code keeping track of native SkiaShader.

libs/hwui/Caches.h:
Include Extensions.h.

libs/hwui/DeferredDisplayList.cpp:
Compare shaders on the paint, instead of on DrawModifiers.

libs/hwui/DisplayList.cpp:
libs/hwui/DisplayList.h:
Remove vector of SkiaShaders.

libs/hwui/DisplayListOp.h:
Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

libs/hwui/DisplayListRenderer.cpp:
libs/hwui/DisplayListRenderer.h:
Remove resetShader, setupShader, refShader, and mShaderMap.

libs/hwui/FontRenderer.cpp:
Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

libs/hwui/OpenGLRenderer.cpp:
libs/hwui/OpenGLRenderer.h:
Add LayerShader, a class inheriting from SkShader, to mimic the
behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on
the SkPaint so it can be inspected later.
Set a LayerShader instead of a SkiaLayerShader.
setupDrawShader and setupDrawShaderUniforms now inspect an SkShader
passed in.
Inspect SkShader instead of mDrawModifiers.mShader.
Remove resetShader and setupShader.
setupDrawColorUniforms now takes a boolean indicating whether there is
a shader.
Add an inline function for accessing the SkShader on an SkPaint.
In setupDrawBlending(Layer*, bool), do not check the shader (which will
never be set), but do check whether the color filter may change the
alpha (newly fixed behavior).
In setupDrawBlending(SkPaint, ...), check the SkShader and whether the
color filter affects alpha (the latter is new behavior).

libs/hwui/Renderer.h:
Remove pure virtual functions setupShader and resetShader.

libs/hwui/ResourceCache.cpp:
libs/hwui/ResourceCache.h:
Remove functions for refing/unrefing shaders.

libs/hwui/SkiaShader.cpp:
libs/hwui/SkiaShader.h:
Much of this code was redundant and has been removed.
Convert structs into class with nothing but static functions for
calling describe/setupProgram.

libs/hwui/TextureCache.cpp:
libs/hwui/TextureCache.h:
Use the SkPixelRef as the key to the bitmap Lru cache, since shader
inspection will provide a different SkBitmap pointer (though it will
hold the correct SkPixelRef with the correct generation ID).

tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java:
tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java:
Update manual test to have more shaders: radial, sweep, compose,
invalid compose.

BUG:10650594

Change-Id: Iaa7189178bda1c55f96da044d2a9fa602ba36034
2014-05-22 14:46:59 -04:00
Chris Craik
61317325b7 Disable shadow drawing for empty/null outlines
Change-Id: I60d0f326cfab97d88c49d17cf32e619b5e60b94a
2014-05-21 13:04:10 -07:00
Derek Sollenberger
5b554f0103 Merge "Avoid caching shadow properties in Java & HWUI." 2014-05-08 14:41:47 +00:00
Derek Sollenberger
c29a0a4664 Avoid caching shadow properties in Java & HWUI.
bug: 10650594
Change-Id: I6f57df002710bb0567ed7e53fc0bfe96cfd504b8
2014-05-07 09:36:04 -04:00
John Reck
52244fff29 Add CanvasProperty for drawCircle
Change-Id: Icbcc030f5033d2094e567d7c519b9d672f2aac1c
2014-05-02 13:43:46 -07:00
Chris Craik
3f085429fd Clip TouchFeedbackDrawable effect to receiver Outline
Projected RenderNodes are now wrapped with a ClipRect or masked
SaveLayer, so that they are clipped to the outline of the projection
receiver surface.

Change-Id: I1d4afc1bb5d638d650bc0b1dac51a498f216773e
2014-04-23 16:15:11 -07:00
John Reck
860d155f86 Fix issue with bitmap uploading
Bug: 13912749

Change-Id: Ic23fa1d280118dc93dc2716a4a24cc0bbbdca595
2014-04-14 13:17:25 -07:00
John Reck
087bc0c14b Refcount RenderNode
Change-Id: I7a86db8acc2b78ef33d987a43a119f5933d7d752
2014-04-07 14:53:08 -07:00
Chris Craik
b265e2ca50 Support shadows on the root RenderNode
bug:13211941

Cleans up some of the RenderNode method naming

Also removes unnecessary clip/save/restores, clipping shadows
predictably, as drawn by the parent, before drawing (and clipping,
etc.) the shadow casting child.

Change-Id: I795115e1fb869bbbdd7be43e279b97490fecc7e0
2014-03-28 14:43:22 -07:00
Chris Craik
024433f896 Disable shadow overdraw avoidance in the inverse clip case
The caster is effectivly transparent, so skip the optimization just as
is done for alpha < 1.0

Change-Id: I3d294222adf0137e20c1fb5808313d487e92e0a8
2014-03-27 16:01:04 -07:00
Chris Craik
8c271ca63b Add private circular reveal API on View/RenderNode
Change-Id: I139c8e12b354083149a665f6768f3f6931a8dd15
2014-03-25 16:03:48 -07:00
John Reck
e18264b079 Rename DisplayList->RenderNode
Change-Id: Id42e23c9a1a6eb6eaeafef707ced7fa6887b03d0
2014-03-12 13:56:30 -07:00
Chris Craik
b79a3e301a Fix orthographic shadows projection, simplify shadow reordering
Separate matrix passed to shadow system into two parts, one for
transforming the polygon XY points (using the actual draw matrix) and
a separate one which respects correct 4x4 3d rotations and
translations for determining Z values.

Change-Id: I7e30a84774a8709df6b2241e8f51fc5583648fe8
2014-03-12 09:44:41 -07:00
Chris Craik
6786252405 Fix use of Skia deprecated methods
Change-Id: Ib89c20fc94bcce29b7490d6f55c73492735befda
2014-02-28 12:26:34 -08:00
Narayan Kamath
35eeb2d859 am 61910447: am 7942397b: am 19256340: am 22c66639: Merge "Fixes for 64bit in libhwui"
* commit '6191044729b2dace9c9b4b15b19a8839377d8973':
  Fixes for 64bit in libhwui
2014-02-21 16:58:28 +00:00
Kévin PETIT
73fc558e44 Fixes for 64bit in libhwui
Using reinterpret_cast allows conversions between pointer types
and integers which don't have the same size. The corresponding
flags is -Wint-to-pointer-cast.

Change-Id: I8ff0c79d235fa6d07b8d9305edc185d946d5133d
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-02-21 13:07:29 +00:00
Derek Sollenberger
76d3a1b8d0 Removing SkiaColorFilter and inspecting the native object directly.
bug: 10650594
Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
2014-02-07 17:06:14 -05:00
Derek Sollenberger
8852ab4357 Merge "Keep the SkPaint used when creating a layer." 2014-02-07 20:52:22 +00:00
Derek Sollenberger
d44fbe55a9 Keep the SkPaint used when creating a layer.
This will allow us to inspect the paint for thing other than
color and xfermode, such as SkColorFilters and SkShaders.

bug: 10650594
Change-Id: I2c3ddd07a3966e1e77af34136307e2b59b2898c1
2014-02-07 13:33:29 -05:00
Chris Craik
629f67709b Simplify DisplayList matrices
Somewhat unifies the ortho/perspecive paths - the property matrix
(translate/scale/rotate) is now always a Matrix4.

Change-Id: I36e4fe83d1150ee6e4be5f64f34d0fc8d6525cc6
2014-02-05 13:12:04 -08:00
Chris Craik
a2fe7affd3 Add initial hidden outline APIs
Background drawable outline usage and drawable outline calculation
still to come.

Change-Id: I8c7539f1638f86e1f8eb11f4fe49f705f61d58ba
2014-01-30 16:04:16 -08:00
Chris Craik
15a07a21eb Use path outlines to define shadow shapes
Fixes the simplifying assumption that shadow casters were always
rectangular.

Java side APIs + plumbing to pass down correct shapes still need to be added.

Change-Id: Ic4fee90af15679951a44bb5cc6ae454b98c4c194
2014-01-26 13:43:53 -08:00
Chris Craik
f533e94703 Support projection of DisplayLists onto ancestors.
For now, ancestor views signal the acceptance of projections with a
save(0x20)/restore pair.

During the order traversal, each view with the save(0x20) code will
collect descendent views with mProjectToContainedVolume (which still
needs to be renamed) so that they can be drawn out of order later.

- *Temporary* sample code added to HwAccelerationTest.

- Note that a projected displaylist must not be clipped.

Change-Id: I45c493e845961535b958d59c53e8aff3f8891d9f
2014-01-15 16:14:01 -08:00
Chris Craik
d218a92c0a Use const where possible for drawing parameters
They should never be modified by a Renderer, only read and copied.

Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
2014-01-03 13:55:08 -08:00
Chris Craik
f57776b2d1 3d view system!
True 3d transformations are now supported by DisplayLists and the
renderer, initially with the translationZ property on view.

Renderer operations used directly by DisplayList (formerly,
clip/save/restore/saveLayer) are now more simply managed by allocating
them temporarily on the handler's allocator, which exists for a single
frame. This is much simpler than continuing to expand the pool of
pre-allocated DisplayListOps now that more operations are called
directly by DisplayList, especially with z ordered drawing.

Still TODO:
-APIs for camera positioning, shadows
-Make Z apis public, and expose through XML
-Make invalidation / input 3d aware

Change-Id: I95fe6fa03f9b6ddd34a7e0c6ec8dd9fe47c6c6eb
2013-12-12 10:18:23 -08:00
Chris Craik
f0a590781b Clean up quick rejection, especially surrounding points + lines.
bug:4351353

quickReject and quickRejectNoScissor have been renamed and refactored:
- to make the scissor side effect clear and explicit
- dangerous methods no longer public
- to make the simple quick reject check logic const
- simple quick reject is now conservative

This CL also fixes several issues with line and point quickRejection -
sub-pixel and hairline lines are much less likely to be incorrectly
rejected, especially at small canvas scale.

Additionally, alpha modulation for AA points < 1px in size is now
correct, dumplicating SW behavior (similar to lines and stroked
shapes work).

Change-Id: Ibb0710c721b9fb415d05acf54dd3d2b4d602156a
2013-11-22 11:36:12 -08:00