618 Commits

Author SHA1 Message Date
Chris Craik
a8bea8edde Add tracing for saveLayer
bug:17702227

Change-Id: Ia9cbf31b360c93f712e021bea406cb63e4cc4c2a
2014-09-29 17:19:05 -07:00
Chris Craik
284b243584 Fix garbage showing up beneath dialogs
bug:17463894

Fixes the setViewport method to immediately affect the return values
of getViewportWidth/Height methods.

Also works around tiling extension issues observed on first frame
after window resize by disabling tiling for that frame.

Change-Id: Ie172d572d20d74a1be9cc58ad389af2cffa0e4b6
2014-09-18 16:05:35 -07:00
Chris Craik
025207b3cf Merge "Force isolation of clip and matrix within layer" into lmp-dev 2014-09-15 15:59:57 +00:00
Chris Craik
4ace730560 Force isolation of clip and matrix within layer
bug:17379260

Unclipped save layers need to isolate their clips and matrices
so that the save time readout of background content matches clip and
position with the restore/compose step.

Change-Id: I2de474cda76e960d080852f1716d6ddfa8a512d4
2014-09-14 15:49:54 -07:00
Chris Craik
4340c260c0 Snap outline clipping to integer coordinates correctly
bug:17403105
Change-Id: I65b5d7103aac58ba6feb4b021c276c67e9341716
2014-09-11 18:58:45 -07:00
Chris Craik
591be6c7af Update HWUI paint filter to understand new location of skia bitmap filter preference
bug:17455286
Change-Id: I3b0e04833f0c2699a1322fdd7e98c155841c0d93
2014-09-11 12:16:38 -07:00
John Reck
443a714fa7 Yet more layer tracking logging
Bug: 17208461

Change-Id: I55e7d0921eb565867e966d68b798b7b92c391b55
2014-09-04 17:40:05 -07:00
ztenghui
d5e8ade498 Ambient shadow tessellation improvement.
Using the vertices, instead of ray casting for the triangulation.

This request a dynamic index buffer associated with vertex buffer,
so we update the VertexBuffer to support it.

The ambient shadow could be 3x-6x times faster for circle and rect now.

b/16712006
b/14257173

Change-Id: I2f22a8fe19bc59acee5c18e4a3a395acd5042a66
2014-08-29 13:40:42 -07: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
69e5adffb1 Define shadow casting behavior within layers
bug:15860114

Savelayers and HW layers both now support shadow casting.

For save layers, the light source should always be correct, for HW
layers, the light source position is set when the layer is created,
and updated when it is resized.

Change-Id: Ie85567dd43c2bb0a0b08fd0bd4db41efa793ac2b
2014-08-15 00:59:44 +00:00
ztenghui
14a4e35208 Bring back the shadow strength tweak
bug:16712006

Change-Id: Ifc0ecca139d58140b45d7d227536a53069e1d480
2014-08-13 18:22:42 +00:00
Chris Craik
91a8c7c629 Switch to cos interpolation of shadow alpha
bug:16852257

Updates default shadow opacities to compensate.

Also, update variable/constant naming related to vertex alpha.

Change-Id: I9055b4ac3c9ac305ca9d515f21b52d6aa6dc9c5c
2014-08-12 16:00:09 -07:00
Chris Craik
bf75945e7a Rework shadow interpolation
bug:16852257

Use pow(alpha, 1.5) to avoid harsh edges on shadow alpha ramps.

Also adjusts shadow constants to compensate.

Change-Id: I5869956d7d292db2a8e496bc320084b6d64c3fb7
2014-08-12 12:44:59 -07:00
John Reck
a7c2ea20c4 Fix damage for layers for projection receivers
Bug: 16880228

Change-Id: I59ab760a21f49cc2cac0d8936b173cff292e6114
2014-08-08 20:24:34 +00:00
Chris Craik
74cf7e6a25 Cap scales used for tessellation with minimum and maximum
bug:15615144
Change-Id: I3e833864af3a7b34e444bd13db34b6c90496a8b6
2014-08-07 22:26:55 +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
a736cd9d35 Remove scaling bucket hack
bug:16626221

Fixes glyph cache pressure and double scaling artifacts.

Change-Id: I06cde720db646531b45943283cb4ecb48af8ff5b
2014-08-04 13:18:38 -07: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
62d307c240 Fix behavior of stencil clipping within clearLayerRegions
bug:16376960

The draw within clearLayerRegions should never be affected by the
current stencil clip, since it's just ensuring that the content of the
layer is cleared, and not doing real content drawing.

Also, add optional verbose GL event logging

Change-Id: I538b1bc631fc091340b76e12db6af0c219851b57
2014-07-29 17:42:22 +00:00
John Reck
15a807bb9c am 4afa4696: am c8f0e9b1: Fix ALL compile warnings
* commit '4afa469652dd6baa277b57cb584c08cccaf23c50':
  Fix ALL compile warnings
2014-07-24 23:35:38 +00:00
Chris Craik
19393ccd03 am 394e8703: am 2d3c6c93: Connect shadow style attributes to renderer
* commit '394e8703222d59f0de4da82afce423ada12c346f':
  Connect shadow style attributes to renderer
2014-07-24 23:32:14 +00:00
John Reck
1aa5d2d706 Fix ALL compile warnings
All warnings/errors fixed for GCC & Clang

Change-Id: I2ece3a136a5ae97a9acc3069537ed986238b5fd3
2014-07-24 14:28:08 -07:00
Chris Craik
058fc64001 Connect shadow style attributes to renderer
bug:15859361

Moves lighting info out of StatefulBaseRenderer, since it's not useful
at record time, and only used by OGLR.

Change-Id: I7ab065d02d9304afad1dc4c48597a7a621366f8e
2014-07-24 16:41:13 +00:00
Chris Craik
2923df5382 am 48242d80: am 50a2d633: Merge "[HWUI] Fix invisible views are still shown in popup window"
* commit '48242d801c8719f458a615b14b31760ae590006e':
  [HWUI] Fix invisible views are still shown in popup window
2014-07-22 19:15:43 +00:00
Chris Craik
50a2d6339c Merge "[HWUI] Fix invisible views are still shown in popup window" 2014-07-22 16:35:00 +00:00
Chris Craik
f3e85b5bac Merge "[HWUI]: fix residual line on FrameBuffer" into lmp-dev 2014-07-17 18:11:21 +00:00
henry.uh_chen
33f5a59ac3 [HWUI]: fix residual line on FrameBuffer
Symptom: If app applies animation to enlarge a bitmap, there will be an residual
         line on the screen

Root Cause: On platform which has Tile Rendering implementation (ex. Qualcomm
            CPU), startTiling() call will restrict the framebuffer region which
            GPU can affect. So the expansion of clear region by 1 will not take
            effect if startTiling region is not expanded.

Solution: Expand the startTiling region by 1, too.

Reproduce steps: Apply animation to enlarge (and then shrink) a bitmap icon.

Cherry-pick of 20adb6ce4d52b15472e7e5ee953e06cc349a827c from AOSP

Change-Id: I163b898b87b74d221dc4210b7fa657aa93c82c19
2014-07-17 21:50:01 +00:00
Chris Craik
98d608dba6 Minor cleanups around color usage
Change-Id: I56733cbe933a58d5977c032f056abb35265ee252
2014-07-17 12:25:11 -07:00
Chris Craik
0d5ac954a1 Fix translated VertexBuffer layer damage calculation
b/15986851

Change-Id: Id6be412e693c5233326164723a0a96e3802d9426
2014-07-15 13:01:02 -07:00
henry.uh_chen
3a1bffa835 [HWUI] Fix invisible views are still shown in popup window
Symptom: Invisible views are still shown in popup window

Root Cause: glClear isn't called if there is no draw command

Solution: Even if there is no draw command, it still calls glClear
          by startFrame().

Reproduce steps: App set one view in a popup window to invisible,
                 it will be still visible.

Change-Id: I36bc7b752434ad388fbb80ea63341ac778f48d35
2014-07-03 10:14:15 +00:00
henry.uh_chen
20adb6ce4d [HWUI]: fix residual line on FrameBuffer
Symptom: If app applies animation to enlarge a bitmap, there will be an residual
         line on the screen

Root Cause: On platform which has Tile Rendering implementation (ex. Qualcomm
            CPU), startTiling() call will restrict the framebuffer region which
            GPU can affect. So the expansion of clear region by 1 will not take
            effect if startTiling region is not expanded.

Solution: Expand the startTiling region by 1, too.

Reproduce steps: Apply animation to enlarge (and then shrink) a bitmap icon.

Change-Id: I7b4a59e180daa29dbe909d9e11f4093ae1d7396f
2014-07-03 09:58:31 +00: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
Chris Craik
f23b25abfb Remove isRecording() method from renderers
DisplayListRenderer is all that's accessed from java, and is entirely
separate from OpenGLRenderer now.

Change-Id: Ie733be71520c13fdb55dfe3522bb445ae2b50ac1
2014-06-27 17:49:52 -07: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
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
797b95b26b Define light position (using new lighting spec) in Java
Also updates the relative shadow strengths.

Change-Id: I6cac7275d38df98aea9f0dda463cd7207102986a
2014-05-21 13:50:29 -07:00
Chris Craik
f2985ba3f4 Merge "Correct viewport initialization, bounds comparison" 2014-05-19 21:54:03 +00:00
Chris Craik
deeda3d337 Round rect outline clipping
Change-Id: Iee9cf4f719f6f1917507b69189ad114fa365917b
2014-05-15 16:36:12 -07:00
Chris Craik
924197513a Correct viewport initialization, bounds comparison
Change-Id: Ibd751856e3712991e149800ed179464397dad7c3
2014-05-15 13:21:28 -07:00
Chris Craik
a64a2bef10 Combine projection matrix, and viewport management
Merge management of ortho projection matrix with the viewport size,
since they should always be changed together.

Change-Id: Iccb8f30828f4fb7848999ac54852e7ed2d6f2eb1
2014-05-14 17:27:52 -07:00