387 Commits

Author SHA1 Message Date
Romain Guy
5a6d3a4c03 Stupid fixed point math.
Bug #5423215

Change-Id: I39379e1f8fb4d59de4ede6e4fe7cf7a2c7cc625a
2011-10-07 15:03:24 -07:00
Romain Guy
ed7a8fc768 Canvas.getClipBounds() was broken and unreliable with OpenGL ES 2.0
This bug was affecting several third party applications. The bug was
introduced by an optimization that prevented the local clip to be
recomputed when needed.

Change-Id: I7b5c464db21b5ff1a7274af75a3a64d0e9d84772
2011-10-04 19:21:27 -07:00
Romain Guy
59c7f80dd2 TextureView works best when it draws stuff.
Bug #5391188

Change-Id: I5e754881ccb08ff288ebd60de77282c9cbcf3f86
2011-09-29 17:21:45 -07:00
Mathias Agopian
83b186a246 fix the float Rect in OpenGLRenderer to handle NANs
- we want functions like isEmpty() to return true if NANs are
involved in the Rect

- also clean-up the intersect familly of calls

- minor cleanup in the int32_t Rect as well

These played a role in http://b/5331198.

Bug: 5331198

Change-Id: I5369725ab482e4b83da9f1bd4cee5256e5de75b2
2011-09-19 16:50:07 -07:00
Jeff Brown
13ede62fd7 Make LTE_FLOAT a strict weak order.
Bug: 5327776

Currently LTE_FLOAT isn't even a valid partial order, let alone
a strict weak order as needed by binary search.  Consequently,
KeyedVectors with keys whose types have operator< using LTE_FLOAT
sometimes find the wrong values!

This problem affects several graphics caches including the
TextLayoutCache.

(This is still not a total order because NaNs are not comparable
but hopefully we don't ever search for NaNs this way!)

Change-Id: Ic447a34c7d87f681ee81538f22a0937a039072dd
2011-09-16 12:00:05 -07:00
Romain Guy
2ffefd48e2 Add support for 3 new blend modes when blending with framebuffer:
Add
  Multiply
  Screen

Change-Id: I92a3c2612c86613087568bf0c03cc6f92b5ded44
2011-09-08 15:33:03 -07:00
Romain Guy
8a3957d43b Add reminder in the code to fix T-junctions
Change-Id: I52b112694f930e641f01fb78dc55412986023411
2011-09-07 17:55:15 -07:00
Romain Guy
799833a8b4 Text would disappear when the font size is 75px.
Bug #5230196

Yes, 75px. Any other font size would work. Don't ask.

Change-Id: I96c7db9926a97f65128d60c8238c3640ee2444ba
2011-08-30 14:41:48 -07:00
Romain Guy
04c9d8c2ff Optimize display lists
Remove redundant or useless operations

Change-Id: If989b4eaa9143eef4254c38b39959aeed1f2b9ab
2011-08-25 14:01:48 -07:00
Romain Guy
631582f7f7 Enable linear filter when scaling bitmaps
Bug #5205673

Change-Id: I8b0f90877df6b6c6757d35dcf6cd14e79e840b96
2011-08-24 11:51:35 -07:00
Romain Guy
6816972eb6 Don't use bilinear filtering on unscaled bitmaps
Bug #5198590

Change-Id: I4333d850501ac849eeeeb247e4178dd469b9de3d
2011-08-22 17:33:33 -07:00
Romain Guy
28d8ff6dbc Move constants to the correct header
Change-Id: Id4bd14f72487bd7156cd2e1930eaf97b47896273
2011-08-22 14:01:34 -07:00
Romain Guy
302a9df1d5 Add an API to set the transform on a TextureView's surface texture.
Bug #5156689

Change-Id: I635a625885c9b832a60d44ece0de7613ceb84109
2011-08-16 13:55:02 -07:00
Romain Guy
e5df231434 Make sure we correctly copy caches keys.
Bug #5136067

Change-Id: I366e840bef44415436dc7b13d89cfb610feed663
2011-08-12 14:23:53 -07:00
Romain Guy
9d865512f1 Remove unnecessary private API
Change-Id: I2ecb367528ec0691c07153a3d163b82a6ca33fdf
2011-08-11 17:37:02 -07:00
Romain Guy
4974bc1be6 Prevent crash when purging the gradients cache.
Bug #5133876

Change-Id: I3d1fa4e29498044796d725337ac93e6a1e8f0bcb
2011-08-08 10:55:55 -07:00
Romain Guy
bd496bc3d4 Paint style and stroke width affect text rendering.
Bug #5112207

Change-Id: Ic34037ace21a5058ba23dd15e51aae58c998454d
2011-08-02 17:32:41 -07:00
Romain Guy
6203f6c814 Reduce the amount of data cached by the gradients cache.
Change-Id: I8546f5a5ecf38031c9a40bdcc434d4c7f22da63d
2011-08-01 18:56:21 -07:00
Romain Guy
a60c388971 Use high precision iterators on specific GPUs
Bug #5098359

Change-Id: I52ee8c7b4c9e8d4c7bedb684eaf7bef6c44c74b9
2011-08-01 15:28:16 -07:00
Romain Guy
b50149825f Correctly apply linear filter to drawBitmap(Rect, Rect)
Change-Id: I1049282e1996b1020c92cb7bec46e9f28e94e967
2011-07-28 15:40:47 -07:00
Romain Guy
65b345fa22 Reclaim more memory, more often.
Yay.

Change-Id: I04557ad575c307a55088549f48f0e9ad994b7275
2011-07-27 18:51:50 -07:00
Romain Guy
6d7475d666 Destroy layers and flush layers cache when a window is destroyed.
Change-Id: I3fa1bc3ff50fb99e3d2e490925bd6b0a0f809fff
2011-07-27 16:29:39 -07:00
Romain Guy
eea60692b0 Improve layers debugging
Change-Id: Ia4950dd5f0e0a224ecb69c581d33aa4f32260a7c
2011-07-26 20:35:55 -07:00
Romain Guy
912a7b32d0 Make sure we have a current EGL context when invoking EGL
Bug #5081795

Change-Id: Iee3382d362a71c1e6c5c498b319bf7f7bcf5a2f0
2011-07-26 18:57:28 -07:00
Romain Guy
e3c26851dc Improve rendering performance on some GPUs
This change sets textures filtering to GL_NEAREST by default. GL_LINEAR
filtering is only used when textures are transformed with a scale or
a rotation. This helps save a couple of fps on some GPUs.

Change-Id: I1efaa452c2c79905f00238e54d886a37203a2ac1
2011-07-25 16:36:01 -07:00
Jeff Brown
162a021756 Decouple GLES20RecordingCanvas lifetime from GLES20DisplayList.
Bug: 5062011

Previously, each GLES20DisplayList would hold onto an instance of
GLES20RecordingCanvas.  In turn, each GLES20RecordingCanvas
held onto an SkWriter with a 16Kb buffer along with several other
objects.  With one display list per view and hundreds of views,
the overhead could add up to a few megabytes.

Ensured that the GLES20RecordingCanvas is reset as soon as
the display list has been constructed, thereby promptly freeing
the 16Kb buffer.

Changed GLES20DisplayList so that it acquires a GLES20RecordingCanvas
from a pool as needed and recycles it when done.

Removed some dead code and cruft related to the construction of
GLES20Canvas objects in general.  Some code was written with the
assumption that the underlying renderer object could change
behind the scenes or might be lazily constructed, but that isn't
actually the case so we can simplify things.

Removed an unnecessary weak reference from GLES20DisplayList
to the View.  It isn't actually used anywhere.

Fixed a bug in GLES20DisplayList where isValid() would return
true while the display list was being recorded.  This is incorrect
because the native display list might not actually exist.  Worse,
even if the native display list does exist, it is stale and
potentially refers to old Bitmaps that have been GC'd (because the
mBitmaps list was cleared when recording started).

Change-Id: Ib12d5483688cb253478edeb0156d34c476c2566b
2011-07-21 17:15:48 -07:00
Romain Guy
f2fc460a95 Reduce the fade area to save bandwidth.
Change-Id: I8ccea17fc1fb3c132329baa0acc1b3d5a140a5c6
2011-07-19 15:20:03 -07:00
Romain Guy
bdf7609867 Trim OpenGLRenderer's memory usage whenever possible
Change-Id: I9225077184f374b1a43300add15cc1d5b6869d1c
2011-07-18 15:00:43 -07:00
Kenny Root
042f7d64b5 Fix debugging for hwui caches
Debugging code attempted to delete a stack item.

Also, the flag fields weren't exactly clear, so rewrite it so it's
clear that kDebugMoreCaches is a combined flag.

Change-Id: If42b7f0f754919343301da5656aee5943cc9bd4a
2011-07-13 09:51:00 -07:00
Romain Guy
40c4b86b72 Align paths on pixel boundaries when rasterizing in bitmaps.
Bug #5003739

Change-Id: I3dfbf4eb92e2c870f33c96947a7d6439e3730965
2011-07-08 16:50:15 -07:00
Romain Guy
b2479153b7 Correctly position layers.
Change-Id: I1678b1c5bdab140b44e56556c50ab8329255f18a
2011-07-08 11:57:29 -07:00
Romain Guy
ec19b4a764 Use NEAREST filtering mode for TextureView.getBitmap().
Change-Id: I4649062bbdf18ebba7924bdf578f39ad8f6576ac
2011-07-07 21:27:14 -07:00
Romain Guy
9ace8f5e79 Use NEAREST filtering for layers whenever possible.
Change-Id: Id5bee1bd4a322cf93e8000b08e18f1e1b058648e
2011-07-07 20:50:11 -07:00
Romain Guy
9ff3cb57ee Fix parameter order evaluation issue.
This problem was affecting Android builds with gcc/x86.

Change-Id: Ibb7978413c89bd1ac09f0d1ea78f5cb4fe61f6ed
2011-06-28 14:02:11 -07:00
Romain Guy
4a5a71518a Don't set texture parameters on every frame.
Change-Id: Iec368405ad6a4ccfd569a0b3b4d681871a770396
2011-06-24 17:53:53 -07:00
Romain Guy
80429c4585 Properly tear down TextureView
Change-Id: Ic23cd9257889d0abe8cc3fc1d04a66d0505e383e
2011-06-24 17:20:32 -07:00
Romain Guy
02ccac69fd Code cleanup
Change-Id: I64c346004e0adf9a776d0315534d4fe445f0c0ca
2011-06-24 13:20:23 -07:00
Romain Guy
a9489274d6 Add the ability to specify the opacity of a TextureView
TextureView assumes its content is opaque by default.

Change-Id: Iba873423566a5b67c388081838bd910dceba32ba
2011-06-22 20:58:11 -07:00
Romain Guy
d586ad9c9f Fix another memory leak in OpenGLRenderer
Change-Id: I23ed56891452a05cf3ca13f6919c4fef90d5ff4e
2011-06-22 17:10:00 -07:00
Romain Guy
f6a63ae3a7 Fix memory leak in OpenGLRenderer.
When creating a display list, matrices are duplicated locally. They
were however never deleted, thus causing apps to slowly leak memory
(a matrix is about 40 bytes.)

Change-Id: Iac465b720d4c4c9b5ca3fce870c0c912c14a74ab
2011-06-22 15:13:09 -07:00
Romain Guy
d6b2a00dd4 Add error checking to LayerRenderer::copyLayer
This method is invoked by TextureView.getBitmap() and failures must be
caught to avoid leaving the GL context in a potentially bad state.

Change-Id: I620de395ba1bc20154de58c81963223dc55cac78
2011-06-17 17:45:59 -07:00
Romain Guy
98029c825b Fix rendering issue with paths when the stroke width is 0
Change-Id: I5d8ac23dc69e9e17df4ef6b5195186b5207e2524
2011-06-17 15:47:07 -07:00
Romain Guy
77a811610f Add TextureView.getBitmap()
This API can be used to get a Bitmap copy of the content of a
TextureView.

Change-Id: I07522216c353720fba5cab333174f58f484eb911
2011-06-14 17:06:53 -07:00
Romain Guy
54be1cdf3d Batch glCopyTexImage() calls to get about 15 fps back on SGX.
Change-Id: I04079e070739c1e46df3e90fc388c335e2a7d2b9
2011-06-13 19:04:27 -07:00
Romain Guy
181d0a6cce Don't apply AA to rects with no rotation/perspective.
Change-Id: I21138d4d0589cc28f1dcffb8b675cd81a9900e24
2011-06-09 18:52:38 -07:00
Romain Guy
67ffc36a79 Measure text with the appropriate text encoding.
Bug #4546327

Change-Id: I8eb593b03a81145e08be92579706ddd775feb0a2
2011-06-03 18:51:11 -07:00
Romain Guy
726aeba80f Add support to OpenGLRendere to draw BiDi text.
Bug #4350336

Change-Id: I1cf31693f7ca9653fa3a41b5b91c27ef288d680f
2011-06-01 14:55:42 -07:00
Romain Guy
f09ef51889 Fix issue with drawColor(color, Mode.Clear)
Change-Id: I486b24a5b609c6f8adb0276037ddb24af2b888b2
2011-05-27 11:43:46 -07:00
Romain Guy
d2ba50ab86 Prettify memory dump.
Change-Id: I071c6a04a144a96955d85f56dffc6162288ee33e
2011-05-27 10:21:07 -07:00
Romain Guy
1e59f9d10d Fix texture coordinates for sub-bitmap rendering.
Change-Id: I05a31775e03f5b223a55a5144d420351abac89be
2011-05-26 18:39:34 -07:00