4508 Commits

Author SHA1 Message Date
Chet Haase
c0c1c94e2d Merge "Avoid thrashing the glyph cache during the precache phase" into jb-mr1-dev 2012-08-30 09:29:37 -07:00
Chet Haase
f942cf10e0 Avoid thrashing the glyph cache during the precache phase
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
2012-08-30 09:14:44 -07:00
Chet Haase
63f2fcae3e Merge "Fix bug with Fbo layer clipping" into jb-mr1-dev 2012-08-30 07:22:37 -07:00
Romain Guy
7808581ca3 Merge "Pre-multiply color components for 2-stop gradients Bug #7033344" into jb-mr1-dev 2012-08-29 21:56:44 -07:00
Romain Guy
d679b57ef2 Pre-multiply color components for 2-stop gradients
Bug #7033344

Change-Id: Ia168501f1dc56ba7a1bb0c55078320432309a66a
2012-08-29 21:56:18 -07:00
Chet Haase
d48885a6c8 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
2012-08-29 17:41:49 -07:00
Chris Craik
a798b95a9e Use smoothstep to eliminate branches in AA shader
Change-Id: If4ecb1a9446f29b2f8444f5cee551f863c1993e8
2012-08-29 11:14:52 -07:00
Chet Haase
5a3ec7113c Fix glyph cropping bug
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
2012-08-17 16:03:27 -07:00
Chet Haase
378e919ccb Remove CacheTextureLine structure from FontRenderer
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
2012-08-16 09:11:49 -07:00
Chet Haase
6b7d46b78c Merge "Restore scissor state correctly" into jb-mr1-dev 2012-08-15 14:40:36 -07:00
Chet Haase
2efd5c5886 Glyph cache optimization
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
2012-08-15 14:19:20 -07:00
Chet Haase
8025061c59 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
2012-08-15 13:49:42 -07:00
Chet Haase
e816baea65 Optimize interactions with glyph cache
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
2012-08-14 10:33:30 -07:00
Romain Guy
320d46bf84 Reduce gradients textures size whenever possible
Change-Id: Ifd58625ee62edac3b5d20b77553cb98b6fa2b46e
2012-08-08 16:05:42 -07:00
Romain Guy
c89b14bba0 It seems that apparently useless public APIs are actually useful
Bug #6953651

Change-Id: Ic47ce504e63262711f5d3edc76f7d2b9c12471ad
2012-08-08 14:58:54 -07:00
Jean-Baptiste Queru
b6039811fa am 05e97e81: am 0be33f2d: Merge "Add shortcut to avoid potential divide by zero in some case"
* commit '05e97e81a5fa2c9cab4cdda15aa2d036243a0c0e':
  Add shortcut to avoid potential divide by zero in some case
2012-08-08 14:08:35 -07:00
Jean-Baptiste Queru
05e97e81a5 am 0be33f2d: Merge "Add shortcut to avoid potential divide by zero in some case"
* commit '0be33f2d522f76f48062a59ddb520815a0851875':
  Add shortcut to avoid potential divide by zero in some case
2012-08-08 14:03:58 -07:00
Romain Guy
33fa1f774c 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
2012-08-07 19:09:57 -07:00
Romain Guy
17112ad8a2 Cleanup of libhwui
Change-Id: Ib7f5771548462c00027a8ad57badfb68c50644f9
2012-08-07 11:25:15 -07:00
Romain Guy
8c654e0934 Merge "Add new debug tool to track hardware layers updates" into jb-mr1-dev 2012-08-06 14:52:41 -07:00
Romain Guy
4ff0cf4b83 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
2012-08-06 14:51:10 -07:00
Mathias Agopian
4cb3384772 Merge "libutils cleanup" into jb-mr1-dev 2012-08-06 13:12:28 -07:00
Mathias Agopian
69a3ce1eb1 libutils cleanup
Change-Id: Ic069539338ba4097dba9399904f02bbd0296c20e
2012-08-05 12:38:51 -07:00
Romain Guy
8801b2fef3 Bowing my head in shame
Bug #6924514

Change-Id: Ifcc08fb5dbaf3f9c6ac3a3e618db2fd6349dc290
2012-08-03 17:43:31 -07:00
Romain Guy
18edb81172 Avoid crash when dumping display lists
We recently changed the drawText implementation to accept more parameters
which were not taken into account during a dump operation.

Change-Id: Ia1dc682dc7bb2bb02a1f4a514ed5af5556f92a97
2012-08-03 16:08:56 -07:00
Romain Guy
a70cd04985 Merge "Add dithering to gradients" into jb-mr1-dev 2012-08-03 11:09:49 -07:00
Romain Guy
211efea737 Add dithering to gradients
Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419
2012-08-01 19:18:35 -07:00
Raph Levien
1ae49ab865 Merge "Fix bug 6892600 Font (character pairs) rendering issue" into jb-mr1-dev 2012-07-31 19:26:55 -07:00
Romain Guy
42e1e0d482 Improve gradients
Avoid using textures for common gradients (two stops from 0.0 to 1.0)

Change-Id: Iff55d21b126c8cfc4cfb701669f2339c8f6b131a
2012-07-31 18:55:16 -07:00
Raph Levien
8b4072d3fb 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
drawTextDecorations).

Change-Id: Id3dcd62de5536a26b158d768889273a1492b35d6
2012-07-30 15:53:16 -07:00
Romain Guy
c25259519f Rename drawGeneralText to drawText
Change-Id: I5062ea5b0605fc7af27f410fafc930d10f38e926
2012-07-27 16:41:22 -07:00
Chen YANG
0412cfcbcd Add shortcut to avoid potential divide by zero in some case
Change-Id: If4b34c95402daf8ebcc28736edfb2012553aa57c
2012-07-25 14:19:29 +08:00
Raph Levien
996e57c843 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
2012-07-23 16:52:20 -07:00
Romain Guy
98ba89492a Make gradients look slightly better
Change-Id: Ib12c628a88b9ec6af1214ce6e5cb14cfde40485e
2012-07-20 16:58:45 -07:00
Raph Levien
00755fed35 Merge "Add drop shadow for drawPosText in hwui renderer." 2012-07-20 14:24:20 -07:00
Raph Levien
416a847633 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
2012-07-20 12:55:30 -07:00
Romain Guy
8dcfd5e836 Clamp gradient textures to max GL texture size
Change-Id: I8ce4e50988f5194fe5ce4bde7945ec01673af3cd
2012-07-20 11:47:57 -07:00
Romain Guy
0aa87bbfc4 Fix crash with new LookupGammaFontRenderer
Bug #6853934

Change-Id: I15e6ca73bfe00eff1a37c4b9d2f7f709ee018eb6
2012-07-20 11:14:32 -07:00
Romain Guy
eb61cd8296 Optimize gradient textures
Compute the size of the backing textures based on the maximum possible
number of shades in the gradient.

Change-Id: I2d7f20477d31b81e9735f2c1d83ebdd0dbcbe340
2012-07-18 20:39:45 -07:00
Romain Guy
243924b08f am 3409e728: Correctly pre-clip paths when recording display lists Bug #6836448 External bug: http://code.google.com/p/android/issues/detail?id=34946
* commit '3409e728e22609b54de8b33d1e614ca51f6d6a77':
  Correctly pre-clip paths when recording display lists Bug #6836448 External bug: http://code.google.com/p/android/issues/detail?id=34946
2012-07-18 20:14:02 -07:00
Romain Guy
6355347813 Remove vendor specific precision qualifier
Change-Id: I0a56ca7a5a399ec94993d3cea0c4aff6c0f86e39
2012-07-18 20:04:14 -07:00
Romain Guy
8e025de5fb Note to self
Change-Id: Ic5699bdbf880ad68748c827bb5b4976b12d4d413
2012-07-18 19:12:11 -07:00
Romain Guy
04299385c6 Clip lines, AA rects and points correctly
Change-Id: I900dd986f397b66f133e6021aa4c2539e7abc2b9
2012-07-18 17:15:41 -07:00
Romain Guy
dfab50d8b9 Tweak text gamma correction
Change-Id: Icd3326e6a054d6020c3ed61c8459394bc87401dd
2012-07-18 17:06:37 -07:00
Romain Guy
6e25e38e43 Add a new method for text gamma correction
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
2012-07-18 16:28:44 -07:00
Romain Guy
3409e728e2 Correctly pre-clip paths when recording display lists
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
2012-07-17 18:01:51 -07:00
Romain Guy
95c21d0546 Correctly pre-clip paths when recording display lists
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
2012-07-17 17:48:04 -07:00
Romain Guy
8a4ac610e1 Don't clear the dirty clip flag if it's not applied
Bug #6833979

Change-Id: I0ea78b7f31a557a335de10d910d03b0520029080
2012-07-17 17:32:48 -07:00
Romain Guy
4121063313 Add shader-based text gamma correction
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
2012-07-16 17:04:24 -07:00
Romain Guy
157bd5749f Add makefile flags for perf
Change-Id: Ibcb6e1c883551273c3392cdaa40cd0b71a3bfa70
2012-07-16 15:17:38 -07:00