868 Commits

Author SHA1 Message Date
Romain Guy
3b753829ae 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
2013-03-05 10:27:35 -08:00
Romain Guy
19d4dd8599 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
2013-03-04 13:48:43 -08:00
Romain Guy
151b71cb52 Merge "Fix math issue when transforming text in perspective" into jb-mr2-dev 2013-03-02 02:08:18 +00:00
Romain Guy
874f5c6e4a Fix math issue when transforming text in perspective
Change-Id: Iad6b4e477c11bd1ef5f0ceab2fabcd440030154d
2013-03-01 18:07:35 -08:00
Romain Guy
28459117a7 Merge "Precache glyphs at final raster size" into jb-mr2-dev 2013-03-02 00:13:17 +00:00
Romain Guy
0f6675332c 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
2013-03-01 16:04:53 -08:00
Chris Craik
1da8a6a36d Merge "Add shader program selection shortcut" into jb-mr2-dev 2013-03-01 19:42:38 +00:00
Chris Craik
096b8d96d5 Add shader program selection shortcut
Add a key manipulation that makes black text/paths use the standard
simple bitmap/patch shader, since they are the same. Previously we'd
create a separate shader for each because the keys differed, even
though the shaders were functionally equivalent.

Also fixes some issues around setting DEBUG_PROGRAM

Change-Id: I0c77c684d58da03501ee9ab8239c7d4a70fd6b5c
2013-03-01 11:11:31 -08:00
Romain Guy
1361dff5eb Merge "Support 3D rotations when drawing text" into jb-mr2-dev 2013-03-01 00:05:51 +00:00
Romain Guy
a4adcf0239 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
2013-02-28 16:04:48 -08:00
Chris Craik
d6960a49b4 Account for text alignment in Op bounds calculation
bug:8243821

Previously this wasn't done for deferred clipping + reordering, so
non-left-aligned text would be clipped at defer time, when it wouldn't
have been at draw time (in OpenGLRenderer::quickReject())

Change-Id: Ic96949c2dca4378f284606b37d9411ed42f8d203
2013-02-28 11:25:39 -08:00
Romain Guy
19886f8b51 Merge "Properly scale text" into jb-mr2-dev 2013-02-28 01:05:34 +00:00
Romain Guy
c74f45a334 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
2013-02-27 15:49:57 -08:00
Chris Craik
d041e476f3 Merge "Correct sub-hairline tessellation threshold" into jb-mr2-dev 2013-02-27 23:49:37 +00:00
Chris Craik
d80806b305 Merge "Fix T-junctions in layers' generated meshes" into jb-mr2-dev 2013-02-27 23:47:55 +00:00
Chris Craik
19a390bff3 Correct sub-hairline tessellation threshold
Change-Id: Id868d41a36db5b4daa762d84b6329f9c31916bce
2013-02-27 15:43:26 -08:00
Romain Guy
a6456d0d7e Merge "Draw text drop shadows even when the text color is transparent" into jb-mr2-dev 2013-02-27 22:16:22 +00:00
Chris Craik
6c5b9be745 Fix T-junctions in layers' generated meshes
bug:4128442

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:
https://googleplex-android-review.googlesource.com/#/c/277668/
which adds Region::createTJunctionFreeRegion()

Change-Id: Ice75b4a1a4459ff835059ea81d70f7d1563fd96d
2013-02-27 14:03:19 -08:00
Romain Guy
768bffc9b8 Draw text drop shadows even when the text color is transparent
This matches Skia's behavior.

Change-Id: Ibf0a52611f5801cfa68169f66ab0ec06f256600f
2013-02-27 13:52:26 -08:00
Romain Guy
758724fd09 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
2013-02-27 11:53:12 -08:00
Romain Guy
08bca88b27 Rename debug property and expose it in HardwareRenderer
Change-Id: If46a9bc14a50f6c9a202d901881b36bbac32cba3
2013-02-25 16:21:30 -08:00
Romain Guy
3ff0bfdd14 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
2013-02-25 15:01:58 -08:00
Chris Craik
fb68065709 Merge "Add deferredList null check" 2013-02-23 00:42:53 +00:00
Chris Craik
ba868c3e22 Add deferredList null check
Needed for non-deferred mode (debug.hwui.disable_draw_defer = true)

Change-Id: I278cbe200aa6ce06fa92dc45c63ceda6e85a0cbe
2013-02-22 16:28:27 -08:00
Chris Craik
dd8697c095 Avoid double blur
bug:8204062

Avoids incorrectly blurring with RenderScript after a C++ blur

Additionally, avoids draw/blurring if the input text has empty bounds

Change-Id: Ibbaf74800fff7a6e4cda3aa24286b90e7aef589d
2013-02-22 16:16:16 -08:00
Romain Guy
505d1d64ed Merge "Prettify display lists logging" 2013-02-22 21:45:57 +00:00
Romain Guy
7031ff68bb Prettify display lists logging
This change makes it a lot easier to see the tree structure.

Change-Id: I4969abd1eb010f1d529671f8d86dc4c930be24f6
2013-02-22 11:51:15 -08:00
Chris Craik
94b97b38b7 am eab51de4: Merge "Fix clipping and stencil layer issues"
* commit 'eab51de4de88219256260fe26e2018a6234ef83b':
  Fix clipping and stencil layer issues
2013-02-21 19:31:17 -08:00
Chris Craik
b98a016c67 Fix clipping and stencil layer issues
bug:8235699

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

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

Change-Id: I6730f1a80250bcf3f91cd4afde646d470a12dbc2
2013-02-21 16:12:00 -08:00
Ben Cheng
08d160a366 am 7a60c43d: Merge "Use free for memory chunks allocated through memalign."
* commit '7a60c43d874bd047ea4b93b94c9b8771ea5739cc':
  Use free for memory chunks allocated through memalign.
2013-02-20 14:39:35 -08:00
Ben Cheng
7a60c43d87 Merge "Use free for memory chunks allocated through memalign." 2013-02-20 22:34:58 +00:00
Ben Cheng
15641a6181 Use free for memory chunks allocated through memalign.
BUG: 8234423
Change-Id: Ic4100a780908c94540722cc4af5f73f4940431b4
2013-02-20 13:20:03 -08:00
Chris Craik
c4ca87f0f4 am 8a47d8ea: Merge "Clean up clipping and deferral logic"
* commit '8a47d8eaec26d0937aee94a057f561f246748339':
  Clean up clipping and deferral logic
2013-02-20 10:42:40 -08:00
Chris Craik
8a47d8eaec Merge "Clean up clipping and deferral logic" 2013-02-20 18:40:03 +00:00
Chris Craik
5d11676414 Clean up clipping and deferral logic
bug:8037003

-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
calculation

Change-Id: I5d5149d2c624f01e3fe46628bf156e835e69b9d5
2013-02-19 18:56:10 -08:00
Romain Guy
846f5f238f am e91efaba: Merge "Expose display list APIs"
* commit 'e91efabaf2c51d017bf4c5bc4e06491c3511f4e5':
  Expose display list APIs
2013-02-19 12:36:28 -08:00
Romain Guy
52036b19a5 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
2013-02-19 12:30:02 -08:00
Chris Craik
620cff4006 am ad82f20d: Merge "DisplayList draw operation reordering"
* commit 'ad82f20d2382396f5ac75fdf6f7db5c4da1c4c23':
  DisplayList draw operation reordering
2013-02-19 09:56:33 -08:00
Chris Craik
ad82f20d23 Merge "DisplayList draw operation reordering" 2013-02-19 17:53:50 +00:00
Chris Craik
eea34dab43 am ac838a3a: Merge "Correct PatchCache comparison logic"
* commit 'ac838a3ab9d85112576cf2c943930441f62c51d2':
  Correct PatchCache comparison logic
2013-02-15 19:41:32 -08:00
Chris Craik
ac838a3ab9 Merge "Correct PatchCache comparison logic" 2013-02-16 03:36:37 +00:00
Chris Craik
9935abceea Correct PatchCache comparison logic
Change-Id: I3d0832505b5380bfa362863b39e09dd10f792582
2013-02-15 19:33:43 -08:00
Chris Craik
225e8943de am 857089eb: Merge "Adjust offset for non-AA line drawing"
* commit '857089eb1efcc7d86f373edf8cb30911a95f6bac':
  Adjust offset for non-AA line drawing
2013-02-15 18:11:13 -08:00
Chris Craik
857089eb1e Merge "Adjust offset for non-AA line drawing" 2013-02-16 02:09:22 +00:00
Chris Craik
62a42c13a6 Adjust offset for non-AA line drawing
bug:8114304

The original .375 was chosen to make GL_LINES align with Skia drawing.
The new value of .065 is chosen to be as small as possible to make
triangle-based lines align with Skia, while keeping lines drawn on
integer coordinates unambiguous as to which column/row they draw on.

Also adds more lines in CanvasCompare test to highlight the difference

Change-Id: If578684f2db320682219c3caa625cf79bc62d88f
2013-02-15 14:53:12 -08:00
Romain Guy
df93fdb6c0 am aa8307b9: Merge "Remove obsolete header file"
* commit 'aa8307b991b9fca5403b5d7f43659b92527af4fd':
  Remove obsolete header file
2013-02-15 14:28:19 -08:00
Chris Craik
c3566d0642 DisplayList draw operation reordering
bug:8037003

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:
    "debug.hwui.disable_draw_defer"
    "debug.hwui.disable_draw_reorder"
which can be set to "true" to control the display list manipulation

Change-Id: I5e89f3cb0ea2d2afd3e15c64d7f32b8406777a32
2013-02-15 13:30:09 -08:00
Romain Guy
13ba005484 Remove obsolete header file
We now use the same mechanism to compare keys everywhere in libhwui.

Change-Id: I8b3cb25b13f4f38eb6f12aed0356f796a773617c
2013-02-15 12:47:26 -08:00
Kristian Monsen
41250b67fe resolved conflicts for merge of 101ae3bb to master-chromium
Only include file changes in conflict.

Change-Id: I1b6eb3343e7163827d8031ffea4b77f294980ccc
2013-02-14 23:59:27 -08:00
Chris Craik
101ae3bb39 Merge "Move DisplayList to its own cpp file" 2013-02-15 00:50:52 +00:00