90 Commits

Author SHA1 Message Date
Romain Guy
7b5b6abf85 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
2011-03-14 18:05:08 -07:00
Romain Guy
cabfcc1364 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
2011-03-07 18:09:03 -08:00
Romain Guy
47b8adec39 Add a new Camera API to control the camera's location
Change-Id: Id9a082d2def803eb527e1987875e0d8a22c6e8aa
2011-02-23 19:51:42 -08:00
Romain Guy
b18d2d0079 Dirty layers in the area covered by a drawBitmapMesh() call
Bug #3410827

Change-Id: Ic8b4f6201af94497bba86c75819588c78debddc2
2011-02-10 15:52:54 -08:00
Romain Guy
f28daffda5 Empty the clip rect when intersection is empty.
Bug #3410035

Change-Id: I5ceb80514d3b20c9ad230478549ad31ced403d53
2011-02-04 00:59:34 -08:00
Romain Guy
09b7c91de7 Allocate layers from the layers pool.
Bug #3413433

This change will be beneficial to Launcher to avoid hiccups when
swiping pages of icons. When a layer is discarded, it is kept
in the layers pool instead of being destroyed right away. This
favors memory reuse over allocations.

Change-Id: Ifb6944ba83d6ceb67c331527c0827b26ce648eb1
2011-02-02 20:28:09 -08:00
Romain Guy
849d0a37cf New API to let apps draw without layers.
Bug #3413433

Launcher now enables layers all the time, but in some cases (for instance, when the
workspace is not scrolling,) it is more efficient to draw without the layer.

Change-Id: I625fb5b48506acda9ae75356fdbbe812c85f2aab
2011-02-01 17:56:09 -08:00
Romain Guy
54229ee5eb Correctly set the alpha of a hardware layer before drawing it.
Bug #3410819

Change-Id: I3ebaca2233f4edf5b59d84ec7706555056a1a4b1
2011-02-01 13:05:16 -08:00
Romain Guy
7d7b5490a0 Enable partial invalidates when rendering with OpenGL.
Change-Id: Ie8be06c4776b815e8737753eb8003b4fd8936130
2011-01-24 18:39:56 -08:00
Romain Guy
a566b7c3aa Fix bitmap meshes to work in display lists.
Change-Id: Ie226d049840942d9ad9cf58e0c19132f49d62a75
2011-01-23 16:36:11 -08:00
Romain Guy
8b2f5267f1 Add support for arcs.
Change-Id: I96c057ff4eb1b464b03f132da0b85333777bee4f
2011-01-23 16:15:02 -08:00
Romain Guy
c1cd9ba335 Add support for ovals and stroked rectangles.
Change-Id: I1292e241386763c82e6622c8f7ed90b0f5b7bd4f
2011-01-23 14:18:41 -08:00
Romain Guy
5a7b466a2b Add support for drawBitmapMesh().
Change-Id: Ic77f9c534bb90dc7b9458299544bd50b8b6ae6a5
2011-01-20 19:09:30 -08:00
Romain Guy
01d58e43ed Add rounded rects and circles support to OpenGLRenderer.
Change-Id: I6cedf2b495d58de7c0437096809fa9e4518a1b8c
2011-01-19 21:55:10 -08:00
Romain Guy
42f3a4b7c3 Make embedded hardware layers work.
Bug #3369474

Change-Id: Ib6d7fb44eedda9dc2933b5e1b176f307968af91d
2011-01-19 13:42:26 -08:00
Romain Guy
2577db1ec1 Add support for Paint::setTextSkewX in OpenGLRenderer.
Bug #3360888

Change-Id: I42e81a1f10bf7b9ae1c63ca8add1878fd59a1e8a
2011-01-18 13:02:38 -08:00
Romain Guy
807daf7df6 Add support for skew()
Change-Id: Ia3a9a867f74fd78b61f75179e3788fdc2f0cacd0
2011-01-18 11:19:19 -08:00
Romain Guy
d6cd572df8 Improve hardware layers rendering speed when setting a View's alpha.
Change-Id: Ib1275677f531c60d9919978c5538c663fdb823b5
2011-01-17 14:42:41 -08:00
Romain Guy
2361098da3 Add BitmapFactory.Options.inMutable to load mutable bitmaps.
Change-Id: Iaa222127520f3aa55072d44af12ee3477908b876
2011-01-17 13:04:12 -08:00
Romain Guy
fb13abd800 Fix 9patch rendering in ExpandableListView.
Change-Id: I60843d61a40b0cb7dd09923cb4489a5a76f20486
2011-01-16 15:16:38 -08:00
Romain Guy
6c319ca127 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
2011-01-11 17:53:19 -08:00
Romain Guy
7230a74e9a 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
2011-01-10 22:26:16 -08:00
Romain Guy
171c592f0b 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
2011-01-06 18:34:30 -08:00
Dianne Hackborn
9f0696709b We are now Honeycomb.
Change-Id: I69dadd57184d2d80f426c1c862ed0a040c8baf03
2011-01-06 12:57:49 -08:00
Xavier Ducrohet
d38e776a3c LayoutLib: support for layers.
Layers require that drawing methods potentially
draw in more than one bitmaps.

To handle this this patch offers the following:
- move all drawing methods to use Drawable
- Drawables are now handled by GcSnapshot since
  its the one handling the layers
- moved Canvas_Delegate.createCustomGraphics to
  GcSnapshot which does not expose the Graphics2D
  objects anymore so its draw() methods are the only
  way to draw.
- handles creating layers in GcSnapshot.save() and
  blitting them in restore()

Other changes:
- Clean up the create/save API in GcSnapshot
- Fixed drawing bitmaps with alpha and other
  composite modes.

Change-Id: I1e230087493d044a10de71f4b6d29083e3f3bf64
2010-12-22 10:30:53 -08:00
Xavier Ducrohet
63fd87113c LayoutLib: Misc rendering fixes.
- always set up the stroke. Paint may not have the proper
  style when drawing lines. stroke should still be setup.

- Fixed vertical linear gradient. Old code generated
  a gradient ratio of NaN

- Fixed alpha rendering when using shaders. In that
  case the alpha channel from the paint color should be
  used in conjunction with the shader.

- Fixed miter limit. Java expects the value to be multiplied
  by the stroke width

- Fixed support for drawing ALPHA_8 bitmaps. Java2D doesn't
  have bitmaps with only alpha channels, so we keep using
  ARGB bitmaps but when drawing them into a bitmap we erase
  the color information.

Change-Id: I4f04341fc843e3f7dadd1fdbf709b11a4f1e24b9
2010-12-21 10:43:18 -08:00
Xavier Ducrohet
d348b6eaa9 LayoutLib: support for Path and BitmapShader using delegates.
Also created delegates for all missing shader, xfermode
and patheffect classes. Moved the logic of the xfermode,
and patheffects that was in Canvas_Delegate into the
xfermode/patheffect classes, and added support (in all
3 clases) for knowing if the shader/xfermode/patheffect
is actually supported or not. Make use of fidelityWarning
in LayoutLog if they are not.
2010-12-21 10:43:18 -08:00
Romain Guy
b146b1214e Fix text shadow rendering issue.
Change-Id: Ic9eb0d38ad684d2f2c95a4f586f865db911cb872
2010-12-15 17:28:30 -08:00
Xavier Ducrohet
ec31a7f119 Create some layout files for HwAccelerationTest
The goal is use the app to test layout lib, so layout
files are needed, and custom views must be instantiable
(ie public)

Change-Id: I46bb3d8af6e4d7973d041aa618f1c7762efd93d0
2010-12-14 14:58:59 -08:00
Romain Guy
a957eea785 New, better line drawing implementation.
Bug #3207544
Bug #3225875

Change-Id: Ibdd1dfc64e01625d5c441f39eb0aa3ee647f6ff5
2010-12-08 19:06:58 -08:00
Romain Guy
5ec9924d24 Fix rendering issue with layers.
Change-Id: I1d511ab2707000762a942d32c300a9944ab38603
2010-11-03 16:19:08 -07:00
Romain Guy
8164c2d338 Don't change textures wrap modes on every draw.
Change-Id: If6d3f313778cc7f3e803a063338539c8b3e165e3
2010-10-25 18:03:28 -07:00
Romain Guy
e5ebcb0107 Fix clipping issue in StackView.
Change-Id: I7ec28f25c3993a2bd7ef6399ba1923839d239905
2010-10-15 13:57:28 -07:00
Romain Guy
14830948d0 Add 3D transforms support to all gradients.
Change-Id: I61409edd00dab3a11684a3f5e4f7df0afc734758
2010-10-07 15:07:45 -07:00
Romain Guy
e3095e0c1e Apply 3D transformations to gradient shaders.
This fixes only linear gradients. Sweep and radial gradients, as well as
bitmap shaders, will be fixed in a future commit.

Change-Id: I4eee4ff62e9bbf3b9339fc111a780167449ecfef
2010-10-06 16:57:29 -07:00
Romain Guy
469b1dbeaf Code cleanup and disable display lists for now.
Change-Id: I681213036b5279339cb96a016d1dfb15d74dafc8
2010-10-05 13:42:35 -07:00
Romain Guy
7975fb6d12 Apply bilinear filtering to text.
Change-Id: I2c81ad657ee2a11a2139e0b11ae3749db54c0749
2010-10-01 16:36:14 -07:00
Romain Guy
0bb5667b4e 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
2010-10-01 00:25:02 -07:00
Romain Guy
ddb80bebb0 Add support for circular gradients to the GL renderer.
This change also adds full support for local transformation matrices on
sweep and radial gradients.

Change-Id: Id8773bc0766575190e3f3d51984fc5e57b266c3f
2010-09-21 16:48:50 -07:00
Romain Guy
ee916f14cb Add support for SweepGradient in the GL renderer.
Change-Id: I7aa397ed4e34655ead9ba1f5b4ce087665e0f022
2010-09-20 17:54:17 -07:00
Romain Guy
759ea80dca Add support for drawLines(), with anti-aliasing
Change-Id: I16c0593c5671490909dec13a85df601e1428a1a6
2010-09-16 20:49:46 -07:00
Romain Guy
6820ac8b14 Fix 9patch rendering.
Change-Id: Ic4c18ff483cca95fbabcb10843f7714efe488adb
2010-09-15 18:11:50 -07:00
Romain Guy
8411f336c7 Fix rendering issue with layers intersecting the clip rect.
Change-Id: Icbe35194fa219ef13ce639d33631235f8d7df3d7
2010-09-13 17:27:57 -07:00
Romain Guy
8694230ff2 Optimize calls to glCopyTexImage2D().
Change-Id: I34ee87bd4472864f440916e03a2894fae24bbe4a
2010-09-12 13:02:16 -07:00
Romain Guy
f607bdc167 Correct implementation of saveLayer().
Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
2010-09-12 12:24:12 -07:00
Romain Guy
a5aed0d589 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
2010-09-09 14:42:43 -07:00
Romain Guy
53389bdcdf Correctly set the viewport on window resize.
Change-Id: Idec325264d85feda76d4cda00fa511aaac82cf64
2010-09-07 17:16:32 -07:00
Romain Guy
4299c0f242 Add test for gamma correction.
Change-Id: Id2a311bc116438d3627a943cb5fb1ba8dc121bb0
2010-08-27 16:56:50 -07:00
Romain Guy
fb8b763f76 Use only one GL context per process, share chaches.
Change-Id: Ieabaa25338d2f4b8d4fd90e7401ad6e7452eae11
2010-08-24 17:18:14 -07:00
Romain Guy
a80d32f7b6 Add support for textScaleX.
This will not look great because we render fonts using bitmaps, not
paths.

Change-Id: I01b87b81bfbdbfa28460a5d5309d38e2a65e77c4
2010-08-20 18:42:37 -07:00