It is unlikely, but possible, to draw so many glyphs in a frame
(especially of the glyphs are quite large) that the cache starts flushing
itself to fit the later glyphs in. This causes unnecessary thrashing, because
when we actually draw the frame, we will again need to flush to fit the
earlier glyphs in, and then flush again to fit the later ones in.
It is better to avoid thrashing the cache at the precache phase, and wait
until we actually draw the glyphs that do not fit to do any eviction of
the earlier glyphs.
This change simply notes when we are in the preaching phase, and avoids flushing
the cache when a glyph does not fit.
Issue #7081725 avoid thrashing cache during DisplayList recording
Change-Id: I230410ab5b478091b1032fa99dc1752acf868bbe
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
Glyphs were being stored in the glyph cache incorrectly.
The second row of glyphs in any column were being positioned exactly
one pixel too high, causing the preceding glyph in that column to be
cropped, resulting in the reported truncation in some glyphs.
Issue #7003215 Minor UI truncation while reading the mails
Change-Id: I47ce376f78a04d4e07e8b7ed1b3f0b58864c5498
CacheTextureLine was useful before we were packing the glyph
textures; it allowed simple packing of any particular texture according to
how many lines there were in a texture, and how tall those lines were.
Now that we are packing more efficiently (both horizontally and vertically
in any given texture line), it is more efficient to have
open space in every texture, removing the need for CacheTextureLine (which
now gets in the way since it limits how much can be stored in each line).
This change removes CacheTextureLine and just uses CacheTexture directly,
allowing caching of glyphs anywhere in the open space of each texture. As before,
the packing of these glyphs is determined by the CacheBlock structure, which
is a linked list of open spaces in each CacheTexture.
Change-Id: Id6f628170df0f676f8743ac7de76f2377fc6a012
Precaching at startup was not working. One-liner fix to init the caches
so that precaching would kick in earlier, saving time at startup by avoiding
the multiple-upload issue of caching at render time.
Issue #6893691 long app launch time on manta for some apps comparing to nakasi/stingray
Change-Id: Ie5c7f0536ec8ea371c7892e5e09c1db14795531c
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
There are two fixes here:
- precaching: instead of caching-then-drawing whenever there is a new
glyph, we cache at DisplayList record time. Then when we finally draw that
DisplayList, we just upload the affected texture(s) once, instead of once
per change. This is a huge savings in upload time, especially when there are
larger glyphs being used by the app.
- packing: Previously, glyphs would line up horizontally on each cache line, leaving
potentially tons of space vertically, especially when smaller glyphs got put into cache
lines intended for large glyphs (which can happen when an app uses lots of unique
glyphs, a common case with, for example, chinese/japanese/korean languages). The new
approach packs glyphs vertically as well as horizontally to use the space more efficiently
and provide space for more glyphs in these situations.
Change-Id: I84338aa25db208c7bf13f3f92b4d05ed40c33527
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
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
We recently changed the drawText implementation to accept more parameters
which were not taken into account during a dump operation.
Change-Id: Ia1dc682dc7bb2bb02a1f4a514ed5af5556f92a97
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
drawTextDecorations).
Change-Id: Id3dcd62de5536a26b158d768889273a1492b35d6
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
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
Compute the size of the backing textures based on the maximum possible
number of shades in the gradient.
Change-Id: I2d7f20477d31b81e9735f2c1d83ebdd0dbcbe340
To select the gamma correction method, adb shell setprop hwui.text_gamma_correction
with one of the following values:
lookup3
lookup
shader3
shader
See Properties.h for more information about these different methods.
You can also control gamma correction using the following properties:
hwui.text_gamma
hwui.text_gamma.black_threshold
hwui.text_gamma.white_threshold
Change-Id: I47970b804d2c590c37d3da5008db094241579e25
Bug #6836448
External bug: http://code.google.com/p/android/issues/detail?id=34946
DO NOT MERGE
DisplayListRenderer::drawPath was not invoking quickReject() properly,
passing x,y,width,height instead of left,top,right,bottom. A path
could thus get rejected when it should be drawn instead.
While working on this change I found a similar issue with another
drawing command, drawBitmapData().
Change-Id: I8306faf72db14d71b54ecb7de295c9a6957d9494
External bug: http://code.google.com/p/android/issues/detail?id=34946
DisplayListRenderer::drawPath was not invoking quickReject() properly,
passing x,y,width,height instead of left,top,right,bottom. A path
could thus get rejected when it should be drawn instead.
While working on this change I found a similar issue with another
drawing command, drawBitmapData().
Change-Id: I56484e8c101768cde6a78625290872f7849dd5ee
To enable it, the system property ro.hwui.text_gamma_shader must be
set to true. For testing, DEBUG_FONT_RENDERER_FORCE_SHADER_GAMMA
can be set to 1 in libhwui/Debug.h.
Change-Id: If345c6b71b67ecf1ef2e8847b71f30f3ef251a27