30 Commits

Author SHA1 Message Date
Romain Guy
b50149825f Correctly apply linear filter to drawBitmap(Rect, Rect)
Change-Id: I1049282e1996b1020c92cb7bec46e9f28e94e967
2011-07-28 15:40:47 -07:00
Romain Guy
f9284695e8 Add new ViewDebug APIs to profile the event queue.
Change-Id: I225bf288780b0244f459316e2765cfa29cd22c89
2011-07-15 11:25:11 -07:00
Romain Guy
5fccb70de9 Add test for bug #4970944
Change-Id: I3e7287bc406ff497a49cf823cee53b1a943a74a9
2011-07-11 18:23:09 -07:00
Romain Guy
1e59f9d10d Fix texture coordinates for sub-bitmap rendering.
Change-Id: I05a31775e03f5b223a55a5144d420351abac89be
2011-05-26 18:39:34 -07:00
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
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
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
42f3a4b7c3 Make embedded hardware layers work.
Bug #3369474

Change-Id: Ib6d7fb44eedda9dc2933b5e1b176f307968af91d
2011-01-19 13:42:26 -08:00
Romain Guy
fb13abd800 Fix 9patch rendering in ExpandableListView.
Change-Id: I60843d61a40b0cb7dd09923cb4489a5a76f20486
2011-01-16 15:16:38 -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
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
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
e5ebcb0107 Fix clipping issue in StackView.
Change-Id: I7ec28f25c3993a2bd7ef6399ba1923839d239905
2010-10-15 13:57:28 -07:00
Romain Guy
7975fb6d12 Apply bilinear filtering to text.
Change-Id: I2c81ad657ee2a11a2139e0b11ae3749db54c0749
2010-10-01 16:36:14 -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
f607bdc167 Correct implementation of saveLayer().
Change-Id: I5375126636913e0a84f2d6bbd0ebe40d2e4f2763
2010-09-12 12:24:12 -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
e9e7fd0813 Update OpenGLRenderer test to test opaque ARGB8888 bitmaps.
Change-Id: I7159825f4b1d6f5a1cd09ec091994801b52b6bda
2010-08-19 14:45:42 -07:00
Romain Guy
8fb954263d Fix save()/restore() issues in the OpenGL renderer.
The save stack now behaves exactly like in Skia.

Change-Id: If7e642f41f2c8f693f6e8c26cba81507d466562e
2010-08-17 18:40:21 -07:00
Romain Guy
1d83e1981c Correctly set the viewport in layers.
Bug #2919295

Change-Id: I16ce79ab0d5747cb01c6c1abe531da3dfd93fb54
2010-08-17 11:37:00 -07:00
Romain Guy
09147fbdc8 Add support for text culling.
Change-Id: Ibf0adacdc5c64d40a8000b21d7cb0797d63efe29
2010-07-22 13:08:20 -07:00
Romain Guy
f86ef57f8b 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
2010-07-01 15:27:21 -07:00
Romain Guy
ce0537b800 Add hooks for drawBitmap().
Change-Id: I58e962c3a8b2bc75c2605fe369ad3002579d86e0

Add texture cache.

Change-Id: I1c0e5581d228869e114438258a1014e33e024ad7
2010-06-30 15:21:01 -07:00