History log of /frameworks/base/libs/hwui/OpenGLRenderer.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c748832f759cd7a390a32890530e854b9711eb7c 17-Dec-2014 Chris Craik <ccraik@google.com> Merge "Revert overdraw avoidance visualization change" into lmp-mr1-dev
ef8d6f272ae451aaedb0f02249c0f9f0576efdf3 17-Dec-2014 Chris Craik <ccraik@google.com> Revert overdraw avoidance visualization change


Partial revert of 23d307c8d88f4a3849163b9e5b7cd11d0d4f372c.

Change-Id: Ic8b91b046707fc5b8fa53c35ea7b37bb19c3c943
eb2dcc791e649e07ec8114e00752b54965c46e65 11-Dec-2014 John Reck <jreck@google.com> Merge "Don't preload textures for AssetAtlas" into lmp-mr1-dev
ebd52610cfeff6e557fde284a7e1efc5e6438285 11-Dec-2014 John Reck <jreck@google.com> Don't preload textures for AssetAtlas

Bug: 18317479

RenderNode::prepareSubTree calls prefetchAndMarkInUse
on every bitmapResoruce in the DisplayList. However,
this resulted in textures being uploaded for bitmaps
that would be drawn from the AssetAtlas instead.

To fix this we teach TextureCache about the AssetAtlas
so that calls to TextureCache return the Texture from
AssetAtlas if it exists. Thus usage of AssetAtlas
is now purely to allow for further optimizations via
draw merging instead of a requirement to get
any benefit at all.

Change-Id: I65282fa05bac46f4e93822b3467ffa0261ccf200
4ac36f80beb958c77a92a3e1a235f6ed9daaa510 10-Dec-2014 Chris Craik <ccraik@google.com> Fix frame-allocated path lifecycles


Previously, we were allocating per-frame temporary paths within the
PlaybackStateStruct, but these are not safe as layers allocate these
transiently. Instead, move these to the OpenGLRenderer, which has
better define lifecycle.

Additionally, don't store SkPath objects directly in vector, since
they are then subject to relocation.

Change-Id: I8187ef542fcd5b030502bb75eb123ee26c0daa96
659de832b9796e14de44b6411980a65e33283a93 01-Dec-2014 Chris Craik <ccraik@google.com> Merge "Enable stencil clipping within clearLayerRegions" into lmp-mr1-dev
52b2cf9fdf95ccdcbb3f5e403eb9691c1ead1214 24-Nov-2014 Dohyun Lee <dohyun.lee@lge.com> Enable stencil clipping within clearLayerRegions


Cherry-pick of adc0d9da8648abfea1035fb1108eceea9fd9b5b1 from AOSP

Previously stencil clipping within clearLayerRegions is disabled by commit
62d307c2402777d5e53b4590af5f32f8c55afd81. However, clearing whole layer
regions causes black-colored triangle regions when a TextView has
RotateAnimation because the draw within clearLayerRegions does not
affected by the current stencil clip.

Change-Id: Id32a0b16754b109905f833e063ebfa156bd953f2
Signed-off-by: Dohyun Lee <dohyun.lee@lge.com>
70850ea258cbf91477efa57a1f1a23cc0044cc93 18-Nov-2014 Chris Craik <ccraik@google.com> Improve logging around performance critical events


Add details useful to developers (such as layer size/View name), and
switch away from logging implementation names/details, since they
are generally not relevant to developers.

Change-Id: Iee605d182f241450f7e75a6d0c283d51fa1312f5
0e89e2b7bcb2c035e8cee77f93120e7c5617f8d2 31-Oct-2014 John Reck <jreck@google.com> Layer changes

Bug: 17208461

* Switch Layer to be VirtualLightRefBase instead of
Caches' side-channel ref-counting
* Include active layers in gfxinfo dump
* Run gfxinfo dump on the correct thread
* Dump gfxinfo on Layer creation failure

Change-Id: I28d195699e2334518e215ab28c7a17355aee9678
23d307c8d88f4a3849163b9e5b7cd11d0d4f372c 27-Oct-2014 John Reck <jreck@google.com> Cleanup debug options

Bug: 18138852
Bug: 18065434
Change-Id: Ibb07b73b147c2a8b287fe8aee3f6624582f21b00
59e129fbc8a70d58d124ccc309661719f562b486 02-Oct-2014 Chris Craik <ccraik@google.com> Merge "Account for colorfilter transparency in determining paint opacity" into lmp-mr1-dev
c5b5f0556b542a22f01d254e6284f69e9eb23e74 02-Oct-2014 Chris Craik <ccraik@google.com> Account for colorfilter transparency in determining paint opacity

Change-Id: I90d76ee199bb357c71fc8f537c1abfa20d848416
a8bea8edde2f20cae48e5cc8de782679306b3cc3 24-Sep-2014 Chris Craik <ccraik@google.com> Add tracing for saveLayer


Change-Id: Ia9cbf31b360c93f712e021bea406cb63e4cc4c2a
284b24358410cb0200e525a5ba36994090c83f20 19-Sep-2014 Chris Craik <ccraik@google.com> Fix garbage showing up beneath dialogs


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
025207b3cfbb0bbbaa8c1b8f7e14941fc38160aa 15-Sep-2014 Chris Craik <ccraik@google.com> Merge "Force isolation of clip and matrix within layer" into lmp-dev
4ace7305608442ab35ea9aa65a4220df152c187f 15-Sep-2014 Chris Craik <ccraik@google.com> Force isolation of clip and matrix within layer


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
4340c260c002f0cf7bc41571673e57913b5df19f 12-Sep-2014 Chris Craik <ccraik@google.com> Snap outline clipping to integer coordinates correctly

Change-Id: I65b5d7103aac58ba6feb4b021c276c67e9341716
591be6c7af512a7dbae5a7f0cc9890b82af74e58 11-Sep-2014 Chris Craik <ccraik@google.com> Update HWUI paint filter to understand new location of skia bitmap filter preference

Change-Id: I3b0e04833f0c2699a1322fdd7e98c155841c0d93
443a714fa7c0dd07fee3527cc5bc3d3ca1fb7d44 05-Sep-2014 John Reck <jreck@google.com> Yet more layer tracking logging

Bug: 17208461

Change-Id: I55e7d0921eb565867e966d68b798b7b92c391b55
d5e8ade498b41b42874273cbfa375aed7b4d6a08 14-Aug-2014 ztenghui <ztenghui@google.com> 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.


Change-Id: I2f22a8fe19bc59acee5c18e4a3a395acd5042a66
947eabf42d835d0dfb0daa2fe6d869139c7000d6 19-Aug-2014 Chris Craik <ccraik@google.com> Early reject drawText calls that will not draw


Prevents high contrast text from drawing invisible text.

Also fixes stroked text bounds calculation.

Change-Id: Iaeff51ead8b7b8ef2a1a0ca8b89598564e0d443f
69e5adffb19135d51bde8e458f4907d7265f3e23 14-Aug-2014 Chris Craik <ccraik@google.com> Define shadow casting behavior within layers


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
14a4e35208b7e97bbfa38f36130827c86bfafc2b 13-Aug-2014 ztenghui <ztenghui@google.com> Bring back the shadow strength tweak


Change-Id: Ifc0ecca139d58140b45d7d227536a53069e1d480
91a8c7c62913c2597e3bf5a6d59d2ed5fc7ba4e0 12-Aug-2014 Chris Craik <ccraik@google.com> Switch to cos interpolation of shadow alpha


Updates default shadow opacities to compensate.

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

Change-Id: I9055b4ac3c9ac305ca9d515f21b52d6aa6dc9c5c
bf75945e7a1ae7c1000682716643c942c1e19ba6 12-Aug-2014 Chris Craik <ccraik@google.com> Rework shadow interpolation


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

Also adjusts shadow constants to compensate.

Change-Id: I5869956d7d292db2a8e496bc320084b6d64c3fb7
a7c2ea20c43ab797bef5801530687e22e83def8f 08-Aug-2014 John Reck <jreck@google.com> Fix damage for layers for projection receivers

Bug: 16880228

Change-Id: I59ab760a21f49cc2cac0d8936b173cff292e6114
74cf7e6a25c6d7b331c231b7bc2512044f9d2950 07-Aug-2014 Chris Craik <ccraik@google.com> Cap scales used for tessellation with minimum and maximum

Change-Id: I3e833864af3a7b34e444bd13db34b6c90496a8b6
796475006f5d670e8383a2050f11719522437a43 06-Aug-2014 Chris Craik <ccraik@google.com> Move bitmap transforms out of bitmap ops


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

Change-Id: I53da05af9ee74c74e9e70b4ab8053190ca220b16
a736cd9d3587a120e5233d627cd8bf06353be107 04-Aug-2014 Chris Craik <ccraik@google.com> Remove scaling bucket hack


Fixes glyph cache pressure and double scaling artifacts.

Change-Id: I06cde720db646531b45943283cb4ecb48af8ff5b
af4d04cab6d48ae0d6a5e79bd30f679af87abaad 29-Jul-2014 Chris Craik <ccraik@google.com> Use RoundRect clipping for circle reveal animation


Also, remove inverse clipping feature from reveal animator.

Change-Id: I770a4eb48cd123b0ca0f39d16a0f3eefd1be3653
62d307c2402777d5e53b4590af5f32f8c55afd81 29-Jul-2014 Chris Craik <ccraik@google.com> Fix behavior of stencil clipping within clearLayerRegions


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
15a807bb9c98455a175f42389bdc59f46c0bc195 25-Jul-2014 John Reck <jreck@google.com> am 4afa4696: am c8f0e9b1: Fix ALL compile warnings

* commit '4afa469652dd6baa277b57cb584c08cccaf23c50':
Fix ALL compile warnings
19393ccd037af058184097f92fa84263ae242898 25-Jul-2014 Chris Craik <ccraik@google.com> am 394e8703: am 2d3c6c93: Connect shadow style attributes to renderer

* commit '394e8703222d59f0de4da82afce423ada12c346f':
Connect shadow style attributes to renderer
1aa5d2d7068147ff781cfe911a93f01593a68c79 24-Jul-2014 John Reck <jreck@google.com> Fix ALL compile warnings

All warnings/errors fixed for GCC & Clang

Change-Id: I2ece3a136a5ae97a9acc3069537ed986238b5fd3
058fc640017c90120c599d378a4cbc55668b05b7 24-Jul-2014 Chris Craik <ccraik@google.com> Connect shadow style attributes to renderer


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

Change-Id: I7ab065d02d9304afad1dc4c48597a7a621366f8e
2923df53825ded6fae4ce2af8bf65690db244394 22-Jul-2014 Chris Craik <ccraik@android.com> 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
50a2d6339c7a6ee121c4aa52afc4cc027913f3fc 22-Jul-2014 Chris Craik <ccraik@android.com> Merge "[HWUI] Fix invisible views are still shown in popup window"
f3e85b5bac693780c75935f0d27acf536458702d 18-Jul-2014 Chris Craik <ccraik@google.com> Merge "[HWUI]: fix residual line on FrameBuffer" into lmp-dev
33f5a59ac3e304970920dda824958870f85f76ef 02-Jul-2014 henry.uh_chen <henry.uh_chen@htc.com> [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
98d608dba6a0b3c15fb08f1fa2c8b9d170124c7c 17-Jul-2014 Chris Craik <ccraik@google.com> Minor cleanups around color usage

Change-Id: I56733cbe933a58d5977c032f056abb35265ee252
0d5ac954a111d19270d6e618ee051a8d6419e1a5 15-Jul-2014 Chris Craik <ccraik@google.com> Fix translated VertexBuffer layer damage calculation


Change-Id: Id6be412e693c5233326164723a0a96e3802d9426
3a1bffa835f279628e50385af3c85789bc737f64 03-Jul-2014 henry.uh_chen <henry.uh_chen@htc.com> [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
20adb6ce4d52b15472e7e5ee953e06cc349a827c 02-Jul-2014 henry.uh_chen <henry.uh_chen@htc.com> [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
1103b3255945d2eb2fa9c191e84e2270b343cca9 08-Jul-2014 Mike Reed <reed@google.com> SkBitmap::Config is deprecated, use SkColorType

Change-Id: Ic953741325607bf85598c097bb3ab648d4a08996
59744b79ec302000802cd56d30a1bf70f0183c80 02-Jul-2014 Chris Craik <ccraik@google.com> Add hack for custom re-rasterization buckets


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

Change-Id: Ie02752e6af863347b142367c7d628db5f9fc2998
f23b25abfb76e75f63103abc882bc91b8327a957 27-Jun-2014 Chris Craik <ccraik@google.com> Remove isRecording() method from renderers

DisplayListRenderer is all that's accessed from java, and is entirely
separate from OpenGLRenderer now.

Change-Id: Ie733be71520c13fdb55dfe3522bb445ae2b50ac1
3b20251a355c88193c439f928a84ae69483fb488 23-Jun-2014 John Reck <jreck@google.com> No-fail invokeFunctor

Bug: 15513308
Bug: 15449247

Change-Id: I13a29f9c8d4975cdda6dcb33b6332c2555ff0f7c
a7090e0cfd7c719a6d4c03aae34f5db98754cbdd 21-Jun-2014 Chris Craik <ccraik@google.com> Update 'DisplayList' vs 'RenderNode' naming in several places

Change-Id: I635c6627d098b661fb9b0ba1bd42fa6d7277d287
3281442aa75872b8947f0b0a5203257c6849129d 21-Jun-2014 Chris Craik <ccraik@google.com> Merge "Wrap ViewGroup content in save/restore to protect composited children"
80d4902196899d1325cd9f52c06ae0174cf9bd4c 21-Jun-2014 Chris Craik <ccraik@google.com> Wrap ViewGroup content in save/restore to protect composited children


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
6ac174b97246ed40fe780b29561603b61770fa17 17-Jun-2014 Chris Craik <ccraik@google.com> Clean up tessellation cache in prep for other tesselation types


Also fixes compilation warning, avoids SkPaint deep copy

Change-Id: I74334f08b1d34c6789aabf968ff62db5bacbed1b
1e5cf9aced40e6e14262e542d0ed0e24cda877a0 10-Jun-2014 Chris Craik <ccraik@google.com> am b1c76a1a: Merge "Tessellate on worker threads" into lmp-preview-dev

* commit 'b1c76a1abcfb2f33e12fef37ec71d20724863b5e':
Tessellate on worker threads
05f3d6e5111fd08df5cd9aae2c3d28399dc0e7f5 03-Jun-2014 Chris Craik <ccraik@google.com> Tessellate on worker threads

Tessellate and cache (where possible) shadow and round rect
tessellation tasks.

Change-Id: I2cfda8e11d83d51ea74af871235cf26e8f831d40
139088228faa7f3c446af7387e017933998a5570 10-Dec-2013 Derek Sollenberger <djsollen@google.com> 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
0fa2bd699ab5539c0ce6b79eb6b4b681734b8bb5 05-May-2014 Leon Scroggins III <scroggo@google.com> 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.

Remove setupModifiers, nResetModifiers, and nSetupShader.

Remove calls to create/destroy the (previously) attached SkiaShader.

Remove native code for setupShader and resetModifiers.

Remove code keeping track of native SkiaShader.

Include Extensions.h.

Compare shaders on the paint, instead of on DrawModifiers.

Remove vector of SkiaShaders.

Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

Remove resetShader, setupShader, refShader, and mShaderMap.

Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

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).

Remove pure virtual functions setupShader and resetShader.

Remove functions for refing/unrefing shaders.

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

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).

Update manual test to have more shaders: radial, sweep, compose,
invalid compose.

Change-Id: I2e7182b3fc28268e7ca82fac6780540b6b45365c
d490aa426090fc358873821b47ef27ead0c97409 23-May-2014 Chris Craik <ccraik@google.com> Merge "Inspect SkShader to determine hw shader."
d1ad5e62fda248c6d185cde3cb6d9f01a223066c 05-May-2014 Leon Scroggins III <scroggo@google.com> Inspect SkShader to determine hw shader.

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

Remove setupModifiers, nResetModifiers, and nSetupShader.

Remove calls to create/destroy the (previously) attached SkiaShader.

Remove native code for setupShader and resetModifiers.

Remove code keeping track of native SkiaShader.

Include Extensions.h.

Compare shaders on the paint, instead of on DrawModifiers.

Remove vector of SkiaShaders.

Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.

Remove resetShader, setupShader, refShader, and mShaderMap.

Pass SkShader to setupDrawShader and setupDrawShaderUniforms.

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).

Remove pure virtual functions setupShader and resetShader.

Remove functions for refing/unrefing shaders.

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

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).

Update manual test to have more shaders: radial, sweep, compose,
invalid compose.


Change-Id: Iaa7189178bda1c55f96da044d2a9fa602ba36034
797b95b26bbb7557678af78b9a2a61830158920f 21-May-2014 Chris Craik <ccraik@google.com> Define light position (using new lighting spec) in Java

Also updates the relative shadow strengths.

Change-Id: I6cac7275d38df98aea9f0dda463cd7207102986a
f2985ba3f41c4619f7b64797d07e3a008e17b20a 19-May-2014 Chris Craik <ccraik@google.com> Merge "Correct viewport initialization, bounds comparison"
deeda3d337aed1eee218b89a7aba5992ced371f0 06-May-2014 Chris Craik <ccraik@google.com> Round rect outline clipping

Change-Id: Iee9cf4f719f6f1917507b69189ad114fa365917b
924197513aa2df4c1fb2977c1727f5d2c21f2689 15-May-2014 Chris Craik <ccraik@google.com> Correct viewport initialization, bounds comparison

Change-Id: Ibd751856e3712991e149800ed179464397dad7c3
a64a2bef1048db5a742843f1e3bea9e80d0defc5 14-May-2014 Chris Craik <ccraik@google.com> 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
ddc52285ca6fd147f442a21e90e0e4702a10d304 11-May-2014 Jorim Jaggi <jjaggi@google.com> Revert "Simplify projection matrix management."

This reverts commit 0efaa71d5414287ed4beac0a88cf76f7e33a1e74.
0c0ec26366045e515790a6acdab782965efc63b4 10-May-2014 Chris Craik <ccraik@google.com> Simplify projection matrix management.

Store in and use from snapshot, and remove the kFlagOrthoDirty flag,
as it's redundant with kFlagIsFboLayer.

Change-Id: I2bd380192d50117f4ce1fd2058213669a886f406
e1f788b3e216329c570929eb4526332ae0db14d1 09-May-2014 Chris Craik <ccraik@google.com> Merge "Rename matrices for consistency"
e10e827ed68b0a9487cf8dd1fc545f9a09517ae9 08-May-2014 Chris Craik <ccraik@google.com> Rename matrices for consistency

The projection matrix no longer contains viewing transformation, and
has thus been renamed.

Change-Id: I4f85ccdac97f4cb4f987bb05c389816680f1c94f
e4aa95e3627226bcb0d8cc3e42dca6e4df8f421c 08-May-2014 Chris Craik <ccraik@google.com> Add logging utility methods

Change-Id: I0f316830dcc0bbf438292a6d0fbe9f8154368500
5b554f010358d8f47e31d92a42aa3edc4a71ec47 08-May-2014 Derek Sollenberger <djsollen@google.com> Merge "Avoid caching shadow properties in Java & HWUI."
832b151465ed81c43e59891d5eebe62128b21fbb 07-May-2014 John Reck <jreck@google.com> Cleanup attachFunctor

Bug: 13961296

Change-Id: Id48d11bfcc234afd1fd7e4fdd409a50e7208c81d
c29a0a4664a4b9871fadd668b632469a0db240b9 31-Mar-2014 Derek Sollenberger <djsollen@google.com> Avoid caching shadow properties in Java & HWUI.

bug: 10650594
Change-Id: I6f57df002710bb0567ed7e53fc0bfe96cfd504b8
64ab917e5eb3269c72c795781a512d4ee7d9d7a4 01-May-2014 Chris Craik <ccraik@google.com> Merge "Add more shadow control knobs"
f5be3ca5cc5b3a10747b577f60059a99862bb9a8 01-May-2014 Chris Craik <ccraik@google.com> Add more shadow control knobs

Change-Id: I1ff500bf429029a97b681ced9df652f4ee9f1332
0d575b084fe5a691c2a99163515de0dc54f66e18 29-Apr-2014 ztenghui <ztenghui@google.com> Merge "Make sure the theta is correctly represented and incoming polygon is CW for shadow."
2e023f3827dfc0dfc1ed7c3dd54d02b4a993f0b4 29-Apr-2014 ztenghui <ztenghui@google.com> Make sure the theta is correctly represented and incoming polygon is CW for shadow.

Now the theta = 0 should be on +x axis.
And cos(theta) should correctly represent x value.
Without this fix, the poly theta (from atan2) can be wrongly rotated 90 degrees.

Also, make sure the incoming polygon is CW for the shadow system.
This fix visual artifacts in recent regression for spot shadows.


Change-Id: I9bbf54db094e7f133326da4dae4610962da849c1
3f085429fd47ebd32ac2463b3eae2a5a6c17be25 16-Apr-2014 Chris Craik <ccraik@google.com> 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
8de65a8e05285df52a1e6f0c1d5616dd233298a7 10-Apr-2014 John Reck <jreck@google.com> Switch DisplayListData to a staging model

Bug: 13912977

Change-Id: I5b2f664e797be22a58300964f57ceb4fab60528c
087bc0c14bdccf7c258dce0cdef46a69a839b427 05-Apr-2014 John Reck <jreck@google.com> Refcount RenderNode

Change-Id: I7a86db8acc2b78ef33d987a43a119f5933d7d752
c75db8266b352ef3a7a6b76654f770d7a24d547a 29-Mar-2014 John Reck <jreck@google.com> Merge "Remove kStatusInvoke & kStatusDraw"
750ca6dbdb259aea0ca5b77380a9303e586ef3ea 29-Mar-2014 John Reck <jreck@google.com> Remove kStatusInvoke & kStatusDraw

They are unused

Change-Id: I44ecf1164dc6bc1b09438e733976d5a97a25f00e
b265e2ca50b6ceb2fd2987ef1f7d063b1bde19ae 27-Mar-2014 Chris Craik <ccraik@google.com> Support shadows on the root RenderNode


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
024433f89684e1f9cb7b15ade7c480c9346fbe4d 26-Mar-2014 Chris Craik <ccraik@google.com> 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
8c271ca63b62061fd22cfee78fd6a574b44476fd 25-Mar-2014 Chris Craik <ccraik@google.com> Add private circular reveal API on View/RenderNode

Change-Id: I139c8e12b354083149a665f6768f3f6931a8dd15
bfb07a03777af424e99bca1dac4c903aaf44e99d 25-Mar-2014 John Reck <jreck@google.com> Move where updateProperties is called

Change-Id: I27da448996019094c44487ce28c5689d098d6535
d0a0b2a3140bfb1819a116413ce9d81886697a07 21-Mar-2014 John Reck <jreck@google.com> Add stagingProperties

Change-Id: Ic7de551f8843fd70a77f738e33028e25c020bb3c
af6f7ed8dd4288a41d0a07a1f0f0be7d6d035b33 19-Mar-2014 ztenghui <ztenghui@google.com> Early rejection on shadows which are outside of the clip bound.

All the computations are estimated using bounding box.
TODO: Spot shadow could have more accurate but also more expensive methods, we need
more experiments to decide.

Change-Id: I9c10c419576cee55daf0f9f278b0db78cb847447
50ecf849cb7ccc3482517b74d2214b347927791e 12-Mar-2014 ztenghui <ztenghui@google.com> Create one hole inside the umbra area to avoid overdraw.


Change-Id: I859575196bd5a3029f447883025a6ec3a1f1face
361fd3d2ff302d60a49ae2d2d1cc61cb5fdb0ece 12-Mar-2014 John Reck <jreck@google.com> Merge "Rename DisplayList->RenderNode"
e18264b079481a244b30e3f71012c53bbd861f92 12-Mar-2014 John Reck <jreck@google.com> Rename DisplayList->RenderNode

Change-Id: Id42e23c9a1a6eb6eaeafef707ced7fa6887b03d0
b98f2116f5896acb4b221015b22624a3c5d5a7fe 12-Mar-2014 Chris Craik <ccraik@google.com> Force shadow casters above the Z=0 plane

Change-Id: Ifee75414829d4bfb3c7aa6219f1f9bcfd50ff0c6
b79a3e301a8d89b9e1b1f6f3d7fd6aa56610a6f0 11-Mar-2014 Chris Craik <ccraik@google.com> 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
e361ad7ab15fcf4919a56a6293689d968ee8dcff 11-Mar-2014 Chris Craik <ccraik@google.com> Remove experimental perspective projection

Change-Id: Iad688c8395ccd4673cc129973802b5f01dfb45ba
67862524056ee2e73a94395139bb8bd0ec1ef38a 28-Feb-2014 Chris Craik <ccraik@google.com> Fix use of Skia deprecated methods

Change-Id: Ib89c20fc94bcce29b7490d6f55c73492735befda
da3f525759d4b875fd6a498cbe22f7bc9e53aa83 27-Feb-2014 Chris Craik <ccraik@google.com> Merge "Fix TextureView texture filtering."
9757ac0b9d62f6aea5e47cfb375f445c78bb7897 26-Feb-2014 Chris Craik <ccraik@google.com> Fix TextureView texture filtering.


TextureView should always be drawn with linear filtering if drawing a
buffer sized differently from the layer.

This fixes a bug where TextureViews that were sized differently from
their contents wouldn't be drawn with texture filtering, causing
visible scaling artifacts.

Change-Id: I8a5d27452fe7269ec53896992f37cff51e3ce15a
8198c3a8f525c07e2b848852f6ad3e351e3b5461 26-Feb-2014 ztenghui <ztenghui@google.com> Merge "Use pre-computed index to draw the shadow."
63d41abb40b3ce40d8b9bccb1cf186e8158a3687 14-Feb-2014 ztenghui <ztenghui@google.com> Use pre-computed index to draw the shadow.

Also draw the umbra part as triangle fans instead of zig zag fashion.


Change-Id: Iaa5d15e77351acdd71f076bd8f9bb2d4d2b92faf
919e95cc23d3567345719f2466e089682608638e 22-Feb-2014 Chris Craik <ccraik@google.com> Modulate shadow alpha by caster alpha

Change-Id: Ibc4b3958feb3b5dba91d30af470d76555a6209c8
674554fc36932ca50b15bba41ac6f650254d4e72 19-Feb-2014 Derek Sollenberger <djsollen@google.com> Reapply "Refactor setting an SkPaint onto a hwui Layer."

This reverts commit 90d0c75e94a32fb7d993fae69762820aabc2fcbb.

Change-Id: Ie807761231edf7c848b019931dccbf466208c0be
ef94c6f88fbb1deb095b1494378befcdb9722839 14-Feb-2014 ztenghui <ztenghui@google.com> Separate spot and ambient shadow strength setting

Change-Id: I4530e618b09a7f44b5382f8a40646c0ebf5f214c
76d3a1b8d035d27bc80b0f2fc480a903bd001514 10-Dec-2013 Derek Sollenberger <djsollen@google.com> Removing SkiaColorFilter and inspecting the native object directly.

bug: 10650594
Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
d44fbe55a9f434cb5bb0e34c143ba1445141990d 05-Feb-2014 Derek Sollenberger <djsollen@google.com> 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
a2fe7affd3d077ac163da90996cb2e5e0ca3b8d1 29-Jan-2014 Chris Craik <ccraik@google.com> Add initial hidden outline APIs

Background drawable outline usage and drawable outline calculation
still to come.

Change-Id: I8c7539f1638f86e1f8eb11f4fe49f705f61d58ba
5e1814e2ebf5614f8f4f7edd063e1a79bd929844 29-Jan-2014 Chris Craik <ccraik@google.com> Merge "Remove logging of DisplayList staleness"
3783e70b557fe58f51d551242a42e7232e991c10 27-Jan-2014 Chris Craik <ccraik@google.com> Remove logging of DisplayList staleness

Change-Id: Ie6b3af3065d4d10ec0bc9b419223d3458d297ea8
15a07a21eb33e8ca1c7444944fe0541a53380c0c 26-Jan-2014 Chris Craik <ccraik@google.com> Use path outlines to define shadow shapes

Fixes the simplifying assumption that shadow casters were always

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

Change-Id: Ic4fee90af15679951a44bb5cc6ae454b98c4c194
bb615a6ffbc8a051007163916f1ed085d10b5327 24-Jan-2014 Chris Craik <ccraik@google.com> Clear root level reorder lists to prevent accessing stale DisplayLists


Adds temporary logging which should log/crash earlier on incorrectly
reordering hierarchies.

Change-Id: Iee00940718c3cc868161e754aff93cd3b2747094
cc3c25622c731d14a6f01bce684330eccba7db5a 17-Jan-2014 ztenghui <ztenghui@google.com> Property support for light positioning.

Tune up the light size to make it look better.

Change-Id: I139a05f3dd53dacbe55759b91188f0e1cc2c7f80
3197cded4e265bc99dc82d695bbb7163fe134ed4 16-Jan-2014 Chris Craik <ccraik@google.com> Map shadow light position globally

Change-Id: Ic3201cecdf5d2a1dd628e7e40aee912ef516d3b2
7b4516e7ea552ad08d6e7277d311ef11bd8f12e8 07-Jan-2014 ztenghui <ztenghui@google.com> Calculate and show the shadow from a spot light.

Change-Id: Ia558852e8cde5d33866b22875eb501e4c6858819
d218a92c0afb8c0d98135b20b52ac87236e1c935 03-Jan-2014 Chris Craik <ccraik@google.com> Use const where possible for drawing parameters

They should never be modified by a Renderer, only read and copied.

Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
564acf7c9bff822f608cda0d5df0a64a9f9aaefd 03-Jan-2014 Chris Craik <ccraik@google.com> Fix Clang warnings/errors

Fix several build warnings (struct != class, int != size_t) and errors
(variable leng non-POD arrays).

Change-Id: I70b4e784365514303d8954bfcb1f39d7c22c1321
d6b65f67717025b1162f86f04e2caa5723566cac 01-Jan-2014 Chris Craik <ccraik@google.com> Use const access to snapshot from OpenGLRenderer

Additionally, move clipping methods to StatefulBaseRenderer

Change-Id: Iff232bf16fc1ad3b7d89493da6d8915db7bc5e4f
14e513058ed4168c94e015638d16f5f87fd8063a 31-Dec-2013 Chris Craik <ccraik@google.com> Move Snapshot management to intermediate StatefulBaseRenderer class

The eventual goal is for the StatefulBaseRenderer to serve as the
common base class between the DisplayListRenderer and OpenGLRenderer.

This will separate DisplayList recording, Snapshot stack management,
and the GL in OpenGLRenderer.

Additionally, avoid sp<> parameters, and use const parameters in
several places, with the intent of greatly reducing the surface area
where renderer subclasses can modify snapshot stack.

Next steps:
-move bulk of clipping logic into StatefulBaseRenderer
-disable direct snapshot access

Change-Id: Ibc3c6747134ec7daf8ea535866239fa73b874390
b458942bb6e6cf13c68341dda35ef5cee060f5ae 27-Dec-2013 Chris Craik <ccraik@google.com> Create abstract base class for OpenGLRenderer

This will eventually serve as a base class to allow
DisplayListRenderer to split off from OpenGLRenderer, and could
eventually support other rendering approaches, such as an

This will also be the main source of (implementation-independent)
documentation of the canvas/renderer methods.

Change-Id: I52047f338f5cf86a3b0b3002af7154bff5c3c227
ba9b613437c34873fa95800a25fc51720638267c 16-Dec-2013 Chris Craik <ccraik@google.com> Create private properties on GLCanvas for experimentation with 3d

Change-Id: I17772f61efce727cb4c1111f4d97f58c741786b8
55bfb4e728fe1db619af5d2c287f4abe711b3343 03-Dec-2013 ztenghui <ztenghui@google.com> Calculate and show Ambient shadow.

Basically we compute the shadow as a strip of triangles, whose alpha value
is the strength of the shadow.
We use the normal to extend the geometry.
And we use static function and try to avoid new/malloc in the computation.

Change-Id: I382286f1cad351bd5ff983f76f446c075819dcaf
18809c063b89d9b235401d080b952885a4ef9628 13-Dec-2013 Chris Craik <ccraik@google.com> Merge "3d view system!"
f57776b2d195f0937906eb88b777bb55ccc36967 26-Oct-2013 Chris Craik <ccraik@google.com> 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
630491973269da1b260e69d6a3f9490b97705037 11-Dec-2013 John Reck <jreck@google.com> Unbreak display list debug dumping

Change-Id: I1c6a79f047b29fa60907f6e128cb843a45b88bff
4b9a19a8f865970e0079f431c8c2c2a8e4333ae9 03-Dec-2013 Leon Scroggins III <scroggo@google.com> Call SkBitmap::config() instead of ::getConfig()

getConfig() has been deprecated.

Change-Id: I32066256ab82ac4760c752c80856d1b56d291fae
f0a590781b2c3e34132b2011d3956135add73ae0 20-Nov-2013 Chris Craik <ccraik@google.com> Clean up quick rejection, especially surrounding points + lines.


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
dbccd44a638ae8705a5b14bff8b2dd74abc26045 22-Nov-2013 The Android Open Source Project <initial-contribution@android.com> Merge commit 'b873a17ce7be0a9771c24999adca6964431728f6' into HEAD

Change-Id: I938755073e70602cc8f51ce9bd420fdcf870cecd
4063a0e03ba2e354cc6d19c0ffc073fd5b8aa2ca 16-Nov-2013 Chris Craik <ccraik@google.com> Clean up modelView matrix logic


Also changes shader matrix to correctly account for modelView and

Change-Id: I6ce18857dc6d08ea08ca7535385c2ad351ec3caa
16e7d730c5fc974d5652a4a7a6e19a163225315a 07-Nov-2013 Chris Craik <ccraik@android.com> am 2f70da2b: am 6ed16a89: am 0b807d2e: Merge "Update the layer\'s alpha value upon composition of the layer"

* commit '2f70da2bc5ce9f4766395cc9d848f0afe8f6a2a9':
Update the layer's alpha value upon composition of the layer
2f70da2bc5ce9f4766395cc9d848f0afe8f6a2a9 07-Nov-2013 Chris Craik <ccraik@android.com> am 6ed16a89: am 0b807d2e: Merge "Update the layer\'s alpha value upon composition of the layer"

* commit '6ed16a89d836a33b9242f91b05e8ecb149abf909':
Update the layer's alpha value upon composition of the layer
a5ff739d3c9e15d07f1d5c644b4f11205cdac0e8 04-Nov-2013 Digish Pandya <digishp@codeaurora.org> Update the layer's alpha value upon composition of the layer

Fixes: This patch makes sure that the layer's alpha value is
up-to-date and does not reflect the previous view's alpha value.
it fixes the square block on marquee fading edge when text view
is applied transparency.

Change-Id: I110649db72a75fecc02ba56c201a05773f80328c
e63f7c622a2086aefa80983c6f41b74fb166bb42 17-Oct-2013 Chris Craik <ccraik@google.com> Clean unused parameters, disable warnings

Change-Id: Iddb872f53075dd022eeef45265594d1c6a9e2bc0
5caebe4c7c8644b1dbf3fef23551373b95a8efd6 21-Sep-2013 Chris Craik <ccraik@google.com> am bd842f96: am d8a84a86: Merge "Correct bitmap merging logic" into klp-dev

* commit 'bd842f96ed4a9b7887be4702828ea0034d66ef85':
Correct bitmap merging logic
996fe656340ede058a6f0e6b18f9ec525ddb4e27 21-Sep-2013 Chris Craik <ccraik@google.com> Correct bitmap merging logic


This fixes two issues

The check for pure translation was incorrect. It was fixed and renamed
for clarity.

Certain matrix paths weren't setting kTypePositiveScale. For
simplicity (and because positive scale is simple to check) removed
flag in favor of dynamic checking.

Change-Id: Ic5ce235653ef49a68b8b242bd89fc2e95874ecc9
2765c0b71679b5762ed72610e8310abd6d071b96 18-Sep-2013 Chris Craik <ccraik@google.com> resolved conflicts for merge of d97303a7 to master

Change-Id: I29e2e64e0ec241675762482cbe5c5e9dc58adca6
32f05e343c5ffb17f3235942bcda651bd3b9f1d6 18-Sep-2013 Chris Craik <ccraik@google.com> Conservatively estimate geometry bounds


Avoids a case where a rect with top coordinate of (e.g.) 0.51f is
assumed to not draw in the first row of pixels, which leads to it not
being clipped. Since rounding can cause it to render in this first
pixel anyway, we very slightly expand geometry bounds.

Now, in ambiguous cases, the geometry bounds are expanded so clipping
is more likely to happen.

Change-Id: I119b7c7720de07bac1634549724ffb63935567fc
2f93af4574fbca9c94679744114ce40496aa69b8 10-Sep-2013 John Reck <jreck@google.com> am 53760b4a: am 874ae2ad: Merge "Fix scissor for functor invocation" into klp-dev

* commit '53760b4a97fb2f88e94da73d647ff80221b3c454':
Fix scissor for functor invocation
25d2f7bc1ff9b475eff75bfff647466e91dbacb2 10-Sep-2013 John Reck <jreck@google.com> Fix scissor for functor invocation

Bug: 10677765
enableScissor() must precede setScissorFromClip() as
otherwise setScissorFromClip() doesn't do anything.
Also make sure to call setScissorFromClip() if
enableScissor() returns true as enableScissor() calls
resetScissor() if the scissor state has changed.

Change-Id: I9226b20bb256c92066aae344e4e6407540b6eae9
815fbbdfca52c37f251f156122b5537a9b9807e9 27-Aug-2013 Chris Craik <ccraik@google.com> am 7ff37ada: am ff2c22e2: Merge "Move functor GL setup to just before functor" into klp-dev

* commit '7ff37ada138d9023e9d646f7195ae761a7b83ff2':
Move functor GL setup to just before functor
54f574acf4dd5483170b8f79e2f7c70b58763ce7 26-Aug-2013 Chris Craik <ccraik@google.com> Move functor GL setup to just before functor


Because the stencil setup can issue draws, it *must* come before the
GL state setup.

Change-Id: I52a36213549fc60b091a90cbb923a1f0d35f9a65
2f7c6f04cc0593c449da3334653e6d0c20016c2b 21-Aug-2013 Romain Guy <romainguy@google.com> am dfb79408: am 5b8efc47: Merge "Add overdraw debugging that accounts for Deuteranomaly" into klp-dev

* commit 'dfb79408892b3f168204c54a9b81d813921fb0f9':
Add overdraw debugging that accounts for Deuteranomaly
627c6fd91377ead85f74a365438e25610ef1e2ee 21-Aug-2013 Romain Guy <romainguy@google.com> Add overdraw debugging that accounts for Deuteranomaly

Change-Id: I31f68a07aa7cf0490d2572e24e4c5ac2066a1151
3380cfdc77100e87aa8390386ccf390834dea171 16-Aug-2013 Romain Guy <romainguy@google.com> Replace float arrays with readable names

Change-Id: I32a8be560b60a4ac5cbee2fec4574b2c5df9f825
003123004f7b23b3dc472d5c40b8c1a16df37a54 09-Aug-2013 Romain Guy <romainguy@google.com> Remove an unnecessary allocation

Also remove dead code from OpenGLRenderer.cpp

Change-Id: I7eb54ca19e77ee3c32f1fe9513a031e6b2e115cf
(cherry picked from commit 5c7d5ab878b26f855175a3305a14ac12fcacf25e)
b213cec0ce659c1e35c3e7f60a61bae38d94482a 02-Aug-2013 Chris Craik <ccraik@google.com> Merge "Fix quickReject's handling of AA ramp geometry"
5e49b307eb99269db2db257760508b8efd7bb97d 31-Jul-2013 Chris Craik <ccraik@google.com> Fix quickReject's handling of AA ramp geometry

By having quickReject round out the window-space geometry bounds, we
prevent the AA perimeter (which falls outside the local bounds passed
in) from drawing outside the clip.

Change-Id: I8ee36be9039a9c47906815ee2f0dbaa5eb910b82
b7b93e00893f5c690a96bd3e0e10583bc5721f83 02-Aug-2013 Romain Guy <romainguy@google.com> Fix region clipping bugs
See external bug #58344

Change-Id: Iecd6c41fc8076cd76add2335d3442a6dd8878f12
1e546815bbb736c50679a8aefc25f48561026fc5 25-Jun-2013 Victoria Lease <violets@google.com> Support RGBA fonts and bitmap fonts (and RGBA bitmap fonts)

Quite a few things going on in this commit:

- Enable bitmap strikes by default in Paint objects.

The SkPaint parameter that enables bitmap strikes was not previously
included in DEFAULT_PAINT_FLAGS. This effectively disabled bitmap
fonts. Oops! It's for the best, though, as additional work was needed
in Skia to make bitmap fonts work anyway.

- Complain if TEXTURE_BORDER_SIZE is not 1.

Our glyph cache code does not currently handle any value other than 1
here, including zero. I've added a little C preprocessor check to
prevent future engineers (including especially future-me) from
thinking that they can change this value without updating the related

- Add GL_RGBA support to hwui's FontRenderer and friends

This also happened to involve some refactoring for convenience and

Bug: 9577689
Change-Id: I0abd1e5a0d6623106247fb6421787e2c2f2ea19c
98427708a81eefcc24ae29e2f22e55f1ae44c927 23-Jul-2013 Chris Craik <ccraik@google.com> Merge "Ensure glActiveTexture is cleaned up correctly on functor resume"
9ab2d1847552aa4169b4325aae1b1368d6947a9f 23-Jul-2013 Chris Craik <ccraik@google.com> Ensure glActiveTexture is cleaned up correctly on functor resume

Change-Id: I103d7d63b17289d599c2c08dcc442cfba9b8e51d
448455fe783b0a711340322dca272b8cc0ebe473 22-Jul-2013 Romain Guy <romainguy@google.com> Use global indices array to draw layers

An array of indices local to a layer would only be necessary if
we changed the way we resolve T-junctions. Since we only ever
draw quads, let's just use the indices we use everywhere else.

This change also uses the global indices array to render list
of colored rectangles to save on the number of vertices generated

Change-Id: Ia6d1970b0e9247805af5a114ca2a84b5d0b7c282
ecca6da4eab601f05a9d977c8d2651068b6e16b2 16-Jul-2013 Chris Craik <ccraik@google.com> Support stencil-based clipping for functors

Change-Id: I1c54e1bea1b84b1619cce27b14f189b42cab7062
c36fe2fc5354fadc140c898f59d47859cbdeac67 28-Jun-2013 Romain Guy <romainguy@google.com> am 55e789db: am ed96349a: am 3d1b158e: Merge "Fix out of range glCopyTexImage2D Bug #9425270" into jb-mr2-dev

* commit '55e789dbc782be0dcaf1d4bae5f32e9e2f674152':
Fix out of range glCopyTexImage2D Bug #9425270
b254c242d98f4a9d98055726446351e52bece2c6 28-Jun-2013 Romain Guy <romainguy@google.com> Fix out of range glCopyTexImage2D
Bug #9425270

A better solution would be to use glCopyTexImage2D whenever possible but
this change would be a little more dangerous.

Change-Id: Ib1aaceda39d838716285ef97f356721416822dbb
55b6f95ee4ace96c97508bcd14483fb4e9dbeaa0 28-Jun-2013 Romain Guy <romainguy@google.com> Track the atlas' generation ID
Bug #9589379

If the atlas is terminated/reinitialized and a view does not invalidate
in between it might end up using a stale AssetAtlas::Entry. This change
is similar to how 9patch meshes are cached in DrawPatchOp: we simply
track the generation ID of the cache to make sure we always use the
latest data.

Change-Id: Ib5abb3769d2ce0eabe9adc04e320ca27c422019e
0e87f00f8cb79635aa70b9a2dfa02bf19dc7473d 20-Jun-2013 Chris Craik <ccraik@google.com> Initialize MergingDrawBatch clip with viewport bounds

This allows merged, clipped operations to behave correctly within a
savelayer, even if the base viewport has a large offset.

Additionally, disregard opaqueness when within a
complexclip/savelayer, as the coverage can't be trusted.

Change-Id: Ic908b82a4bb410bc7fac1b4295f4874ed166efc5
03c00b5a135e68d22ca5bb829b899ebda6ed7e9d 21-Jun-2013 Romain Guy <romainguy@google.com> Batch 9-patches in a single mesh whenever possible

This change also fixes the way batched bitmaps were handled
inside a layer. The layer is now correctly dirtied to minimize
the amount of pixels to blend.

Fix alpha, mode and opaque computations for DrawPatchOp.

Change-Id: I1b6cd581c0f0db66c1002bb4fb1a9811e55bfa78
fb5a41a371e540f402e3dd987b0fbf92d1267902 20-Jun-2013 Romain Guy <romainguy@google.com> Merge "Fix regression: TextureView.setAlpha() was ignored"
2458939b5f926176a485a3196f59688eed78e858 19-Jun-2013 Romain Guy <romainguy@google.com> Fix regression: TextureView.setAlpha() was ignored

Change-Id: I9f43eec0fe23a65dcc1cf9cd0ac1f5e8907786a7
cadc5bf4116945a1800061f984d95175e20caba6 19-Jun-2013 Romain Guy <romainguy@google.com> Merge "Share Caches' index buffer with FontRenderer"
31e08e953fe7bdb1b1cbc247156cb6a19917a2f1 19-Jun-2013 Romain Guy <romainguy@google.com> Share Caches' index buffer with FontRenderer

This reduces state changes when we draw 9patches and text together,
which happens *a lot*. Also disable the NV profiling extension by
default since it doesn't play nice with display lists deferrals.
To enable it set debug.hwui.nv_profiling to true.

Change-Id: I518b44b7d294e5def10c78911ceb9f01ae401609
36d38cb904556025b76c6d98f9fe2ccfa1c8a304 17-Jun-2013 Chris Craik <ccraik@google.com> Merge "Better handle op size edge cases"
d72b73cea49f29c41661e55eb6bfdbc04f09d809 17-Jun-2013 Chris Craik <ccraik@google.com> Better handle op size edge cases


Previously, empty and unknown sized ops are assumed to fully cover
their clip. This is now corrected such that empty sized ops are
pre-rejected before defer. Additionally, unknown sized ops disable
overdraw avoidance.

Change-Id: Icf2ce24f98be5ea6299e24ffcf826790373564a1
fb5c9050978afad2c1df570a13a6747f438c27f7 17-Jun-2013 Romain Guy <romainguy@google.com> Merge "Cancel layer update when a layer is about to be destroyed Bug #9310706"
e93482f5eac3df581d57e64c2a771a96aa868585 17-Jun-2013 Romain Guy <romainguy@google.com> Cancel layer update when a layer is about to be destroyed
Bug #9310706

Change-Id: I73eea6314c326f15a979617e3a05b525935f0d3f
a02c4ed885d97e516f844ddb0a96083f1b45b4cb 14-Jun-2013 Chris Craik <ccraik@google.com> Fix clip merging behavior

Previously, a new op with a clipped side could be added to a
MergingDrawBatch without considering the batch's current bounds.

Change-Id: I1b873ecf821bad7cda6630c3f311edd90ac5cc8c
39a908c1df89e1073627b0dcbce922d826b67055 13-Jun-2013 Chris Craik <ccraik@google.com> Fix various draw ops that may incorrectly not scissor


Also consolidates quickReject scissor-ing and scissor-less paths.
Renamed plain 'quickReject' method, as it has sideEffects beyond what
the java and skia canvases do.

Change-Id: I4bdf874d3c8f469d283eae1e71c5e7ea53d47016
7112fddbe26acb12f478f4e77ff9607b523180b4 13-Jun-2013 Romain Guy <romainguy@google.com> Merge "Restore buildLayer()'s old behavior; it's synchronous again Bug #9193833"
405436021da156fbe3c5d4de48bdefa564cf7fc0 13-Jun-2013 Romain Guy <romainguy@google.com> Restore buildLayer()'s old behavior; it's synchronous again
Bug #9193833

Change-Id: I4ee07e65c0a8967f0b55da030ecaad6dfc46136f
28ce94a4ffc7576f40776d212f1ada79fafaa061 31-May-2013 Chris Craik <ccraik@google.com> Overdraw avoidance and merging of clipped ops


If an opaque op, or group of opaque ops covers the invalidate region,
skip draw operations that precede it.

Clipped operations may now be merged, but only if they share a
clipRect - this is a very case for e.g. ListView, where all background
elements may now be a part of the same MergingDrawBatch.

It is this more aggressive merging that groups together clipped
background elements in the ListView case, enabling the overdraw
avoidance skipping the window background.

Change-Id: Ib0961977e272c5ac37f59e4c67d828467422d259
4c2547fa9244e78115cde0a259291053108c3dc7 12-Jun-2013 Romain Guy <romainguy@google.com> Avoid 9patch cache lookups when possible

This optimization saves up to 0.3ms per frame on the Play Store's
front page, on a Nexus 4 device.

Change-Id: Iaa4ef33c6e3b37e175efd5b9eea9ef59b43f14f3
8aa195d7081b889f3a7b1f426cbd8556377aae5e 05-Jun-2013 Romain Guy <romainguy@google.com> Introduce Caches::bindTexture() to reduce glBindTexture calls

Change-Id: Ic345422567c020c0a9035ff51dcf2ae2a1fc59f4
a404e16e4933857464046d763ed7629cd0c86cbf 25-May-2013 Romain Guy <romainguy@google.com> Make sure atlas antries can correctly filter/wrap textures

The virtual textures would each have their own values for wrapping
and filtering which could lead to conflict and/or extraneous GL
commands being issued.

Change-Id: I64cb59a03e598f46bf645bd1d30fccfa63a07431
7f77736599c39cdd5540168fc652cf6846799a33 22-May-2013 Romain Guy <romainguy@google.com> Merge "Merge scaled bitmaps with translated bitmaps"
2db5e993b626794eb07a0ff354269f9a77da81b3 22-May-2013 Romain Guy <romainguy@google.com> Merge scaled bitmaps with translated bitmaps

Change-Id: I03089f48f97b69fcb4a0171984d3ff548d41c4a8
41541825bc90dac740e424cdd41a8c997e15cdb7 04-May-2013 Chris Craik <ccraik@google.com> Use individual glyph positions to determine text bounds.


Previously text bounds were calculated to be from 0 to totalAdvance in
the X, and from the font's top to bottom. These are incorrect,
especially in light of the font fallback mechanism.

Now, we calculate the bounds of the text as we layout each glyph.
Since these are much tighter bounds in the common case, this
significantly reduces the amount of clipping required (which in turn
enables more aggressive text merging).

Change-Id: I172e5466bf5975bf837af894a9964c41db538746
6d29c8d5218cac0fb35f3b7c253f2bdebd44f15a 09-May-2013 Chris Craik <ccraik@google.com> Add tessellation path for points


Point tessellation is similar to line special case, except that we
only tessellate one point (as a circle or rect) and duplicate it
across other instances.


Fixes square caps for AA=false lines

Cleanup in CanvasCompare, disabling interpolation on zoomed-in
comparison view

Change-Id: I0756fcc4b20f77878fed0d8057297c80e82ed9dc
72bd95b8feb7ef41eb5dd00003b1aed8f30f4abe 06-May-2013 Romain Guy <romainguy@google.com> am b90ff505: am fdf13c90: Merge "Convert alpha from [0..1] to [0.255] range Bug #8808886" into jb-mr2-dev

* commit 'b90ff505df143abd957cfc19b60727e3460ee68c':
Convert alpha from [0..1] to [0.255] range Bug #8808886
87b515cde53f3c8cc3fdf698c100e67508487e59 04-May-2013 Romain Guy <romainguy@google.com> Convert alpha from [0..1] to [0.255] range
Bug #8808886

Without this conversion, alpha was always set to 0 or 1 which causes
things to disappear mysteriously. Mysteries are meant to be solved
and I solved them all in 6 characters.

Change-Id: I2078420fbe968c046e999b0eabb24403e71108fd
78dd96d5af20f489f0e8b288617d57774ec284f7 03-May-2013 Romain Guy <romainguy@google.com> Add an on-screen overdraw counter

The counter can be enabled by setting the system property called
debug.hwui.overdraw to the string "count". If the string is set
to "show", overdraw will be highlighted on screen instead of
printing out a simple counter.

Change-Id: I9a9c970d54bffab43138bbb7682f6c04bc2c40bd
3b748a44c6bd2ea05fe16839caf73dbe50bd7ae9 18-Apr-2013 Romain Guy <romainguy@google.com> Pack preloaded framework assets in a texture atlas

When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.

This CL introduces an asset server that provides an atlas to all processes.

Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.


The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)


Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.

There are several steps that lead to the atlas generation:

1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas

2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.

3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.


Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.

It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)

Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.

Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
4a2bff7b387403ac976cd041cb5a1b57afa44d9c 16-Apr-2013 Chris Craik <ccraik@google.com> Avoid incorrectly dirtying the functor output rect

Change-Id: I360cb85e59cfdd0b499561e92b81089341d07046
34416eaa1c07b3d7a139e780cea8f8d73219650e 16-Apr-2013 Chris Craik <ccraik@google.com> Make layer double drawing visible in overdraw debug mode

A clipped saveLayer will cause two draws - first to an onscreen
buffer, then again back to the framebuffer. This change - when in
overdraw debug - reissues draws associated with a clipped saveLayer,
but only to the stencil buffer. Operations within a saveLayer are
shown correctly to be twice drawn, and View.setAlpha() without an
associated hardware layer, or hasOverlappingRendering() are made more

Hardware layers, on any frame that they are updated, similarly draw
twice, and will also be counted against the stencil buffer doubly.

Note: greater depths of layers - e.g. a saveLayer within a saveLayer -
are not respected, as that would require additional region tracking.

Change-Id: I61fb0e61038fe66013d59914c20bb47a550dea7d
527a3aace1dd72432c2e0472a570e030ad04bf16 04-Mar-2013 Chris Craik <ccraik@google.com> Draw Operation merging

Merge simple bitmap draw operations and text operations to avoid
issuing individual gl draws for each operation. Merging other ops to
be done eventually.

The methods are different - the bitmap merging generates a single
mesh for reused, unclipped images (esp. repeated images in a listview)

The text approach queries just defers the normal font rendering until
the last drawText in the sequence that can share the same shader.

Patches are sorted and merged, but don't yet have a multiDraw
implementation. For now, the pretending-to-merge gives better sorting
behavior by keeping similar patches together.

Change-Id: Ic300cdab0a53814cf7b09c58bf54b1bf0f58ccd6
cf51a4199835e9604aa4c8b3854306f8fbabbf33 09-Apr-2013 Romain Guy <romainguy@google.com> Introduce PixelBuffer API to enable PBOs

PBOs (Pixel Buffer Objects) can be used on OpenGL ES 3.0 to perform
asynchronous texture uploads to free up the CPU. This change does not
enable the use of PBOs unless a specific property is set (Adreno drivers
have issues with PBOs at the moment, Mali drivers work just fine.)

This change also cleans up Font/FontRenderer a little bit and improves
performance of drop shadows generations by using memcpy() instead of
a manual byte-by-byte copy.

On GL ES 2.0 devices, or when PBOs are disabled, a PixelBuffer instance
behaves like a simple byte array. The extra APIs introduced for PBOs
(map/unmap and bind/unbind) are pretty much no-ops for CPU pixel
buffers and won't introduce any significant overhead.

This change also fixes a bug with text drop shadows: if the drop
shadow is larger than the max texture size, the renderer would leave
the GL context in a bad state and generate 0x501 errors. This change
simply skips drop shadows if they are too large.

Change-Id: I2700aadb0c6093431dc5dee3d587d689190c4e23
58d110afa0e0f3843d72617046185a3c2d48dca9 10-Apr-2013 Chet Haase <chet@google.com> Fix Contacts animation jank

The last frame of an animation stays stuck on the screen for a couple of frames.
Specifically, the "Quick Contact" animation that animates the picture
closed (fades/scales it away) animates all the way to the end... then hangs there
briefly before being taken down.

The problem is a rendering bug where we correctly detect that a DisplayList
has nothing to draw (since the last frame is completely transparent, alpha==0),
but incorrectly ignore the fact that we cleared the transparent-background
window prior to not-drawing that DisplayList. When we detect that there's
nothing to draw, we don't bother swapping buffers. So even though we drew
the right thing (clearing the buffer), we didn't actually post the buffer to the

This change factors in both the clear and the draw to decide when to swap buffers.

Issue #8564865 Quick contact close animation jank redux

Change-Id: Ib922cff88a94f025b62f7461c1a29e96fe454838
a151ef8c667a52d9fae28c09f780784f19bdb039 05-Apr-2013 Romain Guy <romainguy@google.com> Merge "First OpenGL ES 3.0 based optimization" into jb-mr2-dev
1206b9bba91f7ed899c5c87427cce725fe5aadfc 04-Apr-2013 Chris Craik <ccraik@google.com> Traverse layers in update order


Layers now require traversal in update order, as it will be child
first, then parent for layer-in-layer

Fixes issue with deferred layer playback not flushing in order, and
thus child not painting before parent

Also fixes DisplayList to only be cleared after flush in deferred list

Change-Id: I2f284d00079cdb20798aeef6a1c94e823940db40
0908764b2b3cf5075df4178a5f0a8547dcb7b317 04-Apr-2013 Romain Guy <romainguy@google.com> First OpenGL ES 3.0 based optimization

This change uses a new OpenGL ES 3.0 feature to upload less data when
the font cache needs to be update. This can result in significant
performance improvements on device with large textures or with locales
that use a lot of glyphs (CJK for instance.)

This change also fixes various unpack alignment issues. The unpack
alignment, as well as the unpack row length, is not texture specific
but a global state that affect all glTex/SubImage2D calls. Some of
them were missing the appropriate glPixelStorei() call. This could
result in corrupted textures.

Change-Id: Iefb429d4d0d0b4e0faeadf27daafee6d30a21d85
16ecda5317c40fc3da284952d9b3add34d6763ae 29-Mar-2013 Chris Craik <ccraik@google.com> Update view's alpha and layer docs


Makes the performance issues and interaction with layer type/paint
more clear.

Additionally, corrects change from 47ab7d6612e2b5b8b66fb261dafef7c91264e173
to still allow displayList alpha to override layer paint

Change-Id: Ic94d75865700820489370461cd8ac9f9077a8d90
02b49b70ede0b9eb760ff334823aee1d9520ed85 29-Mar-2013 Romain Guy <romainguy@google.com> Prevent crash when a single layer is enqueued several times for updates
Bug #8504687

Change-Id: I9b01bbc4e3f37af23dfe5e68d3d03ad3d238b94a
7273daace9303f4662444111c40bb83d3ead4a92 28-Mar-2013 Chris Craik <ccraik@google.com> Fix issues related to saveLayer/restore deferral


Changes drawModifiers and alpha to be restored for all operations,
since saveLayer/restore use these values, not just draw operations

Also forces a renderer state restoration before a deferred restore op
is played back, in case it is associated with a saveLayer that
doesn't have the save_clip flag set

Change-Id: I9da5d44fefbfffdee164c98f4f139843dacf85df
9cd645121584bc167b3fab61b1ed89ddc4631365 27-Mar-2013 Chris Craik <ccraik@google.com> Merge "Set ignore flag during deferred savelayer" into jb-mr2-dev
408eb12631376cbdc96803e918decf6ea804d346 27-Mar-2013 Chris Craik <ccraik@google.com> Set ignore flag during deferred savelayer


Additionally, add ignore check for draw functor

In deferred mode, if we don't set ignore, a 0 alpha displayList won't
be quickRejected, and not only would its contents be needlessly
deferred, but upon playback any functors would be drawn, ignoring the
state of the snapshot.

Change-Id: Ib1edb3252080f674254086edee6f965f0efcce78
96885eb480c5e0526fe2f77d30f6e551f3f3ceab 26-Mar-2013 Romain Guy <romainguy@google.com> Avoid multiple font cache texture uploads
Bug #8378964

This change defers drawing into layers until after the renderer for FBO0
is ready to draw. At that point, all the precaching is done which means
all glyphs can be uploaded at once in the font caches.

Change-Id: Ie1f7a7ff30f76f06fb3dbc72c7d05e66207d1ecb
5f803623559aab395a29d575c37c4e39c23a4b4e 21-Mar-2013 Chris Craik <ccraik@google.com> Isolate tiling clip state from snapshot


Snapshots frequently have their clip overwritten due to applying
deferred state - now, store tiling clip information in a separate
rect, outside of the snapshot so it isn't overwritten.

Change-Id: I21ca4c45dcd802eae99e8de86f11525196777ccb
9eac52698b18d089e73c7ec2bf73a64a39504733 21-Mar-2013 Romain Guy <romainguy@google.com> Merge "Optimize text GL setup" into jb-mr2-dev
7564c716bbee6a4825ae747797068d0e7c370c0d 21-Mar-2013 Chris Craik <ccraik@google.com> Merge "Use snapshot alpha in all layer drawing" into jb-mr2-dev
e83569ca76308bfe945efcfef5a12c64b8fb8849 21-Mar-2013 Chris Craik <ccraik@google.com> Use snapshot alpha in all layer drawing

Change-Id: Icc093390da2fc36b2b6693d0e5e4357b2f730bf9
257ae3502cfad43df681b1783528d645bdabc63f 21-Mar-2013 Romain Guy <romainguy@google.com> Optimize text GL setup

Only performs the GL setup steps when at least one glyph is drawn.
This change also skips various draw operations when the specified
paint draws with alpha = 0.

Change-Id: I9eda148b0503acffc552ee19196f5d52e958a1a2
d90144db52c7297879b950cbbc85137ed123ab5b 19-Mar-2013 Chris Craik <ccraik@google.com> Update snapshot upon saveLayer deferral


In order to defer fbo-targetting saveLayer operations, it's necessary
to update the snapshot at defer time so that deferred display state
(namely, clip and transform) are fbo relative.

Re-enables deferring, as the issues with saveLayer are fixed.

Change-Id: I74b0779bc732675c747208f0757c3ea85f6dfbed
4494599e5a4931426d5649e1d1c4f9db83824ae8 20-Mar-2013 Chris Craik <ccraik@google.com> Merge "Use snapshot alpha for layers" into jb-mr2-dev
16b7dc9c1ca4336b29afbd2f56f580014863add0 19-Mar-2013 Romain Guy <romainguy@google.com> Merge "Merge all shapes/paths caches to PathCache" into jb-mr2-dev
c46d07a29e94807e768f8b162ce9f77a88ba6f46 16-Mar-2013 Romain Guy <romainguy@google.com> Merge all shapes/paths caches to PathCache

This change will greatly simplify the multi-threading of all
shape types.

This change also uses PathTessellator to render convex paths.

Change-Id: I4e65bc95c9d24ecae2183b72204de5c2dfb6ada4
cada41aeb1e4cd87a94df2dfb4dd645309fe66ba 19-Mar-2013 Chris Craik <ccraik@google.com> Work around saveLayer clipping/transform deferring issues


Disables deferring

Change-Id: I93498a4a45a5bfe01143faa154926c6a138db8f9
d0afeac6dfc0856eeb72e6176ad6335e81871d24 16-Mar-2013 Chris Craik <ccraik@google.com> Reset draw modifiers after flushing


This avoids leaving the renderer in a state with stale pointers (to,
e.g., shaders or color filters)

Change-Id: Idf8b63657041352e70e34e91ea416fe4385d4bc2
a08f95cfeca7217f9c533b03663bf0dceedd259a 16-Mar-2013 Chris Craik <ccraik@google.com> Use snapshot alpha for layers

Removes mMultipliedAlpha, using the snapshot alpha for all
non-overlapping display list alpha control.

Additionally, fixes opacity issues where children of
hasOverlappingRendering=false displaylists (both hw layer sublists and
other sublists with hasOverlappingRendering=false)

Change-Id: I6adc16da855835f9f518f8967628e5d0135c789b
ff78583d8a73ca35ce65b5d2592570ff6fb9901b 08-Mar-2013 Chris Craik <ccraik@google.com> Fully deferred displaylist replay


A recursive drawDisplayList call is now entirely deferred before
playing back to the screen and issuing GL commands. This way, the
entire stream can be inspected, optimized, and batch work (such as
uploading textures) before issuing commands.

Additionally, this fixes an issue where operations draw could move
across restores corresponding to saveLayer(alpha). Those and other
similar cases (such as complex clipping, requiring the stencil) are
now treated as batching barriers, with the operations that change
renderer state in a way that's difficult to defer are just re-issued
at flush time.

Change-Id: Ie7348166662a5ad89fb9b1e87558334fb826b01e
ca89e2a68703bd428e8b66547d033a6ed35b3595 09-Mar-2013 Romain Guy <romainguy@google.com> Precache paths from a worker thread

Change-Id: I3e7b53d67e0e03e403beaf55c39350ead7f1e309
b09f1471262c3e629daacbc319bcefc2d621a484 08-Mar-2013 Romain Guy <romainguy@google.com> Don't apply scale to glyphs when a perspective is set.
Bug #8337925

Magazines uses very large scale factors that blow up font cache & CPU.

Change-Id: I1c0ed430ed91b86cc6c6f59f7e8bdcc89a464e46
624234f69b2a4781d24f3e4c6ae6450729e38397 06-Mar-2013 Romain Guy <romainguy@google.com> Take only the scale params into account to rasterize text

This change extracts the scale parameters of the current transform
to pass then to the font renderer. Rotation and perspective are
applied to the generated mesh inside the vertex shader. This limits
the number of glyphs we have to create in the font cache and thus
reduces memory churn.

Change-Id: Ic5b3bae2b2b0e0250a8ee723b071a1709725c749
3b753829ae858d424fe109f714745379a6daf455 05-Mar-2013 Romain Guy <romainguy@google.com> Fix colored rects clipping and code cleanup

The drawColorRects() method was clipping individual rectangles
using the wrong parameters left, top, right and bottom instead
of l, r, t and b. It also checked for count == 0 after the loop
when it should have checked for vertexCount == 0. The quickReject
is now not part of the loop since it's a bit overkill to perform
so many matrix multiplications. What we really care about is the
final quickReject performed on the max bounds of the entire set
of rectangles.

This change also replaces all instances of mSnapshot->transform
by currentTransform() to make the code slightly more readable.

Change-Id: I6485280414499716852f7dbfba186774eb6763d4
19d4dd8599cb870923ab349d2ab96cacffd9c6f5 04-Mar-2013 Romain Guy <romainguy@google.com> Take text scale/skew into account only when rendering into a layer

3D rotations can undo scale/skew transforms; since FreeType only accepts
2x2 matrices we can end up generating very large glyphs that are drawn
at a 1:1 scale on screen. For instance, if the current transform has a
scale of 2000 set on both X and Y axis and a perspective Z factor set to
Z, the actual scale factor on screen ends up being 1. We would however
generate glyphs with a scale factor of 2000 causing the font renderer
to blow up.

Change-Id: Ia5c3618d36644e817825cb9c89e2f53aece2074e
0f6675332c04c74909425d1d328f02b32c0ff40e 01-Mar-2013 Romain Guy <romainguy@google.com> Precache glyphs at final raster size

The deferred display lists model now allows us to precache glyphs
at their exact size on screen.

This change also removes debug markers when the renderer defers
and reorders display lists. It also adds a flush event marker.

Change-Id: I66ec5216dc12b93ecfdad52a7146b1cfb31fbeb4
a4adcf0239039eb8f005be252409901c41b28839 28-Feb-2013 Romain Guy <romainguy@google.com> Support 3D rotations when drawing text

If a perspective transform is set on the Canvas, drawText() should
not attempt to rasterize glyphs in screen space. This change uses
the old behavior instead (i.e. rasterize the glyphs at the native
font size and apply the transform on the resulting mesh.)

This change also adds an optimization: empty glyphs (spaces) do
not generate vertices anymore. This saves a lot of vertices in text
heavy applications such as Gmail.

Change-Id: Ib531384163f5165b5785501612a7b1474f3ff599
c74f45a334f0e3725c23cdd270cbcb0efac4ea75 27-Feb-2013 Romain Guy <romainguy@google.com> Properly scale text

This change does not apply to drawPosText() and drawTextOnPath() yet.

Prior to this change, glyphs were always rasterized based on the
font size specified in the paint. All transforms were then applied
on the resulting texture. This creates rather ugly results when
text is scaled and/or rotated.

With this change, the font renderer will apply the current transform
matrix to the glyph before they are rasterized. This generates much
better looking results.

Change-Id: I0141b6ff18db35e1213e7a3ab9db1ecaf03d7a9c
d80806b305ce337283c24f14522cc58fea090b8c 28-Feb-2013 Chris Craik <ccraik@google.com> Merge "Fix T-junctions in layers' generated meshes" into jb-mr2-dev
a6456d0d7ea2a65474b8a3db5dbf001880c40a71 27-Feb-2013 Romain Guy <romainguy@google.com> Merge "Draw text drop shadows even when the text color is transparent" into jb-mr2-dev
6c5b9be7450903762f676522c32d65f7545730df 27-Feb-2013 Chris Craik <ccraik@google.com> Fix T-junctions in layers' generated meshes


Currently we fix T-junctions for hardware layers, and for
Canvas.saveLayer if the transform isn't rectAsRect. Ideally, hardware
layers should lazily re-generate T-junction free geometry if the
transform becomes non-rectAsRect

Depends on frameworks/native change:
which adds Region::createTJunctionFreeRegion()

Change-Id: Ice75b4a1a4459ff835059ea81d70f7d1563fd96d
768bffc9b814f6a1f7d9ff59d91285895c23bbe9 27-Feb-2013 Romain Guy <romainguy@google.com> Draw text drop shadows even when the text color is transparent

This matches Skia's behavior.

Change-Id: Ibf0a52611f5801cfa68169f66ab0ec06f256600f
758724fd09a1599f2c55130f81953cfa6c17c300 27-Feb-2013 Romain Guy <romainguy@google.com> Don't increment the paint's generation ID when drawing bitmaps

When the renderer draws a bitmap as part of a display list with an
alpha < 1.0f, the paint is temporarily modified to alter the opacity
of the bitmap. This has the side effect of increasing the paint's
generation ID counter which can break paint caching.

Change-Id: I5055d059ad1639829fa50af3d946e296c4dab877
3ff0bfdd144bba3b023eda8c49b25fb0d0de8653 25-Feb-2013 Romain Guy <romainguy@google.com> Add new property to debug non-rectangular clip operations

This change adds a new property called "debug.hwui.show_stencil_clip"
that accepts the following values:

- "highlight", colorizes in green any drawing command that's tested
against a non-rectangular clip region
- "region", shows the non-rectangular clip region in blue every time
it is used
- "hide", default value, nothing is shown

Change-Id: I83c8602310edc4aaeb8b905371cdd185b17d32b5
505d1d64eda6e47caabf8701cb39ec9b176b3238 22-Feb-2013 Romain Guy <romainguy@google.com> Merge "Prettify display lists logging"
7031ff68bb998dbbd7caf3b2fd75eef747a86725 22-Feb-2013 Romain Guy <romainguy@google.com> Prettify display lists logging

This change makes it a lot easier to see the tree structure.

Change-Id: I4969abd1eb010f1d529671f8d86dc4c930be24f6
94b97b38b749d50c8693a044dd2688328cca863e 22-Feb-2013 Chris Craik <ccraik@google.com> am eab51de4: Merge "Fix clipping and stencil layer issues"

* commit 'eab51de4de88219256260fe26e2018a6234ef83b':
Fix clipping and stencil layer issues
b98a016c6769b9e80d392df22fe77a2fca048d9f 21-Feb-2013 Chris Craik <ccraik@google.com> Fix clipping and stencil layer issues


Ensure rectangle clipping operations disable deferring when necessary
(i.e., when the op might create a non-rect region), including in

Additionally, makes clipping with a kUnion always use a region, for
consistency with software rendering

Change-Id: I6730f1a80250bcf3f91cd4afde646d470a12dbc2
c4ca87f0f4034d4b987084d2b62ed7e5e0430557 20-Feb-2013 Chris Craik <ccraik@google.com> am 8a47d8ea: Merge "Clean up clipping and deferral logic"

* commit '8a47d8eaec26d0937aee94a057f561f246748339':
Clean up clipping and deferral logic
8a47d8eaec26d0937aee94a057f561f246748339 20-Feb-2013 Chris Craik <ccraik@google.com> Merge "Clean up clipping and deferral logic"
5d11676414b3606792e23c269cf75b44faa1a2af 20-Feb-2013 Chris Craik <ccraik@google.com> Clean up clipping and deferral logic


-Merges replay methods
-Bounds checking for DrawBitmapMesh, DrawRects and DrawDisplayList
-Use clip as bounds for otherwise unbounded draw operations

Clip-as-bounds is correct for drawColor and functor, but other draw
operations (pos text, text on path, and layers) still need true bounds

Change-Id: I5d5149d2c624f01e3fe46628bf156e835e69b9d5
846f5f238fd96a14197022baad86eab8882fe3bc 19-Feb-2013 Romain Guy <romainguy@google.com> am e91efaba: Merge "Expose display list APIs"

* commit 'e91efabaf2c51d017bf4c5bc4e06491c3511f4e5':
Expose display list APIs
52036b19a5f82bc4d75cfcbff99c65df8d25a99b 15-Feb-2013 Romain Guy <romainguy@google.com> Expose display list APIs

The exposed APIs are slightly simpler than the full APIs used internally.
Only APIs useful to applications are exposed.

Change-Id: Ie03014628d40ad5ef63dedbc52ce3def84429d54
620cff4006ee0b507f00ef8a242ecff4e60ba4e9 19-Feb-2013 Chris Craik <ccraik@google.com> am ad82f20d: Merge "DisplayList draw operation reordering"

* commit 'ad82f20d2382396f5ac75fdf6f7db5c4da1c4c23':
DisplayList draw operation reordering
c3566d06421c8acc0aafb18f7e307e5725ce87e1 05-Feb-2013 Chris Craik <ccraik@google.com> DisplayList draw operation reordering


The reordering enables similar operations to draw together, minimizing the
OpenGL state change operations that go inbetween draws. Eventually, multiple
complete canvas draw operations will be merged (into a single glDrawArrays call,
for example)

Reorders DisplayList draw operations when:

-They can move backwards in the command stream to be after similar
operations without violating draw ordering

-The OpenGLRenderer is in a simple, replayable state (no complex clip,
or filter/shadow etc)

Also adds two system properties to control the deferral/reordering:
which can be set to "true" to control the display list manipulation

Change-Id: I5e89f3cb0ea2d2afd3e15c64d7f32b8406777a32
feb6954da185901dfb558a8ec85f4908ca86a4eb 14-Feb-2013 Romain Guy <romainguy@google.com> am 10c0aa24: Merge "Implement support for drawBitmapMesh\'s colors array"

# Via Android (Google) Code Review (1) and Romain Guy (1)
* commit '10c0aa246d9b2633c6cb4e5b714abb0031a4f4cd':
Implement support for drawBitmapMesh's colors array
10c0aa246d9b2633c6cb4e5b714abb0031a4f4cd 14-Feb-2013 Romain Guy <romainguy@google.com> Merge "Implement support for drawBitmapMesh's colors array"
ff316ec7a76e52572a2e89b691e6b3bba0cafba3 14-Feb-2013 Romain Guy <romainguy@google.com> Implement support for drawBitmapMesh's colors array

Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
c932760f667cf56ca7a1aeffde505745dc3632e1 14-Feb-2013 Chris Craik <ccraik@google.com> Merge "Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE"
8d4aeb7111afac0c3c7e56d4ad5d92f9cfce2ffd 13-Feb-2013 Romain Guy <romainguy@google.com> Add a render buffer cache to reuse stencil buffers
Bug #7146141

This new cache is used in a similar way to LayerCache. It helps
reuse already allocated stencil buffers and thus avoid churning
memory on every frame.

Change-Id: I19551d72da52c40039e65904563600e492c8b193
7c1a49f5f5ed6613d736464bf5001b777e89ced2 13-Feb-2013 Chris Craik <ccraik@google.com> Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE

This reverts commit 6c0307dd0aefe9a08794b155fc03ee60ebd14f25, reversing
changes made to a2cd828b749c444d55c2c41c7dbb85088ff94b9f.


Change-Id: Ia178efe8b14751583d47b2826bfe3d3d5463dd2e
e67307c816f3fdae2bfba8e9a4410dc015645e91 12-Feb-2013 Romain Guy <romainguy@google.com> Prevent crash when setting up a stencil-based clip
Bug #8177690

Clear the layers before we setup the stencil to avoid dereferencing
the recently deleted rects.

Change-Id: I5dce5f965672f276f9490636d85b6018d3ab9422
d71ff91dcd79f6beea4bbe768ab3bcbb1a6d7c39 08-Feb-2013 Romain Guy <romainguy@google.com> Apply the clip rect/region to drawLines()

Without the check to quickReject, drawConvexPath would never
setup the clip properly.

Change-Id: I23e5b25de3383c9e9b86eea4ee7a9552f8d9efb4
da8d8b9699fe8e9557389465007e333d3f03dcc1 07-Feb-2013 Romain Guy <romainguy@google.com> Merge "Add a RenderBuffer object to store stencil buffers. Bug #7146141"
3bbacf27c0be1bae4e4483577fc89ae3113abe5d 07-Feb-2013 Romain Guy <romainguy@google.com> Add a RenderBuffer object to store stencil buffers.
Bug #7146141

This change is needed to add a render buffer cache to avoid
creating and destroying stencil buffers on every frame.

This change also allows the renderer to use a 1 bit or 4 bit
stencil buffer whenever possible.

Finally this change fixes a bug introduced by a previous CL
which causes the stencil buffer to not be updated in certain
conditions. The fix relies on a new optional parameter in
drawColorRects() that can be used to avoid performing a
quickReject on rectangles generated by the clip region.

Change-Id: I2f55a8e807009887b276a83cde9f53fd5c01199f
1ba0289d18f16e190a3bc7cf9226d061016dc355 07-Feb-2013 Chris Craik <ccraik@google.com> Merge "Add cap tessellation support"
65cd612face362d054a85d0f7e5881c59cd523be 11-Dec-2012 Chris Craik <ccraik@google.com> Add cap tessellation support


Currently used for lines (with and without AA) and arcs with useCenter=false

Also removes 0.375, 0.375 offset for AA lines

Change-Id: Ic8ace418739344db1e2814edf65253fe7448b0b0
f5db9b8ed42cace00d4e84b4a7e2e63a7c654b35 05-Feb-2013 Derek Sollenberger <djsollen@google.com> Merge "Changes needed to roll Skia to r7527." into master-chromium
a362c69d6cdf448107e5a539f77df73937141870 04-Feb-2013 Romain Guy <romainguy@google.com> Set the scissor from OpenGLRenderer::drawColorRects
Bug #8131254

This method is used as an optimization for paths containing only
non-overlapping rectangles. The implementation was correctly
rejecting rectangles invidually but not the bounds of the array
of rectangles. If quickReject() is not called, setupDraw() won't
be able to properly set the scissor.

Change-Id: I50aa11a4bd8b525b267d36a3039fe7a6fba50518
d81ec456bb097a712bcbc093c5a1e0075434158e 04-Feb-2013 Derek Sollenberger <djsollen@google.com> Changes needed to roll Skia to r7527.

Change-Id: I84aef3f8a733c869fade06021816646001532758
ef35927abcd089652f87a985dd6dde7afde58b92 01-Feb-2013 Romain Guy <romainguy@google.com> Tag HardwareRenderers with a name to help debugging

The name of the renderer is the same as the window it belongs to.

Change-Id: Ie9adc0a1978afa026923ea41f5540eda6ba65a92
f735c8e5cb59d6e1d1aa152fed7a6480a08d1c2a 01-Feb-2013 Romain Guy <romainguy@google.com> Fix tiling on QCOM GPU

Rename Caches::startTiling parameter from opaque to discard to
make it clearer what its role is. Tweak calls to startTiling
to preserve the buffer when needed and discard it when possible.

Change-Id: If7f8ff19003f79f36885a0a7207cc61901f637d2
f158198ccc3a1f53bfebaa6b8f4426e80e1867ea 01-Feb-2013 Romain Guy <romainguy@google.com> Discard the correct buffer when the bound FBO is not 0

glDiscardFramebufferEXT uses different constants depending on whether
the default FBO is bound or not. The code was choosing the proper value
for the color buffer but not for the stencil buffer.

Change-Id: I55cfcbdf663582119cb1a6289317016440d9e361
c93c6aa5553203f05df871804517885fcc071cfd 30-Jan-2013 Chris Craik <ccraik@google.com> Merge "Object-based DisplayList recording"
c3fedafc5f50100219449125a000e3138f6fb987 30-Jan-2013 Romain Guy <romainguy@google.com> Fix graphical corruption on QCOM GPU
Bug #7146141

The GL_QCOM_tiled_rendering extension requires careful use of
start/endTiling when attaching a renderbuffer dynamically.

Change-Id: I20036683ed3909ffaf40cc3d57a25257e35b6fa2
2af4635e4a9e448a65ff541252f8f94bc6ac48e0 27-Nov-2012 Chris Craik <ccraik@google.com> Object-based DisplayList recording


Changes the DisplayList from using stream read/write commands to use an array of
objects manually allocated on a linear buffer.

Depends on frameworks/native change https://googleplex-android-review.googlesource.com/#/c/257695/ which adds LinearAllocator

Also changes drawRects to use float count instead of rect count, to be more like drawLines/drawPoints

Change-Id: Ia2e4a11acd8f0a757042a05cbc9e7563cb73ee47
2055abaa0a590c35e27e1ae2e7d7cfccdfb98b59 19-Jan-2013 Romain Guy <romainguy@google.com> Allow layers with a stencil buffer to be resized on the fly
Bug #7146141

This change moves the resizeLayer() from LayerCache (where it should
never have been anyway) to Layer. This makes a little more sense.

Change-Id: I8b2f9c19c558e738405a58b9e71ec5799fc6be88
8ce00301a023eecaeb8891ce906f67b513ebb42a 16-Jan-2013 Romain Guy <romainguy@google.com> Implement clipRect with a transform, clipRegion & clipPath
Bug #7146141

When non-rectangular clipping occurs in a layer the render buffer
used as the stencil buffer is not cached. If this happens on a
View's hardware layer the render buffer will live for as long
as the layer is bound to the view. When a stencil buffer is
required because of a call to Canvas.saveLayer() it will be allocated
on every frame. A future change will address this problem.

If "show GPU overdraw" is enabled, non-rectangular clips are not
supported anymore and we fall back to rectangular clips instead.
This is a limitation imposed by OpenGL ES that cannot be worked
around at this time.

This change also improves the Matrix4 implementation to easily
detect when a rect remains a rect after transform.

Change-Id: I0e69fb901792d38bc0c4ca1bf9fdb02d7db415b9
735738c4ddf3229caa5f6e634bf591953ac29944 03-Dec-2012 Romain Guy <romainguy@google.com> Preliminary Support for region clipping

Region clipping, using Canvas.clipPath or Canvas.clipRegion, requires
a stencil buffer to be always present. In addition, extra wiring is
required in JNI and display lists.

This change only adds the necessary JNI/C++ APIs and some extra
plumbing to start the real work on properly supporting region

A new debug define called DEBUG_CLIP_REGIONS can be used to draw
the current clip region. It is off by default, as is region

The default implementation of clipPath() and clipRegion(), now
in native, mimics the previous Dalvik implementation to prevent

Change-Id: I7903e7cfd7412b9b9b622566d4dbfce7bdcec00c
e3a9b24b5e3f9b2058486814a6d27729e51ad466 08-Jan-2013 Romain Guy <romainguy@google.com> Add plumbing for better text scaling

Fonts are now described by a transform matrix. This lead to switching
from a vector to a hashmap. This change therefore adds new comparators
and hash computations to Font.

Change-Id: I2daffa7d6287c18554c606b8bfa06640d28b4530
9acd1b4fa897f3a007dd23dc1f0471b151fa03ad 05-Jan-2013 Romain Guy <romainguy@google.com> Merge "Add visual profiling feature"
672433d90fab7383cd28beac9d4485b566a90940 05-Jan-2013 Romain Guy <romainguy@google.com> Add visual profiling feature

When profiling is enabled with debug.hwui.profile set to true,
setting debug.hwui.profile_visualizer to true will display the
profiling data directly on screen.

Change-Id: I3d5fe3f0347090815087b1cbfce66b8e76d9347b
886b275e529e44a59c54b933453d9bc902973178 04-Jan-2013 Romain Guy <romainguy@google.com> Properly support ALPHA_8 bitmaps in all drawBitmap() methods

Change-Id: I869993c59e0a0d76f369c09acbae711753908f48
dcfc836b457a87881da409e1acf251515f121446 03-Jan-2013 Romain Guy <romainguy@google.com> Remove C++11 related warning

Change-Id: I250ff7bd0ea49908e11b14c995d77312cd09a8b4
5bb3c730f5ebd2a0db1b02a8981c6fdbea6c1a2e 30-Nov-2012 Romain Guy <romainguy@google.com> Apply dev. settings at runtime
Bug #7434649

Change-Id: I16f00eaa8a5eefd9f9849e196cf2cb1659215390
d15321bbf57ff7a4615076fefcee5e196c4fc796 28-Nov-2012 Chris Craik <ccraik@google.com> Use the same interrupt/resume logic for all functor calls


The functor was able to change the renderer's blend mode without it
being restored in process mode. This single path of updating gl caches
reduces likelihood of this occurring in the future.

Change-Id: Ie367532f9c683299f02bc4f635d7cb31f96db39f
7fae5216d24ebe67e22777ab933689dbcbc001b9 01-Nov-2012 Chris Craik <ccraik@google.com> Avoid tesselation path when useCenter is set


The tesselation path doesn't handle sharp joins.

Change-Id: I28bf03f3b72fc584a205daa40934dda17031098f
41308e2936c768103d0e9c82500e97938d6797f1 23-Oct-2012 Romain Guy <romainguy@google.com> Properly draw the window background on window resize
Bug #7385090

This change gets rid of two silly asumptions:
- That a layer needs to be cleared with opaque black (it shouldn't,
it's already cleared to transparent and the view will cover it up
with its own background)
- The the clip should be dirty at the beginning of a frame only
when the render target is opaque

Change-Id: I415b6d3cab196057fb0281419a53fef601a44e28
7c25aab491707f7324f9941b8cfa9bd2b4b97e76 19-Oct-2012 Romain Guy <romainguy@google.com> Defer layer rendering to avoid stalls
Bug #7326824

When a layer is taken out of the cache and initialized it gets cleared
to prepare it for future rendering. This triggers the following sequence
of operations:

attach texture storage to FBO

The clear forces a resolve on tilers which stalls the CPU for a little
while, thus producing jank during animations. This change moves the
clear to the next frame when we know we will have to execute a resolve

Change-Id: Ic1939c25df20ed65a4c48dc81ee549b2cd8b6ec3
b2e2f2470693e78baed20617f989d9a166864ed4 18-Oct-2012 Romain Guy <romainguy@google.com> Take into account the texture layer's transform for clipping
Bug #7370212

Change-Id: Ibdc3161306f54a1cfe66e08458f05ee01a13b1df
1b85122bd22c4528679ae8bd67077dfc2fdf1847 17-Oct-2012 Romain Guy <romainguy@google.com> Merge "Add API to enable mipmaps on Bitmap Bug #7353771" into jb-mr1-dev
713e1bb9df6bdfc21bd5c40d1a6ecf6c822a4be5 17-Oct-2012 Romain Guy <romainguy@google.com> Add API to enable mipmaps on Bitmap
Bug #7353771

This API can be used when scaling large images down to a small size
to get nicer looking results.

Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
a92bb4dc9605c86b8773c929412af2dc242b1fa8 16-Oct-2012 Romain Guy <romainguy@google.com> Support clipping in Canvas.drawBitmapMesh()
Bug #7354162

Change-Id: Ifd1d0b365e8a4d88e0ff0629c9ee13f27e1a7331
780c12875ce0c0d3fd072484d4b8b3c327cc4f31 04-Oct-2012 Chris Craik <ccraik@google.com> HW Acceleration support for stroked arcs with BUTT caps


Change-Id: I7371bfb36cef460da861a47d4d945218c6d0c3d0
b30cb10a0c75c2295e89b1b30d91a73f38ee09fb 06-Oct-2012 Chris Craik <ccraik@google.com> Use offset in line drawing

Partial revert of cb4d6009

Change-Id: I1db7b035e3015e0f6d15c95aef71ea74dbeca13e
cf8675ee176a375f873792684d38a47f78348dff 02-Oct-2012 Romain Guy <romainguy@google.com> Draw stroked rectangle as meshes instead of textures
Bug #7233734

Stroked rectangles were rendered using software generated textures
which would lead to slightly misaligned results. Instead, let's use
the new convex path rendering code that will do the right thing
(and save a lot of bandwidth.)

Change-Id: Ib95ff581e56c1ecead97e4919298e6fd146ca167
bf09ffb4e0dc820aeae56a3e576aed33cab218da 01-Oct-2012 Chris Craik <ccraik@google.com> Quick reject empty paths


Adding a circle of radius 0 to a path is a no-op in skia, so detect
this case both in the PathRenderer, and in quickReject().

Change-Id: I7a172db49a5d5351b4734b39d4e4ca6379658096
a3dc55f83ab583e0a66b893c71b849afa046770a 28-Sep-2012 Romain Guy <romainguy@google.com> Fix a couple of rendering issues
Bug #7253839

1. Make sure we don't make GL calls while recording display lists

2. Disable an early and trivial clip optimization in font renderer
when a perspective transformation is used on the Canvas

Change-Id: I3f1052164239329346854f72d0a0d401fbfecf06
a852ff3a4b637e8101c2f54e110467586fe604cf 28-Sep-2012 Romain Guy <romainguy@google.com> Merge changes I9873540e,I4f6c38e3 into jb-mr1-dev

* changes:
Skia's ColorMatrix vector is in the 0..255 range not 0..1 Bug #7248980
Don't use the QCOM_tiled_rendering extension with functors Bug #7247880
54c1a64d5441a964890b44280e4457e11f4f924a 28-Sep-2012 Romain Guy <romainguy@google.com> Don't use the QCOM_tiled_rendering extension with functors
Bug #7247880

Change-Id: I4f6c38e37b953c58e6107097c613891a49dac766
cb4d6009576cf08195dc23f341a3f4939c0878bb 25-Sep-2012 Chris Craik <ccraik@google.com> Add stroke support to polygonal shape rendering


- Adds support for stroke/strokeAndFill for shapes without joins
- Fixes path-polygonization threshold calculation
- Fixes rendering offset (now only used for points)
- Several formatting fixes

Change-Id: If72473dc881e45752e2ec212d0dcd1e3f97979ea
e529ece37f664f8947a1d4a1e27d679f6f286388 26-Sep-2012 Romain Guy <romainguy@google.com> Applies a layer's color filter even when the layer is a quad
Bug #7238059

Change-Id: Ib4736a419bc1a9a67a01d090516ed049fe3aebca
e83221c547cf2038752e5378e72e49a62cfd9954 25-Sep-2012 Romain Guy <romainguy@google.com> Fix alpha channel computation with ColorMatrixColorFilter
Bug #7222476

There were two issues:
- Blending was ignored with color filters
- The addition vector of a color filter was treated as integer values
instead of float values

Change-Id: Id94065704a30ee8aaaa5724a9f3a3cff7c50ced7
87e2f757be9b24d369bab354e37c276e851b1fc7 24-Sep-2012 Romain Guy <romainguy@google.com> Add a property to disable libhwui's scissor optimization
Bug #7158326

When scissor optimization is enabled, OpenGLRenderer will attempt to
minimize the use of scissor by selectively enabling and disabling the
GL scissor test.
When the optimization is disabled, OpenGLRenderer will keep the GL
scissor test enabled and change the scissor rect as needed.
Some GPUs (for instance the SGX 540) perform better when changing
the scissor rect often than when enabling/disabling the scissor test

Change-Id: Idb68862e287a23358f9188d577ae0f86161902fd
8e586f61dd4f7fa53b01e63ac779ffc7cde05bdd 22-Sep-2012 Romain Guy <romainguy@google.com> Merge "Add support for a new developer setting: overdraw debugging" into jb-mr1-dev
7c450aaa3caac2a05fcb20a177483d0e92378426 22-Sep-2012 Romain Guy <romainguy@google.com> Add support for a new developer setting: overdraw debugging

Change-Id: I350ba4486577c3289f82c20938f7a35138778727
61d37041ac76a95aedb98d3550bb5efa33d898a1 21-Sep-2012 Chris Craik <ccraik@google.com> Merge "Polygonal rendering of simple fill shapes" into jb-mr1-dev
11cb642756093a4af901b1525375b1eb2b5c3e2b 21-Sep-2012 Romain Guy <romainguy@google.com> Update layers in a single batch at the beginning of a frame
Bug #7186819

Change-Id: Ice5926dfedfb3be3a3064e65008dafa2852407da
57b5268708c3b974296c7d4e58a02a957979224a 21-Sep-2012 Romain Guy <romainguy@google.com> Optimize tiling management
Bug #7186819

Change-Id: Iebc42a6e9c96ad5605fbbe1539aa887695d2e829
710f46d9d6a5bf9ea1c1833384caf61e1934124f 18-Sep-2012 Chris Craik <ccraik@google.com> Polygonal rendering of simple fill shapes


Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
2b7028eabac80cec170572bc0e945a1d4224e595 20-Sep-2012 Romain Guy <romainguy@google.com> Add support for QCOM_tiled_rendering
Bug #7186819

This optional OpenGL extension can be used by tiled renderers to optimize
copies from main memory to tiles memory.

Change-Id: Id4a5d64e61ad17f50e773e8104b9bf584bb65077
35643ddc689913f5b5f80ceed864470d987bd6cd 19-Sep-2012 Romain Guy <romainguy@google.com> Minimize state changes when updating layers

Change-Id: I407fcc80bd3178f9f09a3b379ceb7f7ce0749e08
603f6de35f21d74ae242d52d501f4f5c25ff4f4c 15-Sep-2012 Chet Haase <chet@google.com> Fix occasional crash bug with layers

Launcher occasionally crashes with a stack trace indicating that the memory
of a Layer object is corrupt. It is possible for us to delete a Layer
structure and then, briefly, use it to draw a DisplayList again before
that DisplayList gets recreated (without the layer that got deleted).

When this happens, if the memory got corrupted, it's possible to crash.

The fix is to add Layer to the other objects which we currently refcount
(bitmaps, shaders, etc.). Then instead of deleting a Layer, we decrement the
refcount. We increment when creating it, then increment it again when it's
referenced from a DisplayList. Then we decrement the refcount instead of
deleting it, and decrement when we clear a DisplayList that refers to it.
Then when the refcount reaches 0, we delete it.

Issue #6994632 Native crash in launcher when trying to launch all apps screen

Change-Id: I0627be8d49bb2f9ba8d158a84b764bb4e7df934c
45e4c3df6c00ac98ff6144de9af574877d4fff19 12-Sep-2012 Romain Guy <romainguy@google.com> Discard framebuffer commands when we redraw the entire buffer

Change-Id: I32e3014832cbd3bdbace8c3d2206eb20a2002d64
beb8bd0db28d8c5cad2a258f2ba2f3b8b76cf037 10-Sep-2012 Chet Haase <chet@google.com> Reset GL buffer state after functor invocation

Functors in WebView were binding to different buffers than we
assumed in the toolkit, eventually causing a crash due to improper
dereferencing in the currently bound buffer. Fix is to reset state
after invoking functors.

Issue #6666279 Native crash in Currents, mostly on Nakasi

Change-Id: I3697812d83613fffc9193daa99beea4dbf26474a
dc531fa7d4ec545ace1b3daae0849d3101102e49 08-Sep-2012 Chris Craik <ccraik@google.com> Merge "Handle different x, y scales in drawLines AA path" into jb-mr1-dev
75040f8a7727f18bb33da23696a32a0760926ff2 07-Sep-2012 Chris Craik <ccraik@google.com> Handle different x, y scales in drawLines AA path


Fixes different x, y scales, and fixes boundaryWidthProportion to be from
center, not edge.

Also adds drawLine tests that previously drew blurry.

Change-Id: I2b648a60361ad3931eac67647b9b27909525ee1e
d15ebf25c595b855f6978d0600218e3ea5f31e92 05-Sep-2012 Chet Haase <chet@google.com> Enable changing properties of layer paint

Previously, to draw a layered view with a changed Paint object for the
drawLayer operation, you'd have to invalidate the parent view, to get the
native DisplayList to pick up the new Paint properties. This change adds
API and functionality so that the developer can call setLayerPaint(), which
does the proper invalidation (lightweight, doesn't cause redrawing the view).

Issue #6923810 Make it easy to efficiently animate a layer's Paint

Change-Id: I7fea79788d50f6d9c86dd5e5b2a4490cb95142bb
9147cd4ac56d53dec6da1ef13dd04ba1eec1a7df 07-Sep-2012 Chris Craik <ccraik@google.com> Fix m11 to be Y scale instead of X


Fixes different X and Y values resulting in blurry lines/rects.

Change-Id: I3eb244e0cf769efa6b38d08741cf37d0bf62b786
378d131e65348d199db36c21ba7156542bbf0045 06-Sep-2012 Chris Craik <ccraik@google.com> Merge "Varying-based AA rect drawing" into jb-mr1-dev
6ebdc114e0d72137394f02bc8ffe9d7a782a65c4 01-Sep-2012 Chris Craik <ccraik@google.com> Varying-based AA rect drawing

Instead of calculating opacity from relative position in the shader, use a
shader varying to do this computation for us.


Also adds a test to HwAccelerationTest to show incorrect antialiasing in
scaled drawAARect / boundarySize calculation.

Change-Id: Icdc41acb01dc10ce354834f8389a5aed2f439162
d84aaa23a53b57834b0722ad36c460833dc4823c 05-Sep-2012 Chris Craik <ccraik@google.com> Merge "Fix line drawing path to use proportional distance from center" into jb-mr1-dev
8f5ad7657b6c7cdb8927d7da5140602b68b450ac 04-Sep-2012 Chris Craik <ccraik@google.com> Fix line drawing path to use proportional distance from center

boundaryWidth and boundaryLength are now distance from center, instead of
distance from edge, in order to avoid unnecessary calculation in the shader. New
calculation of these matches drawAARect.

Change-Id: I1c7f576a97a6f0ce00d521661fd56fb62e05e6f2
0baaac5e9adf3ee280ae1239e2e58754a9d2b099 01-Sep-2012 Romain Guy <romainguy@google.com> Revert "Revert "Add more support for transformed clip rects and paths""

This reverts commit a8557d2169e14997637f57bc897640c8882d4a46.

Change-Id: I36d4883d548fc47ba6c0b4a42012107d0d2f85a6
a8557d2169e14997637f57bc897640c8882d4a46 01-Sep-2012 Mathias Agopian <mathias@google.com> Revert "Add more support for transformed clip rects and paths"

this introduced a dead lock in GradientCache's ctor.

This reverts commit dfe082f63e94cde9aee271c94d13de5e7217e036.

Bug: 7096001
Change-Id: I57b8bbab11fb7cb502fa58e3bbf5d19864db874f
dfe082f63e94cde9aee271c94d13de5e7217e036 01-Sep-2012 Romain Guy <romainguy@google.com> Add more support for transformed clip rects and paths

Change-Id: I41791b1e1bffef77d503dc9e52428395d2309688
63f2fcae3e7089ce0e27837a5152392d503f41eb 30-Aug-2012 Chet Haase <chet@google.com> Merge "Fix bug with Fbo layer clipping" into jb-mr1-dev
d48885a6c8cd27a8a62552c33b5282e9882e19f6 29-Aug-2012 Chet Haase <chet@google.com> Fix bug with Fbo layer clipping

Rendering views with alpha causes the creation of Fbo layers. These layers
are created at the size of the view, clipped by the current clip rect.
However, if the view lies completely outside the current clip rect, the
Fbo layer is created at the full size of the view and copied into place
outside of its container, causing artifacts like notification items showing
up outside the notification panel.

Fix is to note when the intersect() operation fails and to set an empty bounds
on the layer.

Issue #7069881 Bottom notification sometimes shows below bottom of notification panel shade

Change-Id: Ib52f7c4e503bbe9204cb808755ab269195aa94c1
a798b95a9ef328720febec72d01462cd97e3d4c7 28-Aug-2012 Chris Craik <ccraik@google.com> Use smoothstep to eliminate branches in AA shader

Change-Id: If4ecb1a9446f29b2f8444f5cee551f863c1993e8
8025061c594e5171e1bf370d8fdd77e0e9a02b47 15-Aug-2012 Chet Haase <chet@google.com> Restore scissor state correctly

Chrome is disabling the scissor, which doesn't play well with our
code that assumes that we know the state of the scissor. This fix
sets up our internal state based on the actual state of the scissor
in the resume() function (which is called after any calls out to the
Chrome or Browser GL functor). This fixes intermittent rendering
artifacts, including a gray address bar (where the gray background
gets painted without the clip that is being applied to the text foreground).

Issue #6886339 Address bar in Chrome turns gray after swiping the tabs / favicons drift outside of tab

Change-Id: I3d8a23f4438b41a367336507845baaea90cccc7e
33fa1f774c8e7289fd7c39fbc2c65b9361f2c2c4 08-Aug-2012 Romain Guy <romainguy@google.com> Draw an empty border around glyphs to avoid sampling issues
Bug #6942209

The font renderer was preserving a 1 px border around each glyph to ensure
bilinear filtering would work nicely. Unfortunately, this border was not
set to 0 when glyphs were added in the cache to replace old evicted glyphs.

Change-Id: Ib85afca7ebad5cb63f960dc0e87ae162333dbfe8
4ff0cf4b83605bff630c4e6f1fabe4f72a3f93a1 06-Aug-2012 Romain Guy <romainguy@google.com> Add new debug tool to track hardware layers updates

You can setprop debug.hwui.show_layers_updates true to flash
hw layers in green when they update. This is also a setting
in the Dev. section of the settings app.

Change-Id: Ibe1d63a4f81567dc1d590c9b088d2e7505df8abf
8b4072d3fb9bb49d774d97689a065204beca1752 31-Jul-2012 Raph Levien <raph@google.com> Fix bug 6892600 Font (character pairs) rendering issue

Alignment on paint for actual glyph drawing needs to always be left,
even when drawing centered or right aligned text. The x offset for
alignment is applied by OpenGLRenderer::drawText (and needs to be early
in the pipeline for quickReject to work). Similar change needed for
drawing drop shadow.

Also fixes bug with mispositioned underline (offset for alignment has
already been applied once, no need to do it again in

Change-Id: Id3dcd62de5536a26b158d768889273a1492b35d6
c25259519f1b74bb62a2b051b74537f073436b5c 28-Jul-2012 Romain Guy <romainguy@google.com> Rename drawGeneralText to drawText

Change-Id: I5062ea5b0605fc7af27f410fafc930d10f38e926
996e57c84368058be793897ebc355b917a59abc2 24-Jul-2012 Raph Levien <raph@google.com> Hardware implementation of glyph positioning (bug 5443796)

This implementation adds a drawGeneralText() method to the OpenGL
Renderer, which supports both a global x, y position, an array of
individual glyph positions, and also a length parameter (which enables
drawing of underline and strikethrough. It also adds the method to the
display list (with marshalling and unmarshalling).

With this change, the existing drawText() method is removed entirely, as
it's subsumed by the new method. It's easy enough to revert to the old
functionality if needed by passing in a NULL positions array.

Change-Id: I8c9e6ce4309fd51cc5511db85df99f6de8f4f6f5
00755fed35e4a91291c42a8a47bed8b957e9f8e1 20-Jul-2012 Raph Levien <raph@google.com> Merge "Add drop shadow for drawPosText in hwui renderer."
416a847633680d94efb926837efdc18726d54918 20-Jul-2012 Raph Levien <raph@google.com> Add drop shadow for drawPosText in hwui renderer.

This patch adds support for drop shadows (setShadowLayer) for
drawPosText in the hwui renderer. In and of itself, it's not very
important, but it's on the critical path for correct mark positioning,
tracked as bug 5443796.

The change itself is fairly straightforward - it basically just adds an
extra "positions" argument to all draw and measure methods on the code
path for drawing drop shadowed text, as well as to the cache key for
cached shadow textures.

Change-Id: Ic1cb63299ba61ccbef31779459ecb82aa4a5e672
04299385c681140239b0dc31d9780d087d2b4d7c 19-Jul-2012 Romain Guy <romainguy@google.com> Clip lines, AA rects and points correctly

Change-Id: I900dd986f397b66f133e6021aa4c2539e7abc2b9
8a4ac610e1aaf04931ac1af54b146a7fc8e66114 18-Jul-2012 Romain Guy <romainguy@google.com> Don't clear the dirty clip flag if it's not applied
Bug #6833979

Change-Id: I0ea78b7f31a557a335de10d910d03b0520029080
4121063313ac0d6f69f6253cac821d0c1c122086 17-Jul-2012 Romain Guy <romainguy@google.com> Add shader-based text gamma correction

To enable it, the system property ro.hwui.text_gamma_shader must be
can be set to 1 in libhwui/Debug.h.

Change-Id: If345c6b71b67ecf1ef2e8847b71f30f3ef251a27
be6f9dc1e71b425b7ac1c40c0a2c72d03eb9fbee 16-Jul-2012 Romain Guy <romainguy@google.com> Don't copy paints for 9patches

Change-Id: I863100a0dc53fec1a3a1b2acbdeb76e6049ffe58
b1d0a4ed21168fefcb82232c8f22cb95d60acb85 14-Jul-2012 Romain Guy <romainguy@google.com> Refactor GammaFontRenderer

This change is the first step to a shader-based text antialias
gamma correction.

Change-Id: I9eb02d4c56cb95d05219f712290c865b46141954
586cae3ac69c0c667fbf8a954edbd399f620a717 14-Jul-2012 Romain Guy <romainguy@google.com> Improve rendering speed by disabling scissor tests

This change improves execution of display lists, particularly on
tiled renderers. The goal is to disable the scissor test as
often as possible. Drawing commands are rarely clipped by View
bounds so most of them can be drawn without doing a scissor test.

The speed improvements scale with the number of views and drawing

Change-Id: Ibd9b5e051a3e4300562463805acc4fd744ba6266
9c0b188e4231bcb967234f3646c178d22d8a9f50 13-Jul-2012 Romain Guy <romainguy@google.com> Text shadow alpha handling incorrect

External bug: http://code.google.com/p/android/issues/detail?id=34879

This CL also fixes a bug where a View's alpha would be applied twice.

Change-Id: I13a1546228f44d4c169259414b6fa103a6e4a0fa
f877308f77f7c6f3edd91618a092207dd3be9077 13-Jul-2012 Romain Guy <romainguy@google.com> Remove obsolete optimization

Change-Id: I2d43c009c62a7f4a4a2e0a6303bdfa692c4b8c8c
16c88085255c71a1a8fc034129aa2dcc61e1ddd0 12-Jun-2012 Romain Guy <romainguy@google.com> Textured text calls could be invisible
Bug #6597730

Text would sometimes not appear when rendered with textured content
(BitmapShader, LinearGradientShader, etc.) This was due to a misuse
of OpenGL texture unit in FontRenderer. Textured text normally uses
two texture units:
- texture unit 0 for the font cache
- texture unit 1 for the textured content (gradient, etc.)

Recent changes to the font renderer allow it to bind new textures
while processing the text's geometry (this happens when caches get
full or when switching font size for instance.) The bindings were
done without ensuring the texture unit was the correct one
(unit 0), thus replacing the content of another texture unit
(unit 1).

This lead to text being drawn using the font cache itself as the
content texture, making the text invisible.

Change-Id: I392b4c884f09223305f6cbc6253e2ef9a98944c9
44b2fe3fc114ee5f7273c6b0fee2cc999bf244a2 07-Jun-2012 Chet Haase <chet@google.com> Track canvas clearing for swap buffers logic.

A previous fix made it necessary for a frame to render something to GL
in order to cause a call to eglSwapBuffers(). Besides the calls being
tracked as part of issuing a DisplayList, there is also a potential call
to clear the canvas (via glClear()) on non-opaque surfaces. This call is also
good to track, since a surface that gets cleared without any other drawing operations
is worth flipping to the screen (to erase old contents on that surface).

This fix tracks the status of the pre-draw operations to find out whether
glClear() was called and then sets the drawing status appropriately.

Issue #6606422 QuickContact dismissal is janky again (Tracking)

Change-Id: I5fcaccfdc9293dd46b83f2fc279730a5d2740ebf
932b7f6765968bd526c03512f3805fbc3924dc29 06-Jun-2012 Chris Craik <ccraik@google.com> Revert "Add more temporary logging for investigating detachFunctor"


This reverts commit 8857b2f76abad1e4ec742dfd85d0c997880be376

Change-Id: I1563b5974c52b84201ae448298f804eb0dcc235d
8857b2f76abad1e4ec742dfd85d0c997880be376 05-Jun-2012 Chris Craik <ccraik@google.com> Add more temporary logging for investigating detachFunctor

Change-Id: Ic9e34e323b12a887f2e8df0773a6155627b6a64f
486590963e2207d68eebd6944fec70d50d41116a 01-Jun-2012 Chet Haase <chet@google.com> Skip eglSwapBuffers() call when we do not draw to GL

The fix is to track when we issue GL drawing commands, and to skip the
call to eglSwapBuffers() when a DisplayList does not result in
any actual rendering calls to GL.

Issue #6364143 QuickMuni list items and buttons flicker instead of fade

Change-Id: I60a02c61a58c32d92481a1e814b4c8a49c6a37a3
3534e13486a0081b1229e698f13bd3a37efa3fb0 23-May-2012 Chris Craik <ccraik@google.com> Merge "Avoid crash if onDetachedFromWindow called after destroy" into jb-dev
9e08012869f77f212186a5d5856831a85fb73d40 23-May-2012 Chris Craik <ccraik@google.com> Avoid crash if onDetachedFromWindow called after destroy

This also removes the temporary logging from commit

Change-Id: Icf1d0438b349a0e92e7d9cefed57a252eed2b9b0
7a9328a3118725389564fe2a9b926837fa3d58a9 22-May-2012 Chris Craik <ccraik@google.com> Merge "Add temporary functor lifetime logging" into jb-dev
e5a4a3dc1648844f06d29efd42c9306c3cdf177e 22-May-2012 Romain Guy <romainguy@google.com> Merge "Ensure we always set the proper blending mode Bug #6527305" into jb-dev
f8dafa14e058cdc2f408b59be7911abaceb73c47 22-May-2012 Chris Craik <ccraik@google.com> Add temporary functor lifetime logging


Change-Id: Ida5cc1def7fe1fc314317bbc5df50e1465753deb
ddf74373616c89e0880a28a2185fd7ce3db91de6 22-May-2012 Romain Guy <romainguy@google.com> Ensure we always set the proper blending mode
Bug #6527305

At the beginning of a frame, always set the blending mode that we
think GL is using just in case it was modified by another entity
(for instance a WebView functor.)

Change-Id: I0e1d0abee8a2abb2b8e7622aed28346e89562c06
c8538ade8df2c2f013f8b93094912057ee1cc417 22-May-2012 Chris Craik <ccraik@google.com> Don't clear the functor at every draw

instead clear functors at invoke time, and let them detach themselves as needed.

Change-Id: I9115fcadffb27eb850c1d1773c098d3d2e22788b
49c5fc0b9e850497233e189ff9dcc71a78ebe6e7 15-May-2012 Romain Guy <romainguy@google.com> Avoid unnecessary copy when invoking drawBitmap(int[])
Bug #6483390

Change-Id: I4d2d725ef50c9401b4bd998b6160128102b40745
e651cc6239616a202f6e96ebc2ed93b4b8b3627c 15-May-2012 Romain Guy <romainguy@google.com> Remove all Dalvik allocations from Cavnas.drawBitmap(int[], ...)

Change-Id: Ie28538a2104d21154fdc78a56525e7403f08287d
12d434a9be03214e9c673580a6f55128eec9b3f9 08-May-2012 Chris Craik <ccraik@google.com> Revert "Add temporary functor lifetime logging"


This reverts commit 2fe99801e81bb7c0ff846b536cbb7a12707410ed
2fe99801e81bb7c0ff846b536cbb7a12707410ed 02-May-2012 Chris Craik <ccraik@google.com> Add temporary functor lifetime logging


Note: revert once the above bug is verified fixed

Change-Id: Iae04ec6ffa73a2711f96e128d60011bcb5864b5c
8bd12ea8001f72f4450e318e43c50dbc46b4869c 26-Apr-2012 Romain Guy <romainguy@google.com> Merge "Decode common GL error codes when logging frame error status" into jb-dev
a44a63ac5c29b2cc57df95ec495def8cdddd9c6f 26-Apr-2012 Romain Guy <romainguy@google.com> Decode common GL error codes when logging frame error status

Change-Id: I38b333eea53aef20340ce48dfcb0dd30a223f7a8
a75fbc3c76dfe6a1c678b66f83cef878e3f3cdf4 26-Apr-2012 John Reck <jreck@google.com> Merge "On new content, attach functor directly" into jb-dev
c189ef53220059acf2adedc92ac4ac7e6a993e6b 26-Apr-2012 Romain Guy <romainguy@google.com> Ensure we start every frame in the proper GL state
Bug #6345013, #6314960

Change-Id: I6985f7f233eb6a5f9223e9f4be3f323154b5dbf0
c2c9543c135ffc4e18c7db0e817112ac03e3e97a 26-Apr-2012 Chris Craik <ccraik@google.com> On new content, attach functor directly


depends on external/webkit change: https://android-git.corp.google.com/g/#/c/184314/

Change-Id: Ibdf997f3ee4f5c5c1ea5a320556813f175fea93f
3d745c03ace18ee59c539e1b7f1df13f22beb57d 24-Apr-2012 Romain Guy <romainguy@google.com> Fix the build before the bot yells at me.

Change-Id: Ice7fe02b684ad662262aae3cac7a48a835ebcad5
ba6be8a62dcdb3ffd210cd36b9af4e3a658eac47 24-Apr-2012 Romain Guy <romainguy@google.com> Prevent WebView from crashing when detached from the window
Bug #6365056

WebView enqueues a functor in the hardware renderer to handle
animations and this functor is called at a later time by the
hardware renderer. However, the functor was not removed from
the queue when WebView was removed from the window. This could
cause the hardware renderer to attempt to execute an invalid
functor and lead to a crash.

Change-Id: I9d38e80f3fdc5e29d4d0cdfa1e893c251a954508
1271e2cc80b01d577e9db339459ef0222bb9320d 20-Apr-2012 Chet Haase <chet@google.com> Remove USE_DISPLAY_LIST_PROPERTIES flag

This flag was still hanging around pending any need to disable
DisplayList properties. But things seem stable, so it's time to clean up
and simplify the code.

At the same time, I reduced redundance in DisplayList dimensions. We
used to call drawDisplayList() with width/height parameters that were
used to do a clip reject. This is redundant with the DisplayList properties
that set the bounds of the DisplayList; the left/right and top/bottom properties
represent the same width/height properties formerly used in drawDisplayList().
The new approach is to not pass dimensions to drawDisplayList(), but to
instead pull those dimensions directly from the DisplayList when needed.

Change-Id: I8871beff03b1d4be95f7c6e079c31a71d31e0c56
a23eed808a1ae4ec0d818c0a9238385e797fd056 13-Apr-2012 Chet Haase <chet@google.com> Fix layer blending bug

Cached layers were sometimes retaining an obsolete blending
value, causing artifacts where translucent objects were disappearing
completely. Also, added extra tracing info for DisplayLists.

Issue #6303668 Flickering views during SwipeHelper drag

Change-Id: I66ce158652c4a3ed316040585b40b1744e1fad0c
7b6a75872bd2df96a23453d31c2e2e7fcc373554 11-Apr-2012 Chet Haase <chet@google.com> Pass width/height parameters to webview

When webview draws into an fbo layer, it needs to know the
size of that surface to create the rendering transform appropriately.
This change copies in the current viewport size to the structure that
is passed to the webview.

Change-Id: I7160b0836d00834134c799c95a439cdc045e2035
65924a3e56c2e7ac863f8e25e9f9a58b9db7d513 06-Apr-2012 Chris Craik <ccraik@google.com> fix functor flag parsing, tweak process delay

Change-Id: I0a679cc33f92ff6fd2e33db9ad58b52622def012
fda531c9e4e49cfd962d3784b3501f6a1e64dc22 04-Apr-2012 Romain Guy <romainguy@google.com> Merge "Disable AA lines vertex attrib arrays after rendering"
7b63142d2f4bc32beacedcc761453b8aea1f3a86 04-Apr-2012 Romain Guy <romainguy@google.com> Disable AA lines vertex attrib arrays after rendering

Change-Id: I2f035e9d87f4f97bc1e37355c84570fd58df0374
8c8c2400923bd5b0ab1f52adc4f2232dbf690d91 04-Apr-2012 Romain Guy <romainguy@google.com> Merge "Optimize FBOs composition"
e0aa84b7dc087e999e20055dcc04cb6a48d5bd62 04-Apr-2012 Romain Guy <romainguy@google.com> Optimize FBOs composition

Change-Id: Ifc8eada8922509373c0e4c3b2ed75b6f08d098de
db8c9a6a4d9bf8c39f834b25611926caf21380f6 22-Mar-2012 Chet Haase <chet@google.com> Optimization of alpha with DisplayList properties

Some views (such as ImageView and TextView) handle non-opaque alpha
values directly. This was originally an optimization, but we can handle it faster
in many cases without this optimization when DisplayList properties are enabled.
Basically, if a view has non-overlapping rendering, we set the alpha value directly
on the renderer (the equivalent of setting it on the Paint object) and draw each
primitive with that alpha value. Doing it this way avoids re-creating DisplayLists
while getting the same speedup that onSetAlpha() used to get pre-DisplayList properties.

Change-Id: I0f7827f075d3b35093a882d4adbb300a1063c288
e2eaf6997d429249904f842092b075f3da92c5be 03-Apr-2012 Romain Guy <romainguy@google.com> Merge "Prevent crash when flushing the layers cache Bug #6258973"
5c88fc744db977ef26887df9605beaa409394806 03-Apr-2012 Romain Guy <romainguy@google.com> Prevent crash when flushing the layers cache
Bug #6258973

When flushing the layer caches we would attempt to delete the FBOs
associate with layers in the cache. The FBO property was however not
always properly cleared when recycling layers.

Change-Id: I7dedfe391d659a0849f1e1d84df17313b2c6e2b2
8f3b8e32993d190a26c70c839a63d8ce4c3b16d9 28-Mar-2012 Romain Guy <romainguy@google.com> Allow fine-grained control over functors execution

Adds non-drawing execution mode

Change-Id: I82f92cf1b9a3b9ff2ca6d7427c4e02b73e04e6bf
b85967b9af76e1e60f7a96603e2567a6449d2e04 26-Mar-2012 Chet Haase <chet@google.com> Re-enabling DisplayList properties

Several issues came up after DisplayList properties were enabled,
so they were disabled pending fixes. Those issues have been fixed, so
DisplayList properties are once again being enabled by default. This
CL both re-enables these properties (in View.java and DisplayListRenderer.h)
and fixes the various issues that enabling them caused the first time around.

Related issues (all currently marked as Fixed, though that was simply because
DL properties were disabled - this CL provides the real fixes now that
DL properties are enabled by default):
Issue #6198276 Text input broken
Issue #6198472 Native crash at pc 00076428 in many different apps in JRM80
Issue #6204173 Date/time picker isn't rendering all parts of UI
Issue #6203941 All Apps overscroll effect is rendered weirdly/has flickering
Issue #6200058 CAB rendering issue - not drawing items?
Issue #6198578 Front camera shows black screen after taking picture.
Issue #6232010 Layers not recreated when children change (DisplayList properties)

Change-Id: I8b5f9ec342208ecb20d3e6a60d26cf7c6112ec8b
6554943a1dd6854c0f4976900956e556767b49e1 27-Mar-2012 Romain Guy <romainguy@google.com> Use a status_t return type for GL functors

WebView needs more fine-grained control over the behavior of the
framework upon execution of the display lists. The new status_t
allows WebView to requests its functor to be re-executed directly
without causing a redraw of the entire hierarchy.

Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
a1cff5043d0fbd78fcf9c48e7658e56a5b0c2de3 21-Feb-2012 Chet Haase <chet@google.com> Handle view properties at the native level

Basic functionality of handling View properties (transforms,
left/right/top/bottom, and alpha) at the native DisplayList level.
This logic is disabled for now (via compile-time flags in View.java and
DisplayListRenderer.h) as we continue work on it (there is no advantage
to the new approach until we optimize invalidation and rendering paths
to use the new code path).

Change-Id: I370c8d21fbd291be415f55515ab8dced6f6d51a3
55fd2c9b2e87986b03cb58676bdf46bc6d5f1c36 10-Mar-2012 Romain Guy <romainguy@google.com> Don't bind data to missing uniforms

Change-Id: Ib9d1f14eb0bef04e0910baa4eaf3e49cce81c0ce
2bf68f063b0077ddef6ebfe54f2ae5e063c2c229 02-Mar-2012 Romain Guy <romainguy@google.com> Deferred layer updates

Change-Id: I83d9e564fe274db658dcee9e0cc5bbf9223ebb49
dd7c8e4c68205d39109d4317dd0c9b05ed43e8e5 01-Mar-2012 Romain Guy <romainguy@google.com> Small tweak to Canvas.drawPath() GL implementation

Change-Id: I1d668a912996e1267bcf2127058888e489a2d9b3
9777173eb6c9eb97c7921c8288ebc65e3ab3ce6f 29-Feb-2012 Romain Guy <romainguy@google.com> Full implementation of Canvas.drawPath()

Change-Id: I23223b89770a0cd2b4762365bead9bfddb094290
03d58520c3eb6bb7efb7235bfd957550533d6725 25-Feb-2012 Romain Guy <romainguy@google.com> More infrastructure for Canvas.drawTextOnPath

Change-Id: Iff42b24e342650d06fa4e2fa9db6c28da820ff01
325740fb444af8fc7fb0119b2e30ce322c2ae134 25-Feb-2012 Romain Guy <romainguy@google.com> Add hooks to implement Canvas.drawTextOnPath() in GL

Change-Id: I165c9e05facf5365aa6850605688e538640c7fcc
33f6beb10f98e8ba96250e284876d607055d278d 17-Feb-2012 Romain Guy <romainguy@google.com> Record possible clip rejects when recording display lists

This optimization allows us to quickly skip operations that lie
entirely outside of the known bounds of a display list. Because
of ViewGroup.setClipChildren, we must keep the operations recorded
in the display list. setClipChildren(false) is however a very
uncommon operation and we will therefore often benefit from this
new optimization.

Change-Id: I0942c864e55298e6dccd9977d15adefbce3ba3ad
211370fd943cf26905001b38b8b1791851b26adc 02-Feb-2012 Romain Guy <romainguy@google.com> Add optional metadata to initiliaze the render threat.

The render threat is likely to break your application if you initiate it.
As such it must be explicitely requested using the following meta-data
tag in your manifest's application tag:

<meta-data android:name="android.graphics.renderThread" android:value="true" />

Change-Id: Ibf0a48af2a0d091562bf6907eac970e3d1d601c4
13631f3da855f200a151e7837ed9f6b079622b58 31-Jan-2012 Romain Guy <romainguy@google.com> Add debug markers to OpenGLRenderer

These markers will be used to group the GL commands by View in the
OpenGL ES debugging tool. This will help correlate individual GL
calls to higher level components like Views.

Change-Id: I73607ba2e7224a80ac32527968261ee008f049c6
530041d3191ce817832a0108514617768e43cda6 26-Jan-2012 Romain Guy <romainguy@google.com> Add stencil buffer to the EGL config

Change-Id: If76c0cd6127534d90f9526b75c0f8e56259c6722
5ff9df658230d49e42c43586997a02d8e4dd417e 24-Jan-2012 Romain Guy <romainguy@google.com> Add full support for Canvas.setDrawFilter()

Change-Id: I0ad35d0603c4eeda469014803be14c1dcdde918c
671d6cf460531825a321edb200523d0faa7792c9 18-Jan-2012 Romain Guy <romainguy@google.com> Full support for Canvas.drawPosText

This also introduces a small optimization when rendering text.

Change-Id: Iff620ac97bf878eaac406bccc6daa07052c93890
eb9a5367e8f0e970db8509ffb2584f5376bc62ed 18-Jan-2012 Romain Guy <romainguy@google.com> First pass at implementing Canvas.drawPosText() in GL

Change-Id: Ia3ac347e95d57eb86c63045156c8dbc0572b03cb
3762c311729fe9f3af085c14c5c1fb471d994c03 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
5baa3a62a97544669fba6d65a11c07f252e654dd 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
82bc7a772747fcf8a6fe7097f70bf2981429ffe9 03-Jan-2012 Romain Guy <romainguy@google.com> Properly restore the GL scissor after a GL draw functor
Bug #5781254

Change-Id: I1dc4809563a793b6b579814951d4d73b4c34bf32
8f85e80b64b89fd38cc23b129f61ec36ddde7f15 15-Dec-2011 Romain Guy <romainguy@google.com> Generate even fewer GL commands

Change-Id: I0f4dcacb03ef5ee7f6ebd501df98bfead5f0a7f8
2d4fd364843d3efc6e6ee59ccc5beb513a86d789 14-Dec-2011 Romain Guy <romainguy@google.com> Reduce the number of active texture changes

Change-Id: I94046bdfe20740c26c8183822e3002d692fde7c4
a1d3c91afbd52c7e8b01f4a9060c5459f02ae7a5 13-Dec-2011 Romain Guy <romainguy@google.com> Further reduce the number of GL commands sent to the driver

Change-Id: Id922b2a166ea4573b767c27d3195e11c70320b23
15bc6437f8b4cf10dba55c7638d349e7b9563f4f 13-Dec-2011 Romain Guy <romainguy@google.com> Reduce the number of GL commands generated by the UI

This optimization along with the previous one lets us render an
application like Gmail using only 30% of the number of GL commands
previously required

Change-Id: Ifee63edaf495e04490b5abd5433bb9a07bc327a8
f3a910b423db7ad79cf61518bdd9278c048ad0d8 13-Dec-2011 Romain Guy <romainguy@google.com> Optimize state changes

Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
d71dd367af604571c7d00ca473184a1b9240eca2 13-Dec-2011 Romain Guy <romainguy@google.com> Minimize the amount of data uploaded to draw text

Change-Id: I6313ac039291c9cd93aadafe3566ad9d60cab42d
39d252a6632d057d5077f7eaf1b8ed7a142f3397 13-Dec-2011 Romain Guy <romainguy@google.com> Various OpenGL optimizations

Change-Id: Ib0742c96f10f5f50e7e5148b742c31b6c232d127
3e263fac8c9c0e0fb242186b514a7af8efb40961 13-Dec-2011 Romain Guy <romainguy@google.com> Keep shaders to render properly

I don't know who's to blame, SGX or Tegra2 but one of those two GPUs is not
following the OpenGL ES 2.0 spec.

Change-Id: I2624e0efbc9c57d571c55c8b440a5e43f08a54f2
9c4b79af221b53f602f946faa9ff317a596a0c39 11-Nov-2011 Romain Guy <romainguy@google.com> Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: Ie30700a29059d2ea60eb7bd3f8bd20ac48a149ab
8f9a9f61ab793d9387a5942b307e74324704893b 05-Dec-2011 Romain Guy <romainguy@google.com> Clip text correctly
Bug #5706056

A newly introduced optimization relied on the display list renderer
to properly measure text to perform fast clipping. The paint used
to measure text needs to have AA and glyph id encoding set to return
the correct results. Unfortunately these properties were set by
the GL renderer and not by the display list renderer. This change
simply sets the properties in the display list renderer instead.

This change also improves the error message printed out when the
application attempts to use a bitmap larger than the max texture

Change-Id: I4d84e1c7d194aed9ad476f69434eaa2c8f3836a8
cac5fd3e09e9dc918753d4aff624bf29a367ade3 02-Dec-2011 Romain Guy <romainguy@google.com> Faster text clipping

Change-Id: I03a00c4261d81a416b1ad7b86ce2d432c71908b4
d21b6e1fe337b35f62cf2028e9bd0637fd009a75 01-Dec-2011 Romain Guy <romainguy@google.com> Optimize away unnecessary state changes

Change-Id: I0f6816f9f6234853575ecee5033186ad19e76380
d3ea6b40bb8f0fbc2a877963db1ab4fa0fc02b2f 29-Nov-2011 Chet Haase <chet@google.com> am 38928899: am 8990cb57: Merge "Fix flashing wifi dialog after rotating back from landscape." into ics-mr1

* commit '3892889952b0ad3fa0b095c96d8ae2ae110585e2':
Fix flashing wifi dialog after rotating back from landscape.
08837c246c9c27902c59b41c8661c2f27a4aa2bc 28-Nov-2011 Chet Haase <chet@google.com> Fix flashing wifi dialog after rotating back from landscape.

There was an error in some of the OpenGL layer logic such that we would
occasionally set up a layer for rendering and then not clean up when it was
done. This caused future OpenGL rendering to go into that layer instead of
to the buffers being displayed on the screen, resulting in artifacts including
flashes and displaying of stale content. This happened specifically when
using the wifi settings dialog with the InputMethod keyboard displayed,
but it was probably visible in other situations as well.

Issue #5628248: Flickering/flashing after entering password for WiFi

Change-Id: I38139f620b310f4309570fa7224552d2ee633999
c28e574037b2bfc8c2ea24593299aa20ae9078f8 22-Nov-2011 Romain Guy <romainguy@google.com> am a2fabf4a: am 303a0695: Merge "Draw in the correct FBO after invoking a GL functor Bug #5650514" into ics-mr1

* commit 'a2fabf4a109d46f99ff7370aa05e48c1708c2838':
Draw in the correct FBO after invoking a GL functor Bug #5650514
421458aad764cd9d1403d2540ab979b336b02341 22-Nov-2011 Romain Guy <romainguy@google.com> Draw in the correct FBO after invoking a GL functor
Bug #5650514

After invoking a GL functor, libhwui restores a few OpenGL states
including the current FBO. The renderer was however making the
wrong assumption that the FBO to restore to was the base layer
instead of the FBO associated with the current canvas state.

Change-Id: Ie565500832ebffd673f6a43b83422d6cc05470a0
28a5ec9613a824d2ec15ce5e5cec77a6fcf444d5 14-Nov-2011 Dave Burke <daveburke@google.com> am 2cfb873c: am 9d66da8a: Merge "Revert "Discard framebuffer rendering queues when discarding layers"" into ics-mr1

* commit '2cfb873c9f0b56f2c7d694a21c968511223933af':
Revert "Discard framebuffer rendering queues when discarding layers"
7077506f9945b87b02bdd47ffce75a5b813c821c 14-Nov-2011 Dave Burke <daveburke@google.com> Revert "Discard framebuffer rendering queues when discarding layers"

This reverts commit da96f8ac2c1c35a54f3f36e6d776cb386a251d03.
3f511aaf1cb9dfa69e2f4225a5bd41bec0864cc7 14-Nov-2011 Mathias Agopian <mathias@google.com> am a16ee939: am 28587497: Merge "Discard framebuffer rendering queues when discarding layers Bug #5581817" into ics-mr1

* commit 'a16ee9390e1fcea8ff7cbefd253659c37f2999a3':
Discard framebuffer rendering queues when discarding layers Bug #5581817
da96f8ac2c1c35a54f3f36e6d776cb386a251d03 11-Nov-2011 Romain Guy <romainguy@google.com> Discard framebuffer rendering queues when discarding layers
Bug #5581817

Change-Id: If612846ec5f7793710fc4df152791fb32c506551
ef9bb3c3ea3aa08071ea0c32a505b379c322e5b5 17-Oct-2011 Fabrice Di Meglio <fdimeglio@google.com> Fix bug #5438102 Double Arabic harakat overlap instead of stack In TextView

IMPORTANT: this change needs two patches for Harfbuzz:
- one concerning hb_utf16_script_run_prev() which was not returning the correct "previous" script
- one for the "script_properties" table that was missing Arabic code point ranges and declaring
HB_Script_Inherited instead of HB_Script_Arabic

The current change is doing the following:
- pass the correct typeface for Harbuzz shaping (depending on the script of the run)
- offset correctly the glyphIDs returned by Harfbuzz

We need to offset the glyphsID as Harfbuzz will return local glyphIDs (meaning in the
local range of the font used for shapping).

We then cannot use those glyphIDs when we are using a fallback Font (Arabic, Hebrews...)
because the FontRenderer needs glyphIDs in the range of all the Fonts (including the fallbacks)

Change-Id: I494897435bbc59293b02392ee2059cebcdf0e571
e707859415f4c8e1c01228dfaa58fb0a690d442e 28-Oct-2011 Romain Guy <romainguy@android.com> Load identity matrix when calling Canvas.setMatrix(null)
Bug #5446826

Change-Id: I3a7817f266b17e9abe948500816d629edd9a2822
2ffefd48e20d311b38c0673edadb27c1f6ad328b 09-Sep-2011 Romain Guy <romainguy@google.com> Add support for 3 new blend modes when blending with framebuffer:

Change-Id: I92a3c2612c86613087568bf0c03cc6f92b5ded44
8a3957d43bcae93fbb9f6b4b4c3de8abdb3c953c 08-Sep-2011 Romain Guy <romainguy@google.com> Add reminder in the code to fix T-junctions

Change-Id: I52b112694f930e641f01fb78dc55412986023411
04c9d8c2ffd028c35c750bac0a4a7b79e48059b5 25-Aug-2011 Romain Guy <romainguy@google.com> Optimize display lists

Remove redundant or useless operations

Change-Id: If989b4eaa9143eef4254c38b39959aeed1f2b9ab
631582f7f7a3c879a5fba81f2bc082e4826758aa 24-Aug-2011 Romain Guy <romainguy@google.com> Enable linear filter when scaling bitmaps
Bug #5205673

Change-Id: I8b0f90877df6b6c6757d35dcf6cd14e79e840b96
6816972eb69ee8b294553dac92b3c1ad5b1ca1f7 23-Aug-2011 Romain Guy <romainguy@google.com> Don't use bilinear filtering on unscaled bitmaps
Bug #5198590

Change-Id: I4333d850501ac849eeeeb247e4178dd469b9de3d
302a9df1d50373c82923bb84ff665dfce584fb22 16-Aug-2011 Romain Guy <romainguy@google.com> Add an API to set the transform on a TextureView's surface texture.
Bug #5156689

Change-Id: I635a625885c9b832a60d44ece0de7613ceb84109
9d865512f1a39bac6bed612b24023213d5a1fb1d 12-Aug-2011 Romain Guy <romainguy@google.com> Remove unnecessary private API

Change-Id: I2ecb367528ec0691c07153a3d163b82a6ca33fdf
b50149825fae95b2918bcf67b2ddb773b9797068 29-Jul-2011 Romain Guy <romainguy@google.com> Correctly apply linear filter to drawBitmap(Rect, Rect)

Change-Id: I1049282e1996b1020c92cb7bec46e9f28e94e967
e3c26851dc315b730ea0fe5ef35bb1db81f6d675 26-Jul-2011 Romain Guy <romainguy@google.com> Improve rendering performance on some GPUs

This change sets textures filtering to GL_NEAREST by default. GL_LINEAR
filtering is only used when textures are transformed with a scale or
a rotation. This helps save a couple of fps on some GPUs.

Change-Id: I1efaa452c2c79905f00238e54d886a37203a2ac1
f2fc460a9512500d9d5749fbaada88903d8e3b22 20-Jul-2011 Romain Guy <romainguy@google.com> Reduce the fade area to save bandwidth.

Change-Id: I8ccea17fc1fb3c132329baa0acc1b3d5a140a5c6
b2479153b743df9e54f7e17c7132a5ecd87fa453 08-Jul-2011 Romain Guy <romainguy@google.com> Correctly position layers.

Change-Id: I1678b1c5bdab140b44e56556c50ab8329255f18a
ec19b4a764d512091a780fc93ced567dfbf80914 08-Jul-2011 Romain Guy <romainguy@google.com> Use NEAREST filtering mode for TextureView.getBitmap().

Change-Id: I4649062bbdf18ebba7924bdf578f39ad8f6576ac
9ace8f5e79e76893fe4ca9e4d10f6c4056330485 08-Jul-2011 Romain Guy <romainguy@google.com> Use NEAREST filtering for layers whenever possible.

Change-Id: Id5bee1bd4a322cf93e8000b08e18f1e1b058648e
a9489274d67b540804aafb587a226f7c2ae4464d 23-Jun-2011 Romain Guy <romainguy@google.com> Add the ability to specify the opacity of a TextureView

TextureView assumes its content is opaque by default.

Change-Id: Iba873423566a5b67c388081838bd910dceba32ba
d6b2a00dd43257d1498b09175bff63663f6cb861 18-Jun-2011 Romain Guy <romainguy@google.com> Add error checking to LayerRenderer::copyLayer

This method is invoked by TextureView.getBitmap() and failures must be
caught to avoid leaving the GL context in a potentially bad state.

Change-Id: I620de395ba1bc20154de58c81963223dc55cac78
54be1cdf3d63095512120fa7ced5c16e462abffa 14-Jun-2011 Romain Guy <romainguy@google.com> Batch glCopyTexImage() calls to get about 15 fps back on SGX.

Change-Id: I04079e070739c1e46df3e90fc388c335e2a7d2b9
181d0a6ccedee03789919d53c46540a8df751896 10-Jun-2011 Romain Guy <romainguy@google.com> Don't apply AA to rects with no rotation/perspective.

Change-Id: I21138d4d0589cc28f1dcffb8b675cd81a9900e24
67ffc36a79ce3a9a0b5da28b65123864b7d2597f 04-Jun-2011 Romain Guy <romainguy@google.com> Measure text with the appropriate text encoding.
Bug #4546327

Change-Id: I8eb593b03a81145e08be92579706ddd775feb0a2
726aeba80ffc6778a9bc3e0ee957b8d644183505 01-Jun-2011 Romain Guy <romainguy@google.com> Add support to OpenGLRendere to draw BiDi text.
Bug #4350336

Change-Id: I1cf31693f7ca9653fa3a41b5b91c27ef288d680f
f09ef51889f75289b041f9e9f949b7b82ed5b686 27-May-2011 Romain Guy <romainguy@google.com> Fix issue with drawColor(color, Mode.Clear)

Change-Id: I486b24a5b609c6f8adb0276037ddb24af2b888b2
1e59f9d10d164f156221f6d34b932f06cdd29f1f 27-May-2011 Romain Guy <romainguy@google.com> Fix texture coordinates for sub-bitmap rendering.

Change-Id: I05a31775e03f5b223a55a5144d420351abac89be
f504a2fa144504ca1efd39a4ef9208e3d4d336c5 27-May-2011 Romain Guy <romainguy@google.com> Correctly implement the CLEAR xfermode.

The previous implementation was using glBlendFunc with the parameters
GL_ZERO/GL_ZERO which doesn't work for text, paths and other alpha
sources (anti-aliasing.) The correct implementation is GL_ZERO/

Change-Id: I4cca65e57b6a37bbf5a41d382cb0648ee8e11e79
d39d1affe82cb8c21d32baaa5fbb2d6afb806f8e 16-May-2011 Derek Sollenberger <djsollen@google.com> Updates resulting from the Skia merge (revision 1327)

Change-Id: I2a8f5869dbe95bb594f2ba5d7278f9b330e6f17a
9dec462c1f522533620be3c70f2fc60e69368c1a 13-May-2011 Fabrice Di Meglio <fdimeglio@google.com> Merge "Prepare OpenGLRenderer to use glyphs from TextLayoutCache"
2ea75880142152b3a9993cb245754d73c05749a7 13-May-2011 Fabrice Di Meglio <fdimeglio@google.com> Prepare OpenGLRenderer to use glyphs from TextLayoutCache

- add OpenGLRenderer.drawGlyph()
- refactor glypth logging code

Change-Id: I797e6f1304d3f3f8f6ed31e7f9965d336233d2a4
858aa93ddb6e69e0503382af63bb681b6728aef1 12-May-2011 Chet Haase <chet@google.com> Antialiasing for rectangles

Change-Id: I7ca6931606541ddd504bd5db7f8dc04b9cde8cd9
c54ed966f78b9ee8117931859d62faa6f11fe018 06-May-2011 Chet Haase <chet@google.com> Minor javadoc enhancements

Change-Id: Ic24bb0e1e669989f0cae3a9b8fa064b38c8e7948
3825fef300122ffcc262e56a36a9fc36d8d084b0 06-May-2011 Chet Haase <chet@google.com> Merge "Fix for scaled AA lines"
99ecdc480dd4f9b550b2a62ea39f77845a4fec49 06-May-2011 Chet Haase <chet@google.com> Fix for scaled AA lines

Previously, the translucent boundary of AA lines would be scaled
by the line's transform. It should always be exactly one pixel wide
in screen space. This fix accounts for scaling for the boundary
region, and fixes some AA calculations that make wide/AA lines
more correct.

Change-Id: I30df2d5d96315bf3e7ff30be9735282fd5439a39
ed30fd8e9a2d65ee5c8520de55b0089c219f390c 23-Apr-2011 Chet Haase <chet@google.com> Add ability for hierarchyviewer to output displaylist info

Clicking on a node in hierarchyviewer1 and hierarchyviewer2 and then
clicking the new "Dump DisplayList" button will cause the display
list for the selected node (including its children) to be output into

Change-Id: Iad05f5f6cca0f8b465dccd962b501dc18fe6e053
a17de9b493123f0d6e6d0b842150bf29322b7a88 05-May-2011 Chet Haase <chet@google.com> Revert "Add ability for hierarchyviewer to output displaylist info"

This reverts commit b2a4b52e8d5e499d33e2765e8c47851bf0266299.
b2a4b52e8d5e499d33e2765e8c47851bf0266299 23-Apr-2011 Chet Haase <chet@google.com> Add ability for hierarchyviewer to output displaylist info

Clicking on a node in hierarchyviewer1 and hierarchyviewer2 and then
clicking the new "Dump DisplayList" button will cause the display
list for the selected node (including its children) to be output into

Change-Id: Id32f62569ad1ab4d533bc62987f3a7390c1bb4e6
df0a7fbdcff3c683641b7980da50a7d0eebe0876 03-May-2011 Romain Guy <romainguy@google.com> Merge "Allows to render with an OpenGL context inside a TextureView."
8f0095cd33558e9cc8a440047908e53b68906f5f 03-May-2011 Romain Guy <romainguy@google.com> Allows to render with an OpenGL context inside a TextureView.

Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
99585adeb4167ca357a72eb866f34c1af944f4b9 03-May-2011 Chet Haase <chet@google.com> Line endcaps for AA lines are now antialiased.

Also fixed other minor issues with AA and line rendering.

Change-Id: Icd4638d27c70e2ee0f28b5d9a2b97d8b29e8ac4d
ad44445c772efe66fdf063aa8f78d7ae3233570e 29-Apr-2011 Romain Guy <romainguy@google.com> Merge "New widget: TextureView Bug #4343984"
aa6c24c21c727a196451332448d4e3b11a80be69 29-Apr-2011 Romain Guy <romainguy@google.com> New widget: TextureView
Bug #4343984

TextureView can be used to render media content (video, OpenGL,
RenderScript) inside a View.

The key difference with SurfaceView is that TextureView does
not create a new Surface. This gives the ability to seamlessly
transform, animate, fade, etc. a TextureView, which was hard
if not impossible to do with a SurfaceView.
A TextureView also interacts perfectly with ScrollView,
ListView, etc. It allows application to embed media content
in a much more flexible way than before.

For instance, to render the camera preview at 50% opacity,
all you need to do is the following:

Camera c = Camera.open();

TextureView uses a SurfaceTexture to get the job done. More
APIs are required to make it easy to create OpenGL contexts
for a TextureView. It can currently be done with a bit of
JNI code.

Change-Id: Iaa7953097ab5beb8437bcbbfa03b2df5b7f80cd7
75e3ef048d8826f0db58f117403ce412e1d076a7 27-Apr-2011 Chet Haase <chet@google.com> Merge "Fix various hw-accelerated line/point bugs"
8a5cc92a150bae38ec43732d941b38bb381fe153 26-Apr-2011 Chet Haase <chet@google.com> Fix various hw-accelerated line/point bugs

All accelerated lines are now rendered as quads. Hairlines used to
be rendered as GL_LINES, but these lines don't render the same as our
non-accelerated lines, so we're using quads for everything. Also, fixed
a bug in the way that we were offsetting quads (and not offseting points)
to ensure that our lines/points actuall start on the same pixels as

Change-Id: I51b923cc08a9858444c430ba07bc8aa0c83cbe6a
9fc27819d75e24ad63d7b383d80f5cb66a577a0d 27-Apr-2011 Romain Guy <romainguy@google.com> Correctly compute tex coords for rect layers.
Bug #4192695

This change also fixes Javadoc links in the framework.

Change-Id: Ia548bcb18baba5d6fe6a4a04a2278e3a3bd465b2
740bf2bb2e900d3db2292b5909b4b4c6e90320e6 27-Apr-2011 Romain Guy <romainguy@google.com> Apply shaders/filters to text drop shadows.
Bug #4318323

This change also fixes the fact that shaders were not modulated
by the paint's color when drawing paths.

Change-Id: Id88804143aea06c895d4cbcdbe106d660230aa5a
6cfdf4538049e4b96f50d8c0fe3119664420cc34 23-Apr-2011 Chet Haase <chet@google.com> Fix bitfield bug with vertex shader selection

Change-Id: I8bd3005f363afb52e6624806efb3e04c4a56ee18
5b0200bd47e8a9a4dc8d2e6c3a110d522b30bf82 14-Apr-2011 Chet Haase <chet@google.com> Enable anti-aliasing for hw-accelerated lines

Draw anti-aliased lines with OpenGL by constructing a quad with
a border that fades out (to mimic fragment coverage).

Change-Id: Ib81a3e62d663acdf1b46b401ac4aa7ee9855cc7e
8a40f6a6324387b324c998cd9d6af900f1dca5ab 25-Mar-2011 Chet Haase <chet@google.com> Merge "Fix bug with accelerated translucent rendering"
f147340bd117c16a67287e2f6ca9ded651bb32b2 24-Mar-2011 Chet Haase <chet@google.com> Fix bug with accelerated translucent rendering

There was a bug in the dirty region optimizations when
using alpha layers. This prevented translucent objects from
being drawn at all in many situations.

Change-Id: I23e9bce3595fbd6fe2bda15e8753a0f35baffb82
5b7a3150a6dbf193b371854b66fa654937633d3a 24-Mar-2011 Romain Guy <romainguy@google.com> Don't crash when omitting paint to drawBitmap() with A8 configs.

Change-Id: I3d630554ad82fa846385274d12d0434e890ef45d
ed6fcb034b44d9a6ac2fc72fee6030417811f234 21-Mar-2011 Romain Guy <romainguy@google.com> Add support for drawPoint() and drawPoints().

Change-Id: I01bef50c08ec3160f8d40dc060b2cf6c2e4d7639
67ac217a81f34ee3d35df84b38f3456843c40706 19-Mar-2011 Romain Guy <romainguy@google.com> Fix hairline rendering.

Change-Id: Ib6129b446b53678b1b955d8516418370cbae4f10
a168d7372132d6c87835878794b6ed43d0d282fd 19-Mar-2011 Romain Guy <romainguy@google.com> Correctly apply filters to Alpha8 bitmaps.

This change also removes unnecessary operations from display lists.

Change-Id: I627f85861982731f0ee7705b48b36d9c56f22f39
40667676e542a9daeafeac9904c30004e8706fd3 18-Mar-2011 Romain Guy <romainguy@google.com> Optimize rect-shaped layers.

This brings back an optimization disabled in HC-MR1. This time the
correct geometry is generated to avoid unnecessary blending.

Change-Id: Id56404dc46bb84c75facc25c18488a690741b592
08aa2cbd5e62e7ca140f78f8bea0477a19880fd9 17-Mar-2011 Romain Guy <romainguy@google.com> Send WebView the current transform and whether we're drawing a layer.
Bug #3275491

These can be used by WebView to correctly apply alpha and geometric

Change-Id: I2ecd4376d68df886dead3c9240317de33f56828f
80911b851764b073310fd0bffdf4a7db0d8fdd0b 16-Mar-2011 Romain Guy <romainguy@google.com> Modify the GL renderer's functor to pass the clip to WebView

Change-Id: If5efe399ca58f3000b2883e24e9f3736a2025184
6217a71cd281003a376d998269d577d26a61c206 16-Mar-2011 Romain Guy <romainguy@google.com> Fix performance issue in Launcher
Bug #3515248

The problem is caused by the fast path when compositing layers on screen.
The fast path draws a single quad using glDrawArrays() whereas the general
path draws an arbitrary mesh using glDrawElements(). It looks like there's
an issue in the driver since glDrawArrays() is significantly slower than
glDrawElements() for a quad (6 vertices!)

This change just gets rid of the fast path.

Change-Id: Ib2361253ec67f44a988270f76c183422f12ce537
ad37cd3b5d3de9dd0858af04fbccd102e8ff4b0e 15-Mar-2011 Romain Guy <romainguy@google.com> Fix disappearing edges in lists/scrollviews/etc.
Bug #4093871

This bug was introduced by a change that modified the way fade areas
are cleared. The previous change relied on Rect::intersect() to empty
the intersected rect when the two rects don't intersect. Unfortunately
this is not what intersect() does. The fix is rather simple and
sets the layer's bounds to empty when they don't intersect with the
clip or the viewport. This has the side effect of ignoring the layer
which is the expected result.

Change-Id: Icf0038b9a476c53f8eff7084136aba3033d093e6
7b5b6abf852c039983eded25ebe43a70fef5a4ab 15-Mar-2011 Romain Guy <romainguy@google.com> Fix rendering artifact in edge fades.
Bug #4092053

The problem always existed but was made visible by partial invalidation.
When saving a layer, the renderer would try to postpone glClear()
operations until the next drawing command. This however does not work
since the clip might have changed. The fix is rather simple and
simply gets rid of this "optimization" (that turned out to be
usless anyway given how View issues saveLayer() calls.)

This change also fixes an issue with gradients (color stops where
not properly computed when using a null stops array) and optimizes
display lists rendering (quickly rejects larger portions of the
tree to avoid executing unnecessary code.)

Change-Id: I0f5b5f6e1220d41a09cc2fa84c212b0b4afd9c46
cabfcc1364eb7e4de0b15b3574fba45027b45cfc 08-Mar-2011 Romain Guy <romainguy@google.com> Add support for partial invalidates in WebView
Bug #3461349

This change also fixes two bugs that prevented partial invalidates
from working with other views. Both bugs were in our EGL implementation:
they were preventing the caller from comparing the current context/surface
with another context/surface. This was causing HardwareRenderer to always
redraw the entire screen.

Change-Id: I33e096b304d4a0b7e6c8f92930f71d2ece9bebf5
84962f2fe6ce779c583cc54b11a9de2b6a568117 03-Mar-2011 Romain Guy <romainguy@google.com> We need to go deeper.
Bug #3431907

When drawing layers inside a layer, the wrong target FBO would be used.
This would happen for instance with app widgets using a ViewFlipper
in Launcher. The ViewFlipper uses a fade animation that triggers a
call to saveLayerAlpha(), which in turns creates an FBO. If this happened
during a scroll, the ViewFlipper's FBO would be composited back directly
inside FBO 0, i.e. the screen. This properly initializes the snapshots
of hardware layers to use the layer's FBO as the default compositing
target instead of using 0.

This problem did not happen when drawing hardware layers inside
hardware layers because LayerRenderer already takes care of figuring
out the FBO it needs to composite into. The bug would occur only
with layers generated with saveLayer() and its saveLayerAlpha()

Layers inside hardware layers insider layers inside hardware layers
now work properly.

Change-Id: Ibe852301087f3d414ad8a18436eebc81f8ac66f5
d643bb56fdf21973ea75984f0816b7dc024698df 01-Mar-2011 Romain Guy <romainguy@google.com> Correctly mark layers dirty when drawing WebView.

Change-Id: I7ae0c3cfa0916d8fbeaf01e8da127c621a06a0f4
4368c449d7baa398e67eb4d96467f1de8862c5bb 25-Feb-2011 David Li <davidxli@google.com> Merge "Fix mTexCoordsSlot > 0 check to mTexCoordsSlot >= 0"
cf28957c89127ccfc82d535903c776124665446a 25-Feb-2011 David Li <davidxli@google.com> Fix mTexCoordsSlot > 0 check to mTexCoordsSlot >= 0

0 Is a valid attribute location.

Change-Id: Ib24335f48efd6cc59e2ab877569d7d0c95f8490a
Signed-off-by: David Li <davidxli@google.com>
b37cbec6d06578a72bdd9c2caa3fd964ade71c53 25-Feb-2011 Romain Guy <romainguy@google.com> Correctly blend translucent GIF bitmaps.

Change-Id: Ifeb2c1d97a4c6dfeb1a7b5b26f1a3153e9f8da7f
6062c5912dc79704b489fc8c289b78a400ed05ee 22-Feb-2011 Derek Sollenberger <djsollen@google.com> Skia Merge (revision 808)

This is a companion CL to the one found in /external/skia

Change-Id: If81748545435cab20a5d8479329ab333cb973e16
894df17eee708688c8a6e67941add2017239c790 18-Feb-2011 Alex Sakhartchouk <alexst@google.com> Fixing font renderer attribute slot locations.

Change-Id: I6377bb641df7d8372d873c00790189f9a190afd6
b18d2d0079b4dbf5675ab79b7111b3dfb3cc1ad0 11-Feb-2011 Romain Guy <romainguy@google.com> Dirty layers in the area covered by a drawBitmapMesh() call
Bug #3410827

Change-Id: Ic8b4f6201af94497bba86c75819588c78debddc2
c78b5d50f961ac8f696f8282979ae283cacd3574 04-Feb-2011 Romain Guy <romainguy@google.com> Properly handle dirty rectangles generated from 9-patches
Bug #3409580

This bug affects anything that draws a 9patch inside a layer, this includes
launcher's workspace, all of the fade animations, etc.

Change-Id: Icbe8ecd158e3d5f44d07516462de68c5d1fb0a8f
3a3133d876caf60ebff2176ad75c3dcf0259148d 02-Feb-2011 Romain Guy <romainguy@google.com> Update layers based on the dirty region.
Bug #3413433

This helps Launcher when a widget updates during a scroll, or when interacting
with widgets on the workspace if layers are still turned on.

Change-Id: Ic7a42eb34f74f4ae988039754f815e2efd1d1e4f
4f09f5417b5c14fd31336dacfff86972e7885a03 27-Jan-2011 Romain Guy <romainguy@google.com> Don't draw the same triangles several times.
Bug #3388197

Change-Id: Ief1dfd9447f144e9992340a173d2893e5e049129
2b1847ea60650a9f68372abe860415f18b55081d 26-Jan-2011 Romain Guy <romainguy@google.com> Remove unused API

Change-Id: I1714fd82a64b752f0350ef4ef9179ce19e089c6a
f90f8171e6acb56f9f87093c01fd586f2140697a 26-Jan-2011 Romain Guy <romainguy@google.com> Make sure the opaque bitmap is opaque. GL doesn't like being lied to.
Bug #3382992

The result still looks wrong but it works as designed, unfortunately.

Change-Id: I6108e199fa336cb01faaabf6c75faa3b71c2339b
8d2959ddffcdee8b0c2f6387f2e2772c6df474ae 25-Jan-2011 Romain Guy <romainguy@google.com> Remove debugging log left by mistake.

Change-Id: I7d5165b4b682714940cea9886abeedd3f4858057
8168396d1acbcb5fdd29eeda4c30b2803d5283ae 25-Jan-2011 Romain Guy <romainguy@google.com> Fix rendering issues with animated layers.
Bug #3385247

- The layer's alpha was interpreted in the wrong range 0..255 instead of 0..1
- 9-patches would not correctly dirty the layer region, the generated mesh
was incorrect

Change-Id: I4916249bedcdb0794929f3796bd17854971efc88
7d7b5490a0b0763e831b31bc11f17d8159b5914a 25-Jan-2011 Romain Guy <romainguy@google.com> Enable partial invalidates when rendering with OpenGL.

Change-Id: Ie8be06c4776b815e8737753eb8003b4fd8936130
daf98e941e140e8739458126640183b9f296a2ab 10-Jan-2011 Chet Haase <chet@google.com> Use optimized display lists for all hwaccelerated rendering

Previously, display lists were used only if hardware acceleration
was enabled for an application (hardwareAccelerated=true) *and* if
setDrawingCacheEnabled(true) was called. This change makes the framework
use display lists for all views in an application if hardware acceleration
is enabled.

In addition, display list renderering has been optimized so that
any view's recreation of its own display list (which is necessary whenever
the visuals of that view change) will not cause any other display list
in its parent hierarchy to change. Instead, when there are any visual
changes in the hierarchy, only those views which need to have new
display list content will recreate their display lists.

This optimization works by caching display list references in each
parent display list (so the container of some child will refer to its
child's display list by a reference to the child's display list). Then when
a view needs to recreate its display list, it will do so inside the same
display list object. This will cause the content to get refreshed, but not
the reference to that content. Then when the view hierarchy is redrawn,
it will automatically pick up the new content from the old reference.

This optimization will not necessarily improve performance when applications
need to update the entire view hierarchy or redraw the entire screen, but it does
show significant improvements when redrawing only a portion of the screen,
especially when the regions that are not refreshed are complex and time-
consuming to redraw.

Change-Id: I68d21cac6a224a05703070ec85253220cb001eb4
a566b7c3aada08d37cf08096c972e3e641bed773 24-Jan-2011 Romain Guy <romainguy@google.com> Fix bitmap meshes to work in display lists.

Change-Id: Ie226d049840942d9ad9cf58e0c19132f49d62a75
8b2f5267f16c295f12faab810527cd6311997e34 24-Jan-2011 Romain Guy <romainguy@google.com> Add support for arcs.

Change-Id: I96c057ff4eb1b464b03f132da0b85333777bee4f
c1cd9ba335b293f11e1082447ef08e474710a05f 23-Jan-2011 Romain Guy <romainguy@google.com> Add support for ovals and stroked rectangles.

Change-Id: I1292e241386763c82e6622c8f7ed90b0f5b7bd4f
f6834478b379856d3e5de92ddce7de0e6ba9fa4a 23-Jan-2011 Romain Guy <romainguy@google.com> Always render text underline extra.
Bug #3381287

Change-Id: Ibfbc9c51c8dccef216daccc37d835e5dbf143a6a
c88e357d1ed9dadfc0efb3dfbe92f24460674ef5 22-Jan-2011 Romain Guy <romainguy@google.com> Fix regression with hardware layers.

The renderer was checking whether the layer's region is a rect to
draw it with a simple quad. This test was done against the layer's
region structure, which was cleared after generating the mesh.
Unfortunately Region::isRect() returns true when the region is
empty, which was causing the renderer to always use a quad to
draw a mesh on screen.

Change-Id: If4b874579ee0cedcb67367c9efa5c0c98ca55231
5a7b466a2b4b7ced739bd5c31e022de61650545a 21-Jan-2011 Romain Guy <romainguy@google.com> Add support for drawBitmapMesh().

Change-Id: Ic77f9c534bb90dc7b9458299544bd50b8b6ae6a5
ed8f8dd8cf621d6046db7e083f8a36205ed55609 20-Jan-2011 Romain Guy <romainguy@google.com> Merge "Add rounded rects and circles support to OpenGLRenderer." into honeycomb
01d58e43ede5ca98cbebdd166f9b0c545032c01b 20-Jan-2011 Romain Guy <romainguy@google.com> Add rounded rects and circles support to OpenGLRenderer.

Change-Id: I6cedf2b495d58de7c0437096809fa9e4518a1b8c
514fb18827186591d66973c2362c859b64b63556 19-Jan-2011 Romain Guy <romainguy@google.com> Don't attempt to create empty layers.
Bug #3369888

Change-Id: Ic17bbd1c04bbf760cb17d0eb9e6767fd6479948c
42f3a4b7c35dd1ea1922356eb3611af8cde05179 19-Jan-2011 Romain Guy <romainguy@google.com> Make embedded hardware layers work.
Bug #3369474

Change-Id: Ib6d7fb44eedda9dc2933b5e1b176f307968af91d
807daf7df615b60ce6fc41355aabe3aa353cebab 18-Jan-2011 Romain Guy <romainguy@google.com> Add support for skew()

Change-Id: Ia3a9a867f74fd78b61f75179e3788fdc2f0cacd0
f219da5e32e85deb442468ee9a63bb28eb198557 16-Jan-2011 Romain Guy <romainguy@google.com> Don't blend transparent pixels when rendering layers.

With this change, the rendere keeps track of what regions are rendered into
and generates a mesh that matches these regions exactly. The mesh is used
to composite the layer on screen.

Change-Id: I1f342576b9134fb29caff7fb8f4c1da179fe956d
1bd1bad0b4a75e633c5edbe802bf6fb4dd765161 15-Jan-2011 Romain Guy <romainguy@google.com> Preapre region tracking in layers

Change-Id: Ied1fa0d36c99ef4e33cb8fde7e3106a793db3a4c
f5106847fc962d57c7d5c586099b4a382f3e1c3d 14-Jan-2011 Romain Guy <romainguy@google.com> Don't add clipped rects to layer regions.
Bug #3350208

Change-Id: I9266862f1d4d57b4598852e8dfa202b5f5099cce
1e3a431d07cc0a307c6441e9ae1b17d3bf42323e 14-Jan-2011 Romain Guy <romainguy@google.com> Remove debug code

Change-Id: Idbc54d16adb4d86185d7196ea0297b5019d14ae4
ffac7fc5042296a459d0f5a450dbfe20917093dc 14-Jan-2011 Romain Guy <romainguy@google.com> Add debug logs for display lists.

Change-Id: I7bae8fd96e9eccb51f29f73e4069b4d3e6bdbdd7
ada830f639591b99c3e40de22b07296c7932a33f 13-Jan-2011 Romain Guy <romainguy@google.com> Cleanup implementation of hardware layers.

The new implementation relies on OpenGLRenderer's existing layer
code instead of duplicating it. The new code is much cleaner, with
simpler and better APIs and allows tracking of drawn regions inside
layers. Region tracking is not yet enabled but this will be done
in a future CL.

Change-Id: Ie826121a2227de8252c77b992a61218defea5143
c038ea358aadca082198f3effc550d33135bf426 13-Jan-2011 Romain Guy <romainguy@google.com> Reenable region composition pipeline for layers
Bug #3341848

It works this time!

Change-Id: I0d371d8b2c75c67d4ce5009ddb990fe5e55a0a27
6c319ca1275c8db892c39b48fc54864c949f9171 11-Jan-2011 Romain Guy <romainguy@google.com> Better backend for hardware layers.

With this new backend, a hardware layer is only recreated when
its associated view is udpated. This offers fast composition
in GL and fast update of the layer in GL as well.

Change-Id: I97c43a612f5955c6bf1c192c8ca4af10fdf1d076
7230a74e9a36dfc6c4346c14e325bf07cd05b380 11-Jan-2011 Romain Guy <romainguy@google.com> Composite layers as regions.

This change detects what area of a layer was drawn into and generates a mesh
to match this area exactly. This can be used to avoid blending empty pixels
when the layer is composited.
This change also adds proper layers support to lines rendering and implements
layers composition in a more readable way.

Change-Id: I4a5588b98b19bd66891ebdc39631b193c5e31999
a07105b7d2a27e6d69407bf96ddb773bddb5e553 11-Jan-2011 Romain Guy <romainguy@google.com> Better logging of out of memory errors in OpenGLRenderer.

Change-Id: I6b72a084340d8d4b6e0b0a100ed4314d09d441ef
171c592f0b7066acf279863c8a52ddabea49d3db 06-Jan-2011 Romain Guy <romainguy@google.com> New layers API for Views.

This API can be used to back a view and its children with either a
software layer (bitmap) or hardware layer (FBO). Layers have
various usages, including color filtering and performance
improvements during animations.

Change-Id: Ifc3bea847918042730fc5a8c2d4206dd6c9420a3
b146b1214ef6e4fc75d98779b22434335764cfdb 16-Dec-2010 Romain Guy <romainguy@google.com> Fix text shadow rendering issue.

Change-Id: Ic9eb0d38ad684d2f2c95a4f586f865db911cb872
8d0d4783a0206c5884bf0b958d181f450ba5207d 15-Dec-2010 Romain Guy <romainguy@google.com> Cleanup OpenGLRenderer::drawLines()

Change-Id: I3545a616e964335897c6e4148c431a07a2ce2a8b
86568198f2c83d4ce5c4cd692eda074ba9de9ed2 15-Dec-2010 Romain Guy <romainguy@google.com> Continue cleanup refactoring in OpenGLRenderer.

Methods that still need refactoring:
- drawLines
- composeLayerRegion

Change-Id: If546641adf598d49c330988803667264fda50ac2
fa7952dbb86a8aff0c90418aa77dddee3802c23a 14-Dec-2010 Romain Guy <romainguy@google.com> Colors are in the [0..1] range, not [0..255]

This fixes rendering in YouTube and other applications.

Change-Id: Ib5f3df632cde97374113ed42f895f136b2796373
5536841e5452172e7772d84ad5f4a2fc7059c9dd 14-Dec-2010 Romain Guy <romainguy@google.com> OpenGLRenderer would not render colors < ALPHA_THRESHOLD
Bug #3282805

This bug was introduced with a previous refactoring. This also fixes
issues with setting the alpha when drawing bitmaps.

Change-Id: Id47641d26a4536c7e540041f92243bf6db9fc96d
70ca14e08ae197547ac412e8a1210e1ebdfb2eb1 14-Dec-2010 Romain Guy <romainguy@google.com> Refactor OpenGLRenderer to simplify OpenGL drawing code.

This is the first step of the refactoring:
- drawColorRect
- drawTextureMesh

Remaining methods to refactor:
- setupTextureAlpha8
- drawPath
- setupShadow
- drawText
- drawLines
- composeLayerRegion

Change-Id: I0fced6a05b6b6eee10ee7cef0c3fbdaa6cefab20
32963c393a804db2cd86c24443c2f1c6eee6064b 10-Dec-2010 Romain Guy <romainguy@google.com> Ignore empty layers.

Change-Id: Ib2f99cdab654881fe079306e27d87c5ef9535700
af636ebf5feb2837683fbfe965040cb706b32ec1 10-Dec-2010 Romain Guy <romainguy@google.com> Don't set the invisible flag when saving an empty layer.
Bug #3270371

Change-Id: I65e85671c2fb70d74553c91213e5e759e0ac64ee
a957eea78557cb47a91d44d9e6ee641c58cf1c07 09-Dec-2010 Romain Guy <romainguy@google.com> New, better line drawing implementation.
Bug #3207544
Bug #3225875

Change-Id: Ibdd1dfc64e01625d5c441f39eb0aa3ee647f6ff5
8ab4079ca27e36e5c584495bcd71b573598ac021 07-Dec-2010 Romain Guy <romainguy@google.com> Fix 9patch rendering
Bug #3253396

Some quads were incorrectly assumed to be degenerate.

Change-Id: I9155699edc3424afe9d5a131886bb9966d46b109
3a3fa1be9ab8e11edc660ecb35ae21ae0b5c8cc2 07-Dec-2010 Romain Guy <romainguy@google.com> Draw text decorations correctly.

Change-Id: I237c0ca8bfe9f233e62476e80f72bcea4359398e
6620c6d413f972819fada92b574f0fa9e96d36c1 07-Dec-2010 Romain Guy <romainguy@google.com> Correctly render text when coordinates are not integers.
Bug #3225632

Change-Id: If09759e6e95eb2885362ab3ba088cf5aae64c7bf
a5ef39a21683189e5906c9f252b997f0508e350d 04-Dec-2010 Romain Guy <romainguy@android.com> Don't render degenerate triangles in 9patches.
Bug #3251983

Change-Id: Ib0b38a7b8111542372f4c4c106b6321c26fe4ad4
6f72bebe92a4db7b5dc83f4ac5b5fd02e3b4e2cd 30-Nov-2010 Romain Guy <romainguy@google.com> Update 9patch structure when rendering with different divs/colors.
Bug #3221488

Change-Id: Ifc9e42a991d630feadc9e8032322f37504d09d6d
fe48f65922d4a3cc4aefe058cee5acec51504a20 12-Nov-2010 Romain Guy <romainguy@google.com> Free resources only from the GL context thread.
Bug #3179882

Resources were freed following garbage collections on a worker thread.
This worker thread had no EGL context, which would cause the renderer
to incorrectly assume that the memory was liberated.

Change-Id: Ifdb51f94ddf42641e8654522787bfac532976c7c
01d065795794fa56be660d6346e4830eb7e90a41 11-Nov-2010 Romain Guy <romainguy@google.com> Reduce number of GL calls when drawing with shaders.

Change-Id: I27aca9f6d381d5c7e363d90a93225d185f2ff4e3
e190aa69756aecfaffabdd4c6d32cb6b3220d842 11-Nov-2010 Romain Guy <romainguy@google.com> Add new runtime debug flags.

Change-Id: I07955de166a89b5053c6c13f250bb3e2936ca86e
c15008e72ec00ca20a271c3006dac649fd07533b 10-Nov-2010 Romain Guy <romainguy@google.com> Move all debug flags in a single place.

This change also adds a new memory usage flag. When turned on, the
following is printed after every frame:

D/OpenGLRenderer( 3723): Current memory usage / total memory usage (bytes):
D/OpenGLRenderer( 3723): TextureCache 3766680 / 20971520
D/OpenGLRenderer( 3723): LayerCache 3538944 / 8388608
D/OpenGLRenderer( 3723): GradientCache 135168 / 524288
D/OpenGLRenderer( 3723): PathCache 41180 / 4194304
D/OpenGLRenderer( 3723): TextDropShadowCache 0 / 2097152
D/OpenGLRenderer( 3723): FontRenderer 0 262144 / 262144
D/OpenGLRenderer( 3723): FontRenderer 1 262144 / 262144
D/OpenGLRenderer( 3723): FontRenderer 2 262144 / 262144
D/OpenGLRenderer( 3723): Other:
D/OpenGLRenderer( 3723): FboCache 2 / 12
D/OpenGLRenderer( 3723): PatchCache 31 / 512
D/OpenGLRenderer( 3723): Total memory usage:
D/OpenGLRenderer( 3723): 8268404 bytes, 7.89 MB

This should help tracking possibe memory issues.

Change-Id: I83f483ca1d2dbef904829bce368e33fe5503e8d6
0d200833fdc53f9796698f97c18cefc4a1b82df2 05-Nov-2010 Chet Haase <chet@google.com> Fix GL rendering of translucent surfaces

GL renderer was not initializing scissor correctly for translucent
surfaces, resulting in invisible window backgrounds in some cases
like fading popup windows

Change-Id: I87a964986e1ba2c4f59708c8892c5fa71903e6fc
0fe478ea04720a57ef3919dbc23711bc7eba517f 08-Nov-2010 Romain Guy <romainguy@google.com> Support nested display lists.

Change-Id: I3815a2832fc0f722c668ba8f51c5f177edb77c94
7f78b0c3ae6222b39f6240524390de9764f21764 04-Nov-2010 Romain Guy <romainguy@google.com> Lines would not set the scissor before drawing.

Lines were not drawing in Calendar because they were getting clipped
by the previous clip rectangle. This change simply updates the scissor
as needed. This change also reduces the number of state changes in GL.

Change-Id: I41ab13dca3a33cfa6d1a44371c48852ab418b04e
e45362cad94c014d8b3765cb102db0f8c0d92500 04-Nov-2010 Romain Guy <romainguy@google.com> Fix rendering bug with saveLayerAlpha/drawColor.

drawColor() was not calling quickReject because it fills the clip region
and thus always passes the test. However, quickReject also checks whether
the current layer is invisible. drawColor() now performs the same check
and avoid drawing inside an invisible layer.

Change-Id: I63d0e9a8a9c0fba774f0f5c3870d58e6ed96fbd1
5ec9924d24495822b589f1a17996655d66273b30 04-Nov-2010 Romain Guy <romainguy@google.com> Fix rendering issue with layers.

Change-Id: I1d511ab2707000762a942d32c300a9944ab38603
5b3b35296e8b2c8d3f07d32bb645d5414db41a1d 28-Oct-2010 Romain Guy <romainguy@google.com> Optimize FBO drawing with regions.
This optimization is currently disabled until Launcher is
modified to take advantage of it. The optimization can be
enabled by turning on RENDER_LAYERS_AS_REGIONS in the
OpenGLRenderer.h file.

Change-Id: I2fdf59d0f4dc690a3d7f712173ab8db3848b27b1
746b7401ceb86b5f2805f8c0d3b39ac739152015 27-Oct-2010 Romain Guy <romainguy@google.com> Remove unnecessary GL calls.

This change batches calls to glScissor() and removes extra GL
queries and glActiveTexture() calls.

Change-Id: I1cd079d314f87cd9c088f95c8d4909c2f860f6aa
3e3ba155fc0ef7a7f40f06762240d9ba22f62b19 26-Oct-2010 Romain Guy <romainguy@google.com> Don't change texture unit when not needed.

Change-Id: Ifa84426d234f2122402cb13533cb5964f1ce95ec
8164c2d338781c3a3c4a443941070dca5d88f2a7 26-Oct-2010 Romain Guy <romainguy@google.com> Don't change textures wrap modes on every draw.

Change-Id: If6d3f313778cc7f3e803a063338539c8b3e165e3
ae88e5e8e9cb6c9539314c4360c5b20f8ec1fefc 23-Oct-2010 Romain Guy <romainguy@android.com> Fix rendering issue with layers.

A change was made earlier in the renderer to not snap the current clip rect
on every clip operation. The clip rect must not be snapped to pixel boundaries
before being used for pixel precision operations. Some operations were doing
this correctly, others were not. For instance, a layer was always created by
rounding to the correct pixels, but composing a layer was done with a non
rounded clip, thus resulting in slightly odd behaviors.

Change-Id: I31c2cf0a343450470bcd449c3f13fe37648b9c7c
58ae6db4ff8a9d0910e1183ee8be9a038a2712a6 22-Oct-2010 Romain Guy <romainguy@android.com> Don't use two different variables to refer to mSnapshot.

Change-Id: Ie4a0616d2fe0b040ac14b734a9ddf77bf1f35b0c
ae517591d96be39f5f18a1716c856ade13a8bcc7 22-Oct-2010 Romain Guy <romainguy@android.com> Don't perform glCopyTextImage with coordinates outside the buffer.

Bug #3122179

Change-Id: I91ed397e9e553a8eeb69d82d0c5b1e49a3cdd5ff
5c13d89c1332fcc499379b9064b891187b75ca32 08-Oct-2010 Chet Haase <chet@google.com> Optimizing display lists by referencing pointers to resources instead of copying them

Change-Id: I81ad3551d74aa1e5bb64d69e33d2eb29a6c1eb6a
50c0f093d942a59d4e01b2c76d26c0e9d6ed796c 19-Oct-2010 Romain Guy <romainguy@google.com> Solve rendering issue with embedded WebViews.
Bug #3094017

The blending mode was not appropriately set after WebView released the

Change-Id: Ib36d48e82c12f6d131dd5a0bcde9106925b8da63
03750a067e818ca7fbd0f590e2ff6a8fded21e6c 18-Oct-2010 Romain Guy <romainguy@google.com> Use VBOs to render most geometries.

Change-Id: I4360dc4fe5693ab425450c107282b2c22db4dca7
054dc1840941665e32036f9523df51720ad069c8 16-Oct-2010 Romain Guy <romainguy@google.com> Don't draw entirely transparent 9patch meshes.

Change-Id: If3e62e18b8e0dbde8a22f8ede2889b86500a4dc2
9d13fe25f4f10b25776b1dc5c858f9ebb0b28b30 16-Oct-2010 Romain Guy <romainguy@google.com> Fix text rendering artifact.

Change-Id: I50f47207846e4208d363dde4e8f5f1a0f23d2d75
e5ebcb0107a939395e03592fd44c746cd09e311d 15-Oct-2010 Romain Guy <romainguy@google.com> Fix clipping issue in StackView.

Change-Id: I7ec28f25c3993a2bd7ef6399ba1923839d239905
d2a1ff003b9b1212c9ab4b5f679b5b097720a359 14-Oct-2010 Romain Guy <romainguy@google.com> Fix text rendering issue.

The local clip rect could be off by one pixel when a 3D transform
was applied to a text primitive. This would cause small rendering
glitches in Launcher in particular.

Change-Id: I1254f6a5838c26810cbe969b096679d40b8dd504
93d2361c6d294c390cb5c4a13bd1b88dcd465fd7 14-Oct-2010 Romain Guy <romainguy@google.com> Fix layer rendering glitch.

Change-Id: If2f987fe5526fc88743ca3e91edde4f8232ff658
909cbaf8f92d69f507bbdba9e5aa960d1e6c7a1f 14-Oct-2010 Romain Guy <romainguy@google.com> Don't draw TextView's alpha layers when not needed.

Change-Id: Iedf42cbc62d727f18500c78fcccf2d081a761fec
99bcdc52dcb365ed7d8cfa13540fb33fbcbbac9d 14-Oct-2010 Romain Guy <romainguy@google.com> Return identity matrix when rendering in an FBO.

Change-Id: I57438e745b30c8cfe16c269f3cafcd719049d705
41030da16856c8869e1e51d4a0405432fa96614e 13-Oct-2010 Romain Guy <romainguy@google.com> Add a getNativeMatrix() API.

This API can be used by WebView to apply the appropriate transform
on its rendering.

Change-Id: I79aa39a29805f462fb08226370328815e74bdc52
eb07af687319a0f52c219c3c0c1b73162fce9d04 13-Oct-2010 Romain Guy <romainguy@google.com> Optimize layer clears.

Don't clear the entire texture when we use textures that are bigger
than the layer itself. This will save time during the glClear() calls.

Change-Id: I06f3259ba62affb3708ba69ea41418832c7e1a65
e91080581f467d55913a8c5ab53dedc2dab2e5b6 13-Oct-2010 Romain Guy <romainguy@google.com> Tweak layers caching for better performance in Launcher.

Change-Id: Ia6e67699d98f69c8a93385b3ecbdd814c7b16921
4bb942083a0d4db746adf95349108dd8ef842e32 13-Oct-2010 Romain Guy <romainguy@google.com> Optimize 9patch rendering.

This change detects empty quads in 9patches and removes them from
the mesh to avoid unnecessary blending.

Change-Id: I4500566fb4cb6845d64dcb59b522c0be7a0ec704
c00972bb162779e52d1b0d8f662a9f6033bf9182 12-Oct-2010 Romain Guy <romainguy@google.com> Don't recreate a new texture every time we draw a layer.

Change-Id: I3c28aff5acffc7c6f1ac74805869725426c62d28
dbc26d2ba13f80a7590c57de2d80530d96832969 12-Oct-2010 Romain Guy <romainguy@google.com> Don't draw fully transparent views/primitives.

Change-Id: Icd7d8ef1f57b51a24faf32f7004125e6300d4fdc
707b2f78ccaa09965d7e030fda3a883ce9b75ea8 12-Oct-2010 Romain Guy <romainguy@google.com> Optimize GLSL shaders.

Change-Id: I9a5e01bced63d8da0c61330a543a2b805388a59d
2728f961614a385df1f056fc24803a9f65c90fab 09-Oct-2010 Romain Guy <romainguy@google.com> Don't update 9patches on every frame.

Change-Id: I7ffb2365f83e0453e7d0a0cdcb3fc9308b305238
8550c4c7b5952b7a4e1e0ede95c9492d03099a13 09-Oct-2010 Romain Guy <romainguy@google.com> Better cache for layers, reduce memory usage and increase framerate.

Change-Id: I5ff864a361db4791bd5ff6be716f7ce692ef572d
6b7bd24659fb175fe1f0e97c86c18969918b496a 07-Oct-2010 Romain Guy <romainguy@google.com> Don't clear the framebuffer when not needed.
eb99356a0548684a501766e6a524529ab93304c8 06-Oct-2010 Romain Guy <romainguy@google.com> Optimize saveLayer() when the clip flag is set.

This speeds up applications, especially Launcher.
bdb801ca993bcccbf2a4c2401d1720c3fa523777 05-Oct-2010 Romain Guy <romainguy@google.com> Remove logs to reduce logcat spam.

Change-Id: I5fc295b05b5d82bb86827b88e94dd51e8bcdc7d3
e8cb9c14309b0f01c0159efdf9a7198f44a62642 04-Oct-2010 Romain Guy <romainguy@google.com> Apply bilinear filtering on text only when necessary.

Change-Id: Ic903f4b5d30e9c92528c6291941896efe4729ee3
0bb5667b4ef91fefd0500fae0186789d15d54e0e 01-Oct-2010 Romain Guy <romainguy@android.com> Fix INVALID_OPERATION error with layers rendering.

This change is a workaround for a driver bug that causes an INVALID_OPERATION
to be thrown on every glCopyTexSubImage() call. This change also adds a new
test for gradients local matrices.

Change-Id: I41b7437481026702d0a3a9677f099b4557c0a84e
4aa90573bbf86db0d33a3a790c5dbd0d93b95cfe 27-Sep-2010 Romain Guy <romainguy@google.com> Adding display lists to the GL renderer (checkpoint.)

Change-Id: Iaa49757600a53b39369dbb23f8c3feab282518e6
e2d345ea67e2960b37bfdc0fc8626d1bfa747404 25-Sep-2010 Romain Guy <romainguy@google.com> Add debug mode to measure performance.

Change-Id: I9d4c84034dc200b99c8266165942a7cdbcb5c0c5
38c85b907a478af96d71b9a5df5a2066b8475311 23-Sep-2010 Romain Guy <romainguy@android.com> Correctly initialize/refresh layers.

Change-Id: Id8cdcf587b13098460f7d4aa1bd17708784d89bb
e20ecbd12d26467754a7770d44bcce2ea92335ef 23-Sep-2010 Romain Guy <romainguy@android.com> Draw text decorations with lines instead of rectangles.

Change-Id: Icd25c85c3a24da96a3d2f76f9477da6f87e0303c
29d8997bd43b7c4ad37fc3d6f91eaafa74913c88 23-Sep-2010 Romain Guy <romainguy@android.com> Fix OpenGL errors in various places.

Change-Id: I3a4e115d8fb13b6c443e65460d92987b16f2524c
b5ab4173e0927e4668a45298c9900cd8007584e1 18-Sep-2010 Romain Guy <romainguy@google.com> Fix positioning of 1 pixel wide lines (esp. non AA lines.)

Change-Id: Ic155cac72f351edae35dffdfbb236954f57ba7de
c95c8d6bf8fda5c4e8ebd0033b789be7868e6e07 18-Sep-2010 Romain Guy <romainguy@google.com> Add support for non AA lines.

Change-Id: Id5200e94815404d62760437d0d2dbb0a9276c700
759ea80dca64ad652110a129e0d8bf93fea79f61 17-Sep-2010 Romain Guy <romainguy@google.com> Add support for drawLines(), with anti-aliasing

Change-Id: I16c0593c5671490909dec13a85df601e1428a1a6
bf434114cbf55b216fdc76fc8d65a75e84c9dab5 16-Sep-2010 Romain Guy <romainguy@google.com> Snap layer bounds to pixel boundaries.

Change-Id: I272ceebf469a119f01ea9d73cdd68519afdffa99
b025b9c8b4efefadb01937db61a1f8ee7d2452bf 16-Sep-2010 Romain Guy <romainguy@google.com> Better error handling in the OpenGL renderer.

Add a glGetError() check on every frame
Don't attempt to create textures larger than the maximum size allowed

Change-Id: Iee4afae16089406dbe8bf10fc93b674f1271a0ca
6820ac8b14b4558f5d8b833dde80895306a3e137 16-Sep-2010 Romain Guy <romainguy@google.com> Fix 9patch rendering.

Change-Id: Ic4c18ff483cca95fbabcb10843f7714efe488adb
87a76578f76f4a6bceb187da6b7a01899ca0d85a 14-Sep-2010 Romain Guy <romainguy@google.com> Docs updates.

Change-Id: Iff395e1c6d81a484a2c4ad6e88357c0134971b78
1c740bce8a762f02b5283045a0e2de7c8fb41277 14-Sep-2010 Romain Guy <romainguy@google.com> Document the implementation of saveLayer().

The implementation is simple but tricky. Leave explanations to my
future self so that I don't invent a time machine to come back to
now and slap my self.

This change also simplifies the way the GL blending function is
chosen when compositing a layer. It reuses existing OpenGLRenderer
APIs and is easier to understand.

Change-Id: I1b9cf8c5d51e09836d85b8cf157a1c284aa65c59
81ab046a1127bd2ad397e6d1c6f8021b202a97ff 14-Sep-2010 Romain Guy <romainguy@google.com> Forgot the return value...

Change-Id: Iccf369a613c1cf83f3e948460c567291b084fad2
8411f336c786379c5a03106e9ed3bc8622b579a5 14-Sep-2010 Romain Guy <romainguy@google.com> Fix rendering issue with layers intersecting the clip rect.

Change-Id: Icbe35194fa219ef13ce639d33631235f8d7df3d7
2bffd268f135df8308c9e67af110525a5c463424 13-Sep-2010 Romain Guy <romainguy@google.com> Fix text rendering issue with text scaling.

Change-Id: I1f3ae40025697e8f8ca0616ee6550fe215cadcc8
8694230ff25fa0a60e480d424843e56b718f0516 12-Sep-2010 Romain Guy <romainguy@google.com> Optimize calls to glCopyTexImage2D().

Change-Id: I34ee87bd4472864f440916e03a2894fae24bbe4a
f607bdc167f66b3e7003acaa4736ae46d78c1492 11-Sep-2010 Romain Guy <romainguy@google.com> Correct implementation of saveLayer().

Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
a5aed0d58962a24c44728ffc46dc9e1ba2f9fda5 09-Sep-2010 Romain Guy <romainguy@google.com> Add support for advanced blend modes with the framebuffer.

This adds the ability to blend with the framebuffer using Darken,
Lighten, Add, Multiply, Overlay and Screen.

Change-Id: Iae01a53797d4ad39c373cba6ff2a42293129da1a
d90f23e24a4d1768d5a7ed0e7072e67af6330a45 09-Sep-2010 Romain Guy <romainguy@google.com> Do not convert 8888 bitmaps to 565 when doing a copy.

Bug #2988077
This change keeps the 8888 format for new bitmaps and also keeps,
when possible, the opaque flag.

Change-Id: Ia61f2e89936916b329212a4c59a7d815c329f84e
8aef54fa17f2a3753d9a8f2027629bc480088f69 02-Sep-2010 Romain Guy <romainguy@android.com> Add support for Canvas flags on save.

This is required for the rewrite of layers support.

Change-Id: I5c0867dcf5aeb0392c8d0fbab05febb0eaff70d9
da8532c6f48b4c10b5e2ccb9e08690341efa1616 31-Aug-2010 Romain Guy <romainguy@google.com> Add hooks for hardware accelerated WebView.

Change-Id: I907cdec8a67594f87749ac46bda85f04af5a2003
b45c0c9774bd19a9dbe77d149abae4e124b08bf6 27-Aug-2010 Romain Guy <romainguy@google.com> Apply gamma correction to font rendering.

Change-Id: I1b05f40e356221b2a5eb9400e67d77ecd98ed6c4
fb8b763f762ae21923c58d64caa729b012f40e05 24-Aug-2010 Romain Guy <romainguy@google.com> Use only one GL context per process, share chaches.

Change-Id: Ieabaa25338d2f4b8d4fd90e7401ad6e7452eae11
a80d32f7b69aa37026ab99e4ade1ad86dae76a81 21-Aug-2010 Romain Guy <romainguy@google.com> Add support for textScaleX.

This will not look great because we render fonts using bitmaps, not

Change-Id: I01b87b81bfbdbfa28460a5d5309d38e2a65e77c4
8b55f377655d13a445b08a0a8ed09b6e95c752b0 19-Aug-2010 Romain Guy <romainguy@google.com> Fix drawing issues with layers.

Prior to this change layers would clip their content incorrectly. They would
also not apply alpha properly.

Change-Id: Id7b3aaa7dbdc51de68fe050e64458f68e40503fd
1f8c9602eeff0a35f8af70bd3fdcd770f0127775 18-Aug-2010 Romain Guy <romainguy@google.com> Fix the build.

Change-Id: I8bd418ba21e3e3f68b793030398d1a5e933dfb19
2542d199745cdf3ec910b8e3e4cff5851ed24e9b 18-Aug-2010 Romain Guy <romainguy@google.com> Layers were using an extra Snapshot causing extra clipping.

Bug #2919310

Change-Id: I72ccd44bba7a3f3db72f581aa96198b6226e4478
8fb954263dd2f918ad339045cc6d82e346515599 18-Aug-2010 Romain Guy <romainguy@google.com> Fix save()/restore() issues in the OpenGL renderer.

The save stack now behaves exactly like in Skia.

Change-Id: If7e642f41f2c8f693f6e8c26cba81507d466562e
1d83e1981c8b89da93dff37a4f8b2b1ad8480b44 17-Aug-2010 Romain Guy <romainguy@google.com> Correctly set the viewport in layers.

Bug #2919295

Change-Id: I16ce79ab0d5747cb01c6c1abe531da3dfd93fb54
0a41749953f35d33f61b3119e3161a82bb5fa59e 17-Aug-2010 Romain Guy <romainguy@google.com> Cleanup, better code reuse.

Change-Id: Ib86a7309ae579cce3b7cf464782c34e70a74c616
1e45aae5de003657e5d18f74d34998f5de5db5b7 14-Aug-2010 Romain Guy <romainguy@google.com> Add drop shadows.

Change-Id: Ic6a72409d4785968d1fbdff229f17ee5c00b240b
959c91f7f7b4f921d341264f5b4ef54e702a0df0 12-Aug-2010 Romain Guy <romainguy@google.com> Bunch of fixes.

Fixes memory leak, fixes multiple context support, fix 3d transforms.

Change-Id: I7462cfbc57857dbd4de4e76b9d4cba58a1bce77b
a674ab74e359ac73b4c4dd6b1a3a771836ac7e40 11-Aug-2010 Romain Guy <romainguy@google.com> Add support for text underline and strikethru.

Change-Id: I3a0e6643d7cafbdd06d9a908c8cf9347dcaba146
61c8c9c5b2006d18e9310b6521c65b36ffe75ce4 10-Aug-2010 Romain Guy <romainguy@google.com> Fix tons of bugs and add new text rendering support.

Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
9cccc2b9bdd4850a3f9679569aaec3ab98477a5d 08-Aug-2010 Romain Guy <romainguy@android.com> Enforce maximum texture size.

When an app tries to render a bitmap or path larger than the GPU's maximum
texture size, the drawing command is ignored and a warning is logged. This
change also makes texture drawing more robust by catching potential errors
during texture creation.

This change also fixes a crash in the FontRenderer. The destructor would
sometimes try to free an uninitialized array.

Change-Id: I95ae0939c52192d97b340aa02417bf6d0c962c57
22158e139a3d6c6a9787ca0de224e9368f643284 06-Aug-2010 Romain Guy <romainguy@google.com> Automatically cleanup textures that don't fit in the cache.

Change-Id: I4f29ed96ea11118b391fb957e1e4d1b8fcef1537
7fbcc0492fca03857e3c45064f4aa040af817d55 05-Aug-2010 Romain Guy <romainguy@google.com> Add support for paths.

Rendering is implementing by rasterizing the paths into A8 textures.
This cna be extremely inefficient if the path changes often.

Change-Id: I609343f304ae38e0d319359403ee73b9b5b3c93a
db1938e0e6ef816e228c815adccebd5cb05f2aa8 03-Aug-2010 Romain Guy <romainguy@google.com> Add support for ColorFilters.

Color filters are fully supported and can be used with shaders.

Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
06f96e2652e4855b6520ad9dd70583677605b79a 31-Jul-2010 Romain Guy <romainguy@google.com> Refactor Skia shaders handling.

With this change, Skia shaders can easily be applied to any mesh. This change also
supports ComposeShader. For instance, this can be used to blend a gradient and a
bitmap togehter and paint a string of text with the result.

Change-Id: I701c2f9cf7f89b2ff58005e8a1d0d80ccf4a4aea
b82da65cb1601be504241f36778395cd6cb9f87b 30-Jul-2010 Romain Guy <romainguy@google.com> Fix improper clipping after a save()

Change-Id: I13426a67f20d77e2710bd500d82884098f4be97c
ae5575b3421c8fbe590ab046d7d5f2b36ecfd821 30-Jul-2010 Romain Guy <romainguy@google.com> Fix gradients rendering and destructor crashes.

This changes binds all textures to GL_TEXTURE0, this will have
to be changed when combining shader capabilities.

Change-Id: I02df4f5ba41e9b01ffa52fd7c26b41477c7ed18f
889f8d1403761d5668115ced6cbb3f767cfe966d 29-Jul-2010 Romain Guy <romainguy@google.com> Moved all the rendering code to the new shader generator.

The generator supports features that are not yet implement in the
renderer: color matrix, lighting, porterduff color blending and
composite shaders.

This change also adds support for repeated/mirrored non-power of 2
bitmap shaders.

Change-Id: I903a11a070c0eb9cc8850a60ef305751e5b47234
ac670c0433d19397d4e36ced2110475b6f54fe26 28-Jul-2010 Romain Guy <romainguy@google.com> Generate shaders to cover all possible cases.

With this change, all the vertex and fragment shaders used by the GL
renderer are now generated based on a program description supplied
by the caller. This allows the renderer to generate a large number
of shaders without having to write all the possible combinations by
hand. The generated shaders are stored in a program cache.

Change-Id: If54d286e77ae021c724d42090da476df12a18ebb
65ef909776c03417d8b597738da54ca211e37e4f 26-Jul-2010 Alex Sakhartchouk <alexst@google.com> When font cache still has empty space,
precache some commonly used characters to reduce studder.

Change-Id: I1f66f57482c4a025672dfd1d8ecaf2b9736cd9a0
e8e62a4a032a80409114a37908b5f18ab0080848 24-Jul-2010 Romain Guy <romainguy@google.com> Add text alignment support to drawText().

This change also integrates better support for RTL text.

Change-Id: I6da8f5cf5dc28ca7cf1b22e27b0d853c919e8481
51769a68a5cb34e9564740c6a854fcb93018789d 23-Jul-2010 Romain Guy <romainguy@android.com> Cleanup, added properties for the FontRenderer.

Change-Id: I909c74815d3ac394438ad8071d17fef5401dbeed
09147fbdc8206a0cac78bfe9083e7e15b3c5689c 22-Jul-2010 Romain Guy <romainguy@google.com> Add support for text culling.

Change-Id: Ibf0adacdc5c64d40a8000b21d7cb0797d63efe29
694b519ac647fe998fd396fe0784cc8e179aadc4 22-Jul-2010 Romain Guy <romainguy@google.com> Add text rendering.

Change-Id: Ibe5a9fa844d531b31b55e43de403a98d49f659b9
a1db574036c9bc2d397b69f8200594027e1fff16 20-Jul-2010 Romain Guy <romainguy@google.com> Add preliminary support for text rendering.

Change-Id: I547eb631dbda24d13960d54b4144fb8908fd8a49
c0ac193b9415680f0a69e20a3f5f22d16f8053be 20-Jul-2010 Romain Guy <romainguy@google.com> Add support for linear gradients.

Change-Id: Id15329da065045b3f06fdaed615f33cd57608496
f9764a4f532561f6e2e985ff3b25112f1132ce44 17-Jul-2010 Romain Guy <romainguy@android.com> Add program for linear gradient.

This change adds a new DrawLinearGradientProgram class to enable the drawing
of linear gradients. Two new vertex and fragment shaders are introduced,
based on DrawTextureProgram's shaders.

Change-Id: I885afc076bb6cef8cd3962ae21a086fa6a03bf96
7fac2e18339f765320d759e8d4c090f92431959e 17-Jul-2010 Romain Guy <romainguy@android.com> Add plumbing to support gradients in OpenGL renderer.

The LinearGradient class keeps a copy of the various parameters that
define the gradient. The copies are native arrays to avoid copying
Java arrays on every draw call. The gradient code path is implemented
until OpenGLRenderer::drawRect() (see TODO.) The actual gradient
implementation will be added in a latter change.

Change-Id: I9300d250ef5e2e9c2e097c3116ee71dfc9d752d8
1e79386ba34f0db38c1b35b22cdf122632534354 17-Jul-2010 Romain Guy <romainguy@android.com> Optimize textures binding.

The renderer is still changing textures' wrap modes every time, this will require
a latter optimization.

Change-Id: I3eb92cb8c886c4a692b7f0ca759911f9371d4d2c
079ba2c85b15e882629b8d188f5fbdb42f7f8eea 16-Jul-2010 Romain Guy <romainguy@android.com> Improve clip support (add intersect, union and replace.)

This change also modifies the way the clip is stored. The clip is now
always stored in screen-space coordinates.

Change-Id: I96375784d82dfe975bc6477a159e6866e7052487
d27977d1a91d5a6b3cc9fa7664ac7e835e7bd895 15-Jul-2010 Romain Guy <romainguy@google.com> Add support for BitmapShader.

This change also fixes an issue with the clip and layers.

Change-Id: I5fd9832098d8cf7ae8eb781ff9bffe7defaea279
3d58c03de0d8877b36cdb78b0ca8b5cac7f600e2 15-Jul-2010 Romain Guy <romainguy@google.com> Do not apply transforms when using drawColor().

This fixes an issue in the way the clip transformations were applied.

Change-Id: I91e7b5d15baf244d1280e48938282bb33609081d
a979474f15b454c8e2963f239a3770e200bb227c 13-Jul-2010 Romain Guy <romainguy@google.com> Cleanup: remove unnecessary parameters.

Change-Id: I5956ef1db6be28a01369387aaeeb65a94656c48c
92429d9266edf63cf632c132c5936f0e31850988 13-Jul-2010 Romain Guy <romainguy@google.com> Fix premultiplied alpha.

Change-Id: I08da422c5350503e1f4f27b9890f15a813d0c6c7
6926c72e25b8dec3dd4b84af0819fa1937ae7296 13-Jul-2010 Romain Guy <romainguy@google.com> Correctly support pre-multiplied alpha, optimizations, more stuff.

Add support for the following drawing functions:
- drawBitmap(int[]...)
- drawPaint()

Optimizes shader state changes by enabling/disabling attribute arrays
only when needed.

Adds quick rejects when drawing trivial shapes to avoid unnecessary
OpenGL operations.

Change-Id: Ic2c6c2ed1523d08a63a8c95601a1ec40b6c7fbc9
260e102162322958cf17dbd895cd6bd30dc87e32 12-Jul-2010 Romain Guy <romainguy@google.com> Optimize shader binding changes.

This change also cleans up the internal API a little bit by using mat4
everywhere instead of float[16] (for the ortho matrix for instance.)

Change-Id: I35924c7dc17bad17f30307118d5ed437c2ed37e0
0b9db91c3dc8007b47c8fd4fb9dd85be97201a88 10-Jul-2010 Romain Guy <romainguy@google.com> Remove math from the vertex shader.

Change-Id: I02847a60a8734bf8b3d29ec12e76297795095e38
16202fc9745e9b11db089ebc8f40119d13732016 10-Jul-2010 Romain Guy <romainguy@google.com> Fix alpha blending and improve fragment shaders performance.

Change-Id: Ib74f6941d25ca6f6a41708e541174eaa7e8d9bc2
fb5e23c327cd5f8f93d1eaa7c10f34d6fd3efb6c 09-Jul-2010 Romain Guy <romainguy@google.com> Refactoring to move vertex computing to the Patch class.

This change is mostly cleanup to keep less code in OpenGLRenderer.

Change-Id: I954375143b2943829457ab470423729b60b844f5
82ba814ca0dea659be2cc6523bc0137679d961ce 09-Jul-2010 Romain Guy <romainguy@google.com> Optimize blending state changes.

Change-Id: I7c22a8aecccb8b5abfcf7243f049a4ef3cf3979a
f7f93556c8fcc640ab5adef79d021a80a72a645a 09-Jul-2010 Romain Guy <romainguy@google.com> Draw n-patches using OpenGL.

Currently only tested with title bars and buttons.

Change-Id: I8263a9281898dc0e943b1b8412827fe55639b9d6
f18fd99b5c182329cd8936a9611f0103d8ece44a 08-Jul-2010 Romain Guy <romainguy@google.com> Create FBOs in LayerCache.

This moves a bit of code away from OpenGLRenderer and matches
what happens with the TextureCache.

Change-Id: I3c67f54f83d7240770daa015861c0e75a1dd8c42
deba785f122a47915756ffd991f5540d952cf937 08-Jul-2010 Romain Guy <romainguy@google.com> Add support to draw 9patches in OpenGL.

This change only adds the necessary API and stubs. The implementation
will be added in another change.

Change-Id: Ie50b8aff5868e78796cee331df15bdbf990d2ea1
6c81893c626499e58c8eeb20d6c35ec4e1ce808b 08-Jul-2010 Romain Guy <romainguy@google.com> Simpler way to deal with the FBO multi-cache.

This change removes the need for the SortedList and instead just
add a generated id to each FBO stored in the cache. This is an
artificial way to store several FBOs with the same dimensions.

Change-Id: I9638364e9bdc0f2391261937a0c86096f20505bf
5f0c6a483900f3989f4d2a8f913cf5b6a9777d03 07-Jul-2010 Romain Guy <romainguy@google.com> Optimize FBO cache.

This change introduces a new generational cache called GenerationMultiCache
that can store several values with the same key. This can be used to use
multiple layers of the same size at the same time, without recreating them
over and over again.

Change-Id: I425466a20908b862c5f464a0f9e582ec18cbd7ac
dda570201ac851dd85af3861f7e575721d3345da 06-Jul-2010 Romain Guy <romainguy@android.com> Add a layer (FBO) cache.

The cache is used to draw layers so that a new
texture does not have to be recreated every time
a call to saveLayer() happens.

The FBO cache used a KeyedVector, which is a bad
idea. The cache should be able to store several
FBOs of the same size (this happens a lot during
scrolling with fading edges for instance.) This
will be changed in a future CL.

Change-Id: Ic316189e625f0dbcf0d273a71cc981a433d48726
7d139ba2c331f11e9b485753cc727a0ff202f2a4 02-Jul-2010 Romain Guy <romainguy@android.com> Remove extra leftover logs and use uint32_t instead of unsigned int.

Change-Id: I944f82fe3255de38dc04048cc8bd861f578f01a7
121e2242565d5f09ad83a2d33ecd2225838802c5 02-Jul-2010 Romain Guy <romainguy@google.com> Track the size in memory of the texture cache.

The texture cache was previously checking the number of stored textures. This was
not very useful as this could easily lead to an abuse of memory. The new cache
instead tracks the total size occupied in RAM by the cached textures. When a new
texture is generated, older textures are kicked out as needed.

Change-Id: Ib27142f4a018d5bf84774c1fb6f45a67a85f20bc
f86ef57f8bcd8ba43ce222ec6a8b4f67d3600640 01-Jul-2010 Romain Guy <romainguy@google.com> Don't use full screen FBOs, this dramatically increase performance.

The next step will be to add an FBO cache to avoid churning memory on every
frame we draw. This change also adds support for drawBitmap(Bitmap, Matrix, Paint).

Change-Id: I7825cdcf0cad9bffe6219e05d8328a53d4a6e583
8ba548f81d1ab5f1750cbf86098c4a14e0b8bead 01-Jul-2010 Romain Guy <romainguy@google.com> Add implementation for drawBitmap(Bitmap, Rect, Rect, Paint)

Change-Id: I10904d2325a5431d15801aebcec1048715678e8c
c1396e93b6a5286a5183c00c781b62e940a12c1f 01-Jul-2010 Romain Guy <romainguy@google.com> Add implementation for drawBitmap().

Change-Id: Iada9325f3c5642b61c2e0c4cd80bcfbc92cb491e
ce0537b80087a6225273040a987414b1dd081aa0 30-Jun-2010 Romain Guy <romainguy@google.com> Add hooks for drawBitmap().

Change-Id: I58e962c3a8b2bc75c2605fe369ad3002579d86e0

Add texture cache.

Change-Id: I1c0e5581d228869e114438258a1014e33e024ad7
d55a86120dd1e8ebcc6906c9ffd463f7460348da 29-Jun-2010 Romain Guy <romainguy@google.com> Add support for saveLayer().

saveLayer() is affected by the paint's alpha and xfermode.

Change-Id: I28693a9337052643adccdb4889a8f228d4e17903
026c5e16704e817cac7d9c382914c947e34f87e0 29-Jun-2010 Romain Guy <romainguy@google.com> Implement support for PorterDuff's blending modes.

The blending modes are currently hooked up only when drawing filled rects but the
code is reusable for other primitives. This will allow implementation of saveLayer().
This method is required to support the fade effects used throughout the standard
Android UI.

Change-Id: I396023d123436f16cdafc606e358e4eb80c9df2c
5cbbce535744b89df5ecea95de21ee3733298260 28-Jun-2010 Romain Guy <romainguy@android.com> Reduced the complexity of layers composition.

This change also refactors the code base a bit by moving classes out of
OpenGLRenderer into separate headers/implementations. This makes the code
more manageable.

This change also adds documentation for implementation methods. The
undocumented methods are simply Skia's Canvas methods.

Change-Id: I54c68b443580a0129251dddc1a7ac95813d5289e
bd6b79b40247aea7bfe13d0831c6c0472df6c636 26-Jun-2010 Romain Guy <romainguy@android.com> Add implementations for saveLayerAlpha() and textured rects.

Even though there's an implementation for textured rects, drawBitmap() is not
hooked up yet as it will require a good texture cache.

This method is implemented using FBOs. There's currently an issue either in the
driver or in the Canvas renderer that forces the FBO to be fullscreen, which is
extremely expensive and yields terrible performance.

Change-Id: I148419195e12d45653c60186938aa78c23a68e2c
7ae7ac48aa2b53453c9805075171ecd5bcafd7de 25-Jun-2010 Romain Guy <romainguy@android.com> Convert tabs to spaces.

Change-Id: I5d3ae48af79b19b6d293deff0521e4bb57d5114b
c7d53494f1fbd9f9d74af89053ff9fdb1ccbac6c 25-Jun-2010 Romain Guy <romainguy@android.com> Implement quickReject() and drawRect().

The OpenGL ES 2.0 renderer can now draw colored rectangles. At least there's
something on screen now.

Change-Id: I80a13ccc1dd56784edf74f2670a364f30700234a
9d5316e3f56d138504565ff311145ac01621dff4 25-Jun-2010 Romain Guy <romainguy@google.com> Add colored rectangles implementation in OpenGLRenderer.

Drawing two rectangles one after the other discards the second one because of
Z buffering issues. This will be fixed in another changelist.

Change-Id: Ida1b3cde8a78e60cacc07e477abc44def527ff67
f6a11b8a9e25ff9861bbba19251bea84d8a5daf2 24-Jun-2010 Romain Guy <romainguy@google.com> Add support for transformations.

This change adds partial support for the following transforms:
- scale()
- translate()
- rotate()
- setMatrix()
- getMatrix()

The transform is stored in a snapshot and saved/restored as needed.
The transform is currently not applied to the clip rect and is not
mapped to the vertex shader.

Change-Id: Id48993453311200804149917d0c126a4d0471226
bb9524b6bdddc7ac77d8628daa8b366b8a7be4a4 23-Jun-2010 Romain Guy <romainguy@google.com> Add implementations for clipRect(), save() and restore().

The current implementation of clipRect() does not apply local transformations
before setting the new clip.

Change-Id: I5997871bb638dfcd1a8ef96354846af52427e445
85bf02fc16784d935fb9eebfa9cb20fe46ff7951 22-Jun-2010 Romain Guy <romainguy@google.com> Fix the simulator build.

Change-Id: Ie404f7c2c308f0657f273af19a56e8c039b61898