440 Commits

Author SHA1 Message Date
Raph Levien
77b74d4f93 Attempt to resolve build breakage on x86
If the scalblnf function is not available but scalbnf is, this patch
should fix the build.

Change-Id: Id83faba3298a44d57f4c924862a15c5d2bef3ca0
2013-01-15 14:37:27 -08:00
Raph Levien
aaedde51b7 Update framework text layout to use Harfbuzz NG
These are the frameworks changes to use the new version of Harfbuzz.

Change-Id: Idbef325e8fc1c27a9f2296414ddb1f79b778a00e
2013-01-15 09:58:06 -08:00
Siva Velusamy
af80cdd7df Merge "DdmServer: add controls for OpenGL tracing" 2013-01-02 09:10:06 -08:00
Siva Velusamy
0c1761bd37 DdmServer: add controls for OpenGL tracing
Add a new JDWP packet to allow control of OpenGL tracing.

Change-Id: Ic89e2f6299238a612df2f914581049f2cbba088c
2012-12-19 16:31:56 -08:00
Andy McFadden
d47f7d8b5f Rename ISurfaceTexture and SurfaceTexture
The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.

Bug 7736700

Change-Id: I08e677faf2ebb418ef131d0a8008e01037db0e50
2012-12-18 11:22:21 -08:00
Jamie Gennis
82bb813f11 stop using a deprecated SurfaceTextureClient ctor
Change-Id: Ie6196ba4896c0ab37b9aed3d1a4ffd04c99c5f80
2012-12-11 17:02:31 -08:00
Romain Guy
059e12ccd2 Use LruCache instead of GenerationCache in libhwui
Change-Id: Ic26ddc7151eb5462bcd243b21daf7187ed6d3bec
2012-11-29 11:44:02 -08:00
Igor Murashkin
c99db2bc46 Updated android.graphics.SurfaceTexture to use wp for FrameAvailableListener
Bug: 7425644
Change-Id: I7ccdc0ef421df7240d6cff9222c37411b1ecaf01
2012-10-30 14:44:25 -07:00
Raph Levien
d98efca738 Modify TextLayoutCache to use new LRU cache
This patch modifies TextLayoutCache to use the new hash-based LRU
caching mechanism, which should be significantly faster than the
old GenerationCache implementation.

Change-Id: I6170462ad93a56156a731a2927680164d62b5cfc
2012-10-25 23:17:33 -07:00
Chet Haase
aaee13176e am 85c1aef9: am 6534dd02: am 74261d84: Merge "Don\'t null the reference to Bitmap pixels until we\'re really ready" into jb-mr1-dev
* commit '85c1aef929b40f6fae31938b9c71160865d67f81':
  Don't null the reference to Bitmap pixels until we're really ready
2012-10-22 15:55:08 -07:00
Chet Haase
547e66531d Don't null the reference to Bitmap pixels until we're really ready
A change in the VM triggers a native memory error more aggressively than before,
showing that there's a bug in the logic of recycling bitmaps. Since the pixel
memory is allocated on the Java heap, nulling out the reference to that memory
in the Java level Bitmap object can cause that memory to get collected at any time.
Meanwhile, we may have a reference to that memory at the native level for rendering
purposes, causing an error if/when we access that memory after it has been collected
by the VM.

The fix is to avoid setting the reference to the pixels to null unless we are
not referring to it in native code. This is determined at the time we call
recycle() - we return a boolean to indicate whether the native code is still
using the memory. if not, the Java code can null out the reference and allow the
VM to collect it. Otherwise, it will get collected later when the encompassing
Bitmap object is collected.

Issue #7339156 HTML5 tests crash the app (Vellamo)

Change-Id: I3a0d6b9a6c5dd3b86cc2b0ff7719007e774b5e3c
2012-10-22 15:25:19 -07:00
Bart Sears
7dbf63665b am ae232842: am b112bb66: am 0ee71add: Merge "Fix native crash while saving a panorama." into jb-mr1-dev
* commit 'ae232842c86f108da5a73c047eff5a09e9c9c222':
  Fix native crash while saving a panorama.
2012-10-17 10:28:52 -07:00
Bart Sears
0ee71adde0 Merge "Fix native crash while saving a panorama." into jb-mr1-dev 2012-10-17 10:20:50 -07:00
Wu-cheng Li
4b63f14c96 Fix native crash while saving a panorama.
YuvToJpegEncoder should handle the case when the height is not
multiples of 16.

bug:7165606

Change-Id: I02f142b233c4f5c0cd8df5e3d1eaebbf62d28052
2012-10-17 18:06:59 +08:00
Romain Guy
ef9f40f11e am b7b30eb0: am fa71ba2c: am 1b85122b: Merge "Add API to enable mipmaps on Bitmap Bug #7353771" into jb-mr1-dev
* commit 'b7b30eb0577e794c744a1e3e3079325f73081c3d':
  Add API to enable mipmaps on Bitmap Bug #7353771
2012-10-16 19:14:13 -07:00
Romain Guy
713e1bb9df Add API to enable mipmaps on Bitmap
Bug #7353771

This API can be used when scaling large images down to a small size
to get nicer looking results.

Change-Id: If09087eed36077eee5355f6047a3ca67747d7d9e
2012-10-16 18:44:09 -07:00
Keun young Park
7a6dca427b am 09ff8a6f: am 27665148: am c378656d: Merge "fix wrong read size in ToColor_S4444_Opaque" into jb-mr1-dev
* commit '09ff8a6f43dad1e27524e41622392fe040b7bdab':
  fix wrong read size in ToColor_S4444_Opaque
2012-10-12 13:48:22 -07:00
Keun young Park
038953da05 fix wrong read size in ToColor_S4444_Opaque
- S4444 takes 16bits, not 32bits
- This caused sporadic failure in CTS BitmapFactoryTest#testDecodeStream4

Bug: 7179389
Change-Id: Ib36a3a569b3149d74f36ae67a069a7b65a72e895
2012-10-12 11:36:13 -07:00
Raph Levien
85e25c478a am 44d21eb5: am 6f3f7c68: am 9dc11eb8: Merge "Fix for 7281523 android.text.cts.SelectionTest#testMoveRight failures" into jb-mr1-dev
* commit '44d21eb5fcfd8f25920ccc3abccf3aedbf01f5df':
  Fix for 7281523 android.text.cts.SelectionTest#testMoveRight failures
2012-10-05 11:02:24 -07:00
Raph Levien
577b07197b Fix for 7281523 android.text.cts.SelectionTest#testMoveRight failures
The failures were caused by the implementation of doTextRunCursor
passing a too-small value for contextCount into the underlying
getTextRunAdvances call (it wasn't accounting for the start offset).
Thus, when getTextRunAdvances made a copy of the text for its cache key,
it was getting a partial copy.

This patch fixes the size so the cache key always has a full copy of the
text.

Change-Id: I57e3ac6de7aef0e1f1c7000dc3d653f9b0d623d2
2012-10-04 23:15:12 -07:00
Raph Levien
997d4283c0 am d8c6c6f5: am 1ca8d35f: am 5a829cbf: Merge "Fix for testPaintFlagsDrawFilter CTS test" into jb-mr1-dev
* commit 'd8c6c6f56630fa466b96dd5359d39a659a1e42f8':
  Fix for testPaintFlagsDrawFilter CTS test
2012-10-03 16:05:18 -07:00
Raph Levien
e174ae210e Fix for testPaintFlagsDrawFilter CTS test
This fixes bug 6948776
android.graphics.cts.PaintFlagsDrawFilterTest#testPaintFlagsDrawFilter
failures on JO

When we moved the drawing of text decorations (underline, strikethrough)
from Skia to our own drawing (so we could take into account the metrics
computed by TextLayoutEngine), we just used the raw flags from the
paint, which ignored the overrides that a DrawFilter can effect.

The patch simply checks for the existence of a DrawFilter in the canvas,
and applies it to a copy of the paint where present. This will be one
extra paint copy where the filter exists, but that's expected to be rare
(other than running this CTS test, of course).

Change-Id: I664c478b73a3a1cc43599ee11bbc02c69b7a96c2
2012-10-03 15:26:47 -07:00
Raph Levien
5472070c4a am 912c3780: am ad3cc4bb: am 217ca3b0: Merge "Fix for bug 7234184 F/TextLayoutCache: Failed to put an entry..." into jb-mr1-dev
* commit '912c37802cd2e3e10495ea4b7c9dc3ccdd1702e5':
  Fix for bug 7234184 F/TextLayoutCache: Failed to put an entry...
2012-10-02 13:09:22 -07:00
Raph Levien
832815cb53 Fix for bug 7234184 F/TextLayoutCache: Failed to put an entry...
This bug was triggered by user code concurrently mutating the character
array while calling into a drawText method in another thread. When the
value of the array changed, it caused inconsistent state, leading to
assert failures.

This is arguably bad behavior by the user code, but it shouldn't cause a
native crash. The fix is to do a defensive copy of the text into the
key, so the value is guaranteed to remain constant throughout the text
layout process. The change is mostly deletion of code, because there was
an optimization to try to avoid such a copy. That optimization was not
actually effective, however, because the indexOfKey() operation in the
KeyedVector underlying the TextLayoutCache did the copy anyway. Thus,
even though this change looks like it's introducing a copy where there
wasn't one before, the actual performance impact should be nil.

Note that the ability to handle a mutating argument is now part of the
contract for TextLayoutEngine::getValue(), and is now documented. That
contract may change, as the result of future optimization. Also, care
was taken to only use the value after the copy.

Other performance issues with TextLayoutCache are tracked in bug
7271109.

Change-Id: I9c90e8e4d501f3f37e2f22a7851f032808d46fbe
2012-10-02 12:32:40 -07:00
Chet Haase
d2e74f3400 am 1dd00221: am bcdaf8cb: am 62ea4363: Merge "Fix texture corruption" into jb-mr1-dev
* commit '1dd002214e9734aa862db9b7e7092aacd737e46d':
  Fix texture corruption
2012-10-01 11:17:35 -07:00
Chet Haase
6a2d17f713 Fix texture corruption
When memory gets low on a device, activities flush everything they can.
Hardware-accelerated activites, such as Launcher, flush GL resources and destroy
the GL context. However, some resources were still hanging around, due to deferred
destruction policies (we don't delete layers until the DisplayLists they are in
are finalized, to ensure we don't deref deleted objects). This meant that we were
referring to obsolete GL data in these objects. in particular, it meant that we might
come around later, after a new GL context was created, and delete a texture object
that was incorrect. We use the layer's "texture id" to refer to the texture underlying the
layer. But if there's a new GL context, then this texture ID is no longer valid, and
we may be deleting the texture that a different object (layer, icon, whatever) is referring
to, because the driver may return that same ID under the new GL context.

The fix is to more aggressively delete things that we know will not be used again
when the GL context is destroyed. In particular, we delete all resources being used
by all DisplayLists at GL context destruction time.

Issue #7195815 Textures corruption on all devices, in many apps

Change-Id: I52d2d208173690dbb794a83402d38f14ea4c6c22
2012-09-30 15:35:08 -07:00
Raph Levien
5827b5f7b0 am 34614e63: am 54801e12: Merge "Fix for bug 6936752 Tamil text gets truncated on right-hand side" into jb-mr1-dev
* commit '34614e63dced2b0479ab721494fd867604023619':
  Fix for bug 6936752 Tamil text gets truncated on right-hand side
2012-09-28 11:19:30 -07:00
Raph Levien
1b10241a8f Fix for bug 6936752 Tamil text gets truncated on right-hand side
The getTextRunAdvances() method wasn't accounting for the true width of
the text. On closer examination, in Tamil the clusters consist of a
number of glyphs each of which has a nonzero advance (in some other
scripts, the first glyph in the cluster has an advance, and others are
effectively zero). Previously, we were just using the advance of the
first glyph in the cluster. This patch changes the behavior to sum the
advances of all the glyphs within the cluster.

Change-Id: I77a51235f4bb0dfaa72cbb920a8c3b217ad25404
2012-09-24 16:14:38 -07:00
Raph Levien
8cba91d0d1 am 8b0851ca: am 3034d451: Merge "Fix for native crash on image decode OOM" into jb-mr1-dev
* commit '8b0851caf26dfd5e1cc7798e5ff6c6adc3a5e92c':
  Fix for native crash on image decode OOM
2012-09-20 23:30:48 -07:00
Raph Levien
005bfc694d Fix for native crash on image decode OOM
When decoding an image with scaling, if the allocation of the bitmap
data for the scaled bitmap failed, we were just ignoring it and going
on. This was yielding strange native crashes (bug 7196860 and bug
7175536). This patch checks whether the allocation succeeds, and returns
a null bitmap if not.

Of course, if the app really is OOM because it's allocated too many
bitmaps, it'll still get the OOME, but that's a lot nicer than a native
crash or memory corruption.

Change-Id: I8384059ab11c2ab9e93e283b9438d79e6709b7b1
2012-09-20 22:51:47 -07:00
Derek Sollenberger
2a6ecae93d Fix Skia assertions where we were allowing immutable bitmaps to be written to.
bug: 7092330
Change-Id: I4a9d1d299244d46172562080c56c8360f5e4af02
2012-09-19 07:21:12 -07:00
Jamie Gennis
94998c9c4e Merge "SurfaceTexture: remove call to doGLFenceWait" into jb-mr1-dev 2012-09-18 14:32:01 -07:00
Jamie Gennis
917a3b34a3 SurfaceTexture: remove call to doGLFenceWait
This call is no longer needed as the default behavior of the native
SurfaceTexture class is to do the wait whenever updateTexImage is called.

Change-Id: I995686a5989409e21b00fac913bd33c11f806998
2012-09-17 19:00:19 -07:00
Raph Levien
c1eff0857e am e5905684: am eceb3171: am f4afc401: Merge "framework: fix bug for uninitialized variable"
* commit 'e590568417aa824e7b0e76ae727556d329cb57cf':
  framework: fix bug for uninitialized variable
2012-09-14 12:19:03 -07:00
Raph Levien
eceb317116 am f4afc401: Merge "framework: fix bug for uninitialized variable"
* commit 'f4afc40101c00800c4dc53f165b93f741327416d':
  framework: fix bug for uninitialized variable
2012-09-14 12:15:03 -07:00
Raph Levien
eb1f5349f8 Merge "Fix for b7155617 race condition in TextLayoutCache.cpp" into jb-mr1-dev 2012-09-12 15:44:58 -07:00
Raph Levien
13ba4e478d Fix for b7155617 race condition in TextLayoutCache.cpp
There was the possibility for a race between clearing the caches and
using fonts. This patch simply protects both under the same mLock held
by the TextLayoutCache object.

Change-Id: Ib366e16a9a9ba702a46bc078d1bc0602713991e5
2012-09-12 15:15:51 -07:00
Jamie Gennis
f09263e957 SurfaceTexture: add updateTexImage synchronization
This change makes the SurfaceTexture JNI updateTexImage call the native
SurfaceTexture's doGLFenceWait method to perform the needed synchronization.

Change-Id: Ie70a1fe6b44d439d1ffe7b97689a421ff8c02fda
2012-09-09 17:53:27 -07:00
Zhou Chang
46e942d500 framework: fix bug for uninitialized variable
Some application display error due to uninitialized varibale.
This patch fix the bug

Change-Id: I660169e325ffae60d95c7774aaaeaebf693adf3d
Author: Chang Zhou <chang.zhou@intel.com>
Signed-off-by: Chang Zhou <chang.zhou@intel.com>
Signed-off-by: Chong Xing <chong.xing@intel.com>
Signed-off-by: Hongyu Zhang <hongyu.zhang@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 45356
2012-08-31 10:53:04 +08:00
Jean-Baptiste Queru
38f197863a am 14c0c989: am 4ba4caed: Merge "Fix SkBitmap::fPixels not being locked correctly"
* commit '14c0c989d21531056a5d0a0739c3ffdd1b04b295':
  Fix SkBitmap::fPixels not being locked correctly
2012-08-29 12:00:10 -07:00
Jean-Baptiste Queru
14c0c989d2 am 4ba4caed: Merge "Fix SkBitmap::fPixels not being locked correctly"
* commit '4ba4caede125ff602b0d93f577f9054a07791ff7':
  Fix SkBitmap::fPixels not being locked correctly
2012-08-29 11:55:20 -07:00
Michal Stawinski
35ef567140 Fix SkBitmap::fPixels not being locked correctly
In some cases bitmap's pixels where freed during encoding, which
caused a null pointer dereference.
This fix makes sure that underlaying buffer is locked for the whole
process of compression.

Change-Id: I0ac56821f5d333072271dc2670fa30f1562adfa3
2012-08-29 15:54:01 +02:00
Billy Hewlett
ac1cbaf2e5 DO NOT MERGE Han Preference
Cherry-pick Ib5dd86950156c5a438f25c289acb839206bb455a from master.

Data: label MTLmr3m with "ja" locale attribute, fallback_fonts-ja.xml removed,
as we only need a single fallback font file
Code: Add locale and variant to TextLayoutCache.  Paint.java sets textLocale as
the language (for example, "ja") rather than the language/locale concatenated
(for example "ja_JP")

This checkin, along with Change-Id: Id8c91ae0be6cad8a7ef77a0cd5803676290986c1,
allows text view objects to set their locale dynamically and skia will use the
correct font for the locale.

Change-Id: Ieb60b0d7a39fcfef4f8ce90cd4f6065d33673710
2012-08-20 08:51:23 -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
Romain Guy
a0aa479c0e am 97e27072: am dfac68ea: Merge "Corrected typo when checking InputStream methods"
* commit '97e270721bf29d25b513c1f2be71a8543d048f5d':
  Corrected typo when checking InputStream methods
2012-07-27 15:54:30 -07:00
Romain Guy
97e270721b am dfac68ea: Merge "Corrected typo when checking InputStream methods"
* commit 'dfac68eacc60c130e54345d98bd45c99573cb627':
  Corrected typo when checking InputStream methods
2012-07-27 15:49:23 -07:00
Edward Savage-Jones
8ac41bb79e Corrected typo when checking InputStream methods
Corrected a small typo where Java InputStream methods are
incorrectly checked when creating a JNI InputStream adaptor.

Change-Id: I5f14897e0d5ddceb4b2af6be46769713f0487624
2012-07-27 15:14:24 +02:00
Raph Levien
161ebab85d Increase text layout cache size in bytes
The mark positioning changes increase the number of bytes needed per
glyph from 6 to 14. This patch compensates by allocating more total
memory for the text layout cache.

Change-Id: I3cf59547394a41779cf6e92e67688b0fdc85f1a3
2012-07-18 16:16:41 -07:00
Raph Levien
4f3c8f7026 Fix overly verbose logging in TextLayoutCache
I meant to log certain debug values only when DEBUG_GLYPHS was set, but
I used #ifdef instead of #if (when it's not set, it's 0, rather than
undefined).

Change-Id: Ic27fee7dd355009c1873f0a2e12614849bbceebd
2012-07-18 15:40:44 -07:00
Raph Levien
2301d32f7e Software-only implementation of glyph positioning (bug 5443796)
This patch implements glyph positioning in the Skia-based renderer. Note
that it depends on a fix for bug 6833339 being in place (correct
calculation of advance widths under skew and scale transforms),
otherwise there will be regressions.

Careful attention was paid to correct results in a wide variety of
conditions: alignments, text decorations, scale, skew, etc. Many of
these are exercised in the test app attached to bug 6833339.

Note that this patch also changes slightly the way that the total
advance is calculated - the running is accumulated and passed through to
computeRunValues(), so that the x positions of each glyph can be set
according to the total advance of all glyphs (in all runs) appearing
before (plus, of course, the offset for mark positioning).

After committing this patch, text rendering will no longer match between
the software and hardware rendering cases. Implementing positioning in
the hardware renderer will resolve that, and fully implement bug 5443796.

Change-Id: Ie0f7835d48bc120475a19afbfe159aa5304fcaa8
2012-07-17 18:11:28 -07:00