508 Commits

Author SHA1 Message Date
Romain Guy
e3b0a0117a Refcount 9-patches and properly handle GC events
This change adds refcounting of Res_png_9patch instances, the native
data structure used to represent 9-patches. The Dalvik NinePatch class
now holds a native pointer instead of a Dalvik byte[]. This pointer
is used whenever we need to draw the 9-patch (software or hardware.)

Since we are now tracking garbage collection of NinePatch objects
libhwui's PatchCache must keep a list of free blocks in the VBO
used to store the meshes.

This change also removes unnecessary instances tracking from
GLES20DisplayList. Bitmaps and 9-patches are refcounted at the
native level and do not need to be tracked by the Dalvik layer.

Change-Id: Ib8682d573a538aaf1945f8ec5a9bd5da5d16f74b
2013-06-26 17:15:08 -07:00
Derek Sollenberger
6b0437c2c7 Fix SkASSERT errors resulting from the order objects are allocated
on the stack.

Change-Id: I24649fed5c069d8d3777d153e8fb31a55a9cf7a1
2013-06-24 15:40:54 -04:00
Svetoslav Ganov
ff4adde573 Generate PDF from Canvas.
This change adds simple APIs that enable an Android application
to generate a PDF document by drawing content on a canvas.

Change-Id: Ibac93d7c37b01a376ce7c48238657d8c7698d588
2013-06-19 19:35:38 -07:00
Victoria Lease
8870538f7c make setHinting(HINTING_ON) kNormal_Hinting
Previously, the default hinting mode for a freshly-constructed Paint
object is equivalent to Skia's kNormal_Hinting mode, in which font
hints are respected if available. Calling
Paint.setHinting(HINTING_ON), however, is equivalent to setting
Skia's kSlight_Hinting mode, in which font hints are ignored in
favour of freetype-generated autohints.

This discrepancy is bad for a variety of reasons:
- Once Paint.setHinting() has been called, it is impossible to return
  to the default hinting level.
- Calling paint.setHinting(otherPaint.getHinting()) can result in
  paint having a different hinting level than otherPaint.
- Paint.setHinting(HINTING_ON) actually results in font hints being
  ignored, which is perhaps the opposite of the intended behaviour.

This commit resolves these discrepancies by making HINTING_ON
correspond to Skia's kNormal_Hinting setting.

Change-Id: Iefb8e051ef53bea783e6f3be37748985ec397bc5
Bug: 9466164
2013-06-17 11:57:37 -07:00
Svetoslav Ganov
7a56be0915 Revert "Generate PDF from Canvas."
This reverts commit 923c633ccfda45312fec5a3484b6cc1308cc71ab

Change-Id: Ie49f593ec702c1ecf96a5cc1fafa680c1db08747
2013-06-12 23:06:46 +00:00
Svetoslav Ganov
923c633ccf Generate PDF from Canvas.
This change adds simple APIs that enable an Android application
to generate a PDF document by drawing content on a canvas.

Change-Id: Iddcd126b3af37c73d99262f6b276caa07b998c1d
2013-06-12 14:20:26 -07:00
Chris Craik
34bff87b32 Merge "Add support for post-decode density scaling with reuse" 2013-06-06 21:04:49 +00:00
Chris Craik
1e97ceb469 Merge "Support all formats for BitmapFactory.Options.inBitmap" 2013-06-06 16:13:30 +00:00
Chris Craik
905e8246ef Add support for post-decode density scaling with reuse
Also, simplifies scaling path, removing java variant - we always do
the scaling in native, which has the benefit of avoiding non-native
temporary allocations

Change-Id: I39c2219f5d77a267719629704e65611cf4388a82
2013-06-05 16:09:31 -07:00
Chris Craik
7e8c03c0fe Support all formats for BitmapFactory.Options.inBitmap
bug:9194265

Instead of using custom code in skia to avoid allocations, use a
custom allocator that reuses the allocations from the inBitmap.

In order to avoid inconsistent state, the decode is done in a
separate bitmap and swapped into the existing native bitmap.

Eventually, we'd like to support inScaled=true completely avoiding
java allocations.

Change-Id: Ic4a2f2373b100a80a32c1cdebb7bcb726711c8a7
2013-06-03 18:14:44 -07:00
Derek Sollenberger
c648ed7303 Merge "Modifications needed for updating Skia to r9286." 2013-05-30 12:06:47 +00:00
Chris Craik
9f58361e98 Support larger bitmaps in BitmapFactory.Options.inBitmap
bug:8121994

Adds a new distiction between bitmap size and the allocation
(pixel ref/buffer) used to store its data.

BitmapFactory.inBitmap will allow a bitmap to be reinitialized with
new data if the bitmap being decoded is (after sampleSize) equal or
smaller.

Change-Id: I747750a735c858882df3af74fca6cdc46f2a9f81
2013-05-28 13:50:33 -07:00
Derek Sollenberger
d7a80774f0 Modifications needed for updating Skia to r9286.
bug: 8719528
Change-Id: I260fefb93c5a8c5dec86acdec66cbe55a2ee8a92
2013-05-28 10:44:26 -04:00
Chris Craik
41541825bc Use individual glyph positions to determine text bounds.
bug:8766924

Previously text bounds were calculated to be from 0 to totalAdvance in
the X, and from the font's top to bottom. These are incorrect,
especially in light of the font fallback mechanism.

Now, we calculate the bounds of the text as we layout each glyph.
Since these are much tighter bounds in the common case, this
significantly reduces the amount of clipping required (which in turn
enables more aggressive text merging).

Change-Id: I172e5466bf5975bf837af894a9964c41db538746
2013-05-21 23:04:05 +00:00
Romain Guy
4eb3c13261 am 25f6f4f5: am 3c1ad55f: Merge "Update Canvas.getClipBounds to not account for AA clips." into jb-mr2-dev
* commit '25f6f4f5d082828fe0eb4f24be2bfaa15b71242e':
  Update Canvas.getClipBounds to not account for AA clips.
2013-05-17 14:14:32 -07:00
Derek Sollenberger
00a33a8ce8 Update Canvas.getClipBounds to not account for AA clips.
This preserves the existing behavior at the SDK level while skia
investigates a more comprehensive solution.

bug: 8986473
Change-Id: Ief82dcfd47f1ba08d28d43402b3c28694f94f2e4
2013-05-16 09:31:27 -04:00
Derek Sollenberger
0c8c0add4e am c195ef73: am bee78812: Merge "Fix bug where we incorrectly clipped the bounds to the device size." into jb-mr2-dev
* commit 'c195ef73445c3ba605355798b9f1f9a78bc52f11':
  Fix bug where we incorrectly clipped the bounds to the device size.
2013-05-09 14:19:45 -07:00
Raph Levien
8987f06f9c resolved conflicts for merge of 7e433f10 to master
Change-Id: Ifa3a144c791c0143c62f4aa23a5db57a93c32a17
2013-05-09 14:08:14 -07:00
Derek Sollenberger
bee78812d0 Merge "Fix bug where we incorrectly clipped the bounds to the device size." into jb-mr2-dev 2013-05-09 18:23:57 +00:00
Raph Levien
dde8e539c3 Merge "Fix bug 8717690 Full-width Latin Letters Garbled on Tumblr App" into jb-mr2-dev 2013-05-09 18:04:39 +00:00
Derek Sollenberger
708144e828 Fix bug where we incorrectly clipped the bounds to the device size.
This CL also updates the documenation to make it clear that the API
returns in local space, not clipped to the size of the bitmap/device.

bug: 8747526
Change-Id: I389844672ce955341863f9940c3b401ab00dc1dc
2013-05-09 14:00:29 -04:00
Raph Levien
dd0a91294b Fix bug 8717690 Full-width Latin Letters Garbled on Tumblr App
For fullwidth latin (or, more generally, a font considered as a complex
script, but not supported by the font specified), and for a font other
than a system default font, we were getting a mismatch in baseGlyphCount
between the shaping and painting fonts.

This patch preserves the original typeface in this case. In that sense,
it is a slightly more general fix for bug 8127795.

Change-Id: Ibdbfdb34eb7dc39cc8f0784a67c93c9af4ce6ab2
2013-05-06 15:00:41 -07:00
Raph Levien
41f7f9c5bc am fdd40823: am 22a3344c: Merge "Fix for bug 8695466 GPOS combining mark positioning broken before space" into jb-mr2-dev
* commit 'fdd408233db5bd70cb43ddf2a49a85bd748da5b9':
  Fix for bug 8695466 GPOS combining mark positioning broken before space
2013-04-23 15:02:04 -07:00
Raph Levien
9d47db23ff Fix for bug 8695466 GPOS combining mark positioning broken before space
This patch makes segmentation into script runs behave the same in RTL
as in LTR modes - so that inherited script characters are always
associated with the preceding run. Otherwise, for a sequence such as
u+0631 u+064d u+0020, it would get split after the first character,
which would lose the ability to correctly position the u+064d mark.

Change-Id: I3c12ba1b77d18334f55e707f518be1046e6b339b
2013-04-23 12:51:27 -07:00
Victoria Lease
af1653a851 resolved conflicts for merge of 6c18e2c8 to master
Change-Id: Idb4679247b201a1f453c63fee5b45b12b03a67a1
2013-04-17 10:33:23 -07:00
Victoria Lease
cc0f9d8469 use appropriate fallback chain for style
TextLayoutShaper was defaulting to the Regular-style fallback chain
for all unknown scripts. This became problematic in that the
codepoint->glyphID enumeration stage of shaping was always using the
Regular-style fallback chain for unknown scripts, and there's no
guarantee that glyph indices are compatible between fallback chains.

Defaulting to a style-appropriate fallback chain addresses this
issue, and probably unreported but related issues, as well.

Bug: 8189208
Change-Id: I6ecf531c74d71a8e4a5359d23439ccc950b0cf80
2013-04-16 09:51:45 -07:00
Derek Sollenberger
7a5583fe36 am 8225c5b3: am c37b63d6: Merge "Ensure that a canvas is always backed by some form of SkDevice." into jb-mr2-dev
* commit '8225c5b3d925324dac7703fba0fd5a0f126afed6':
  Ensure that a canvas is always backed by some form of SkDevice.
2013-04-10 05:18:41 -07:00
Derek Sollenberger
45fa0cbc54 Ensure that a canvas is always backed by some form of SkDevice.
bug: 8518884
Change-Id: Id6c597179878ce5b938c00422e88bef5f12e2e1f
2013-04-09 16:36:55 -04:00
Derek Sollenberger
109109cdd5 Refactoring code to support r8352 of Skia.
Change-Id: Ica1463c84edaf7a46566d1ff792f7f73cef31997
2013-04-03 14:22:01 -04:00
Victoria Lease
626d3c2281 bidiFlags != SkPaint::Flags
We've a number of native functions in the text layout path that take
a bidiFlags argument. We've a number of callers of those functions
passing in SkPaint::Flags in that slot. This completely breaks text
directionality for the affected functions, as
SkPaint::kAntiAlias_Flag happens to share values with kBidi_RTL,
resulting in anti-aliased SkPaints measuring text as if it were RTL,
and non-anti-aliased SkPaints measuring text as if it were LTR,
regardless of the actual text directionality. Oops!

To address the issue, this commit replaces erroneous calls to
SkPaint.getFlags() with the value of Paint.mBidiFlags, and includes
the necessary plumbing to get that value where it needs to be.

Bug: 8471481
Change-Id: I2d04b70defed3130fc1ad13f4c9098f5fce4ffde
2013-03-28 15:56:14 -07:00
Fabrice Di Meglio
665f02c667 Fix bug #8437358 Clean any ICU related code from TextLayout / Paint and their dependencies
- remove the ICU related methods and update the methods using the "reserved" argument
- update to CTS in another CL too

Change-Id: I5509736568c342d9d17bfeafc17951117ab5d3cc
2013-03-20 14:56:05 -07:00
Fabrice Di Meglio
da12f389eb Revert "Clean Paint.mBidiFlags as it is no longer used"
This reverts commit 6d9fe5bd22b531bfce69b146254a4791c76acddc.
2013-03-15 11:26:56 -07:00
Fabrice Di Meglio
19f46b0d7a Revert "Fix bug #8194572 Chrome SIGBUS'es on launch around TextLayoutCacheKey"
This reverts commit ebcacc785b0883c9435a3e850f790785fba93370.
2013-03-15 11:26:23 -07:00
Fabrice Di Meglio
a4bf8114a7 Revert "fix argument mismatches in Paint JNI"
This reverts commit b61fb10fe435b74a761e82f517abd0320f22193e.
2013-03-15 11:22:29 -07:00
Mathias Agopian
b1d90c8f60 fix JNI use of incStrong/decStrong
Change-Id: Ia11b404dea483dc19bbc30f4d7bcff516655e180
2013-03-06 17:48:20 -08:00
Derek Sollenberger
5b6591c1d0 fix issue when replacement bitmap is larger than original.
getTotalClip() returns the canvas bounds even if no explicit clip
was set. This CL fixes that issue by only transfering clips that
were explicitly set to the new canvas.

bug: 8255582
Change-Id: I0144d430e7718151ad93d988fcf20b412f74b256
2013-02-28 11:18:50 -05:00
Derek Sollenberger
1b63e60abd Fix use case where the Java Canvas is reused.
When provided with a new bitmap device the canvas will retain
certain information such as it's matrix and clip.

bug: 8167188
Change-Id: I20ac8a24eebc85fb7c147504a103ce9a95b530b3
2013-02-21 14:49:17 -05:00
Mathias Agopian
76f56dd598 am ceec31b7: Merge changes I5a218ca1,I853a76d9
* commit 'ceec31b7dab6a23e443d5dcbcfac4a23b720cfde':
  Refactoring: Rename SurfaceTextureClient to Surface
  clean-up following Surface split
2013-02-15 14:28:22 -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
Mathias Agopian
ceec31b7da Merge changes I5a218ca1,I853a76d9
* changes:
  Refactoring: Rename SurfaceTextureClient to Surface
  clean-up following Surface split
2013-02-15 22:08:40 +00:00
Mathias Agopian
5280061794 Refactoring: Rename SurfaceTextureClient to Surface
Change-Id: I5a218ca11abeeec05e3a4c3cfc581bcc788814ea
2013-02-15 12:47:40 -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
Victoria Lease
c85637f0e6 am c69bce2e: Merge "fix argument mismatches in Paint JNI"
# Via Android (Google) Code Review (1) and Victoria Lease (1)
* commit 'c69bce2e41c70da35e1b6a2ab5ec44469ab14c80':
  fix argument mismatches in Paint JNI
2013-02-14 19:59:03 -08:00
Victoria Lease
b61fb10fe4 fix argument mismatches in Paint JNI
Paint.getTextRunCursor() no longer has a "flags" argument on the Java
side. The native side, however, still had the argument, and was being
called with misaligned arguments, causing all manner of madcap fun.

Also, the version of Paint.getTextRunCursor() that took String as an
argument needed to lose the "flags" argument, as well, to prevent an
infinite loop in the CharSequence version of the function, which was
supposed to be calling the String version but was actually calling
itself.

Bug: 8201224
Change-Id: Iad0dabaf81185f29a082566cc64590f2ba9bc31c
2013-02-14 15:58:46 -08:00
Fabrice Di Meglio
c504c4e51d am 336fcac3: Merge "Fix bug #8194572 Chrome SIGBUS\'es on launch around TextLayoutCacheKey"
# Via Android (Google) Code Review (1) and Fabrice Di Meglio (1)
* commit '336fcac31ddccc7e7a6773d03e7cb17967ebb898':
  Fix bug #8194572 Chrome SIGBUS'es on launch around TextLayoutCacheKey
2013-02-13 17:38:31 -08:00
Fabrice Di Meglio
ebcacc785b Fix bug #8194572 Chrome SIGBUS'es on launch around TextLayoutCacheKey
- remove remaining dirFlags
- clean method names

Change-Id: I404b643cd10321e977530528168d1d415b3f2eca
2013-02-13 17:22:52 -08:00
Chris Craik
c932760f66 Merge "Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE" 2013-02-13 23:14:58 +00:00
Fabrice Di Meglio
0c33ecd209 Merge "Clean Paint.mBidiFlags as it is no longer used" 2013-02-13 19:11:50 +00:00
Chris Craik
7c1a49f5f5 Revert "Merge remote-tracking branch 'goog/master-chromium' into 'goog/master'" DO NOT MERGE
This reverts commit 6c0307dd0aefe9a08794b155fc03ee60ebd14f25, reversing
changes made to a2cd828b749c444d55c2c41c7dbb85088ff94b9f.

Conflicts:
	packages/SystemUI/res/values-sv/strings.xml

Change-Id: Ia178efe8b14751583d47b2826bfe3d3d5463dd2e
2013-02-13 10:50:20 -08:00
Victoria Lease
ded5ed963c Count baseGlyphCount once for scripts without typefaces
Characters from complex scripts without dedicated typefaces were
getting baseGlyphCount counted twice: once in shapeFontRun() and
then a second time during SkScalerContext::getNextContext()
chaining.

This was a problem for text runs beginning with full-width Latn
characters - shapeFontRun() would get the base glyph count for
the typeface containing those characters, then realise it had no
typeface specified for the Latn script, resetting the typeface
to default without resetting the base glyph count along with it.
Mojibake full-width Latn characters, ho!

The same issue also affected Cherokee text, which this fix also
addresses.

Bug: 8127795
Bug: 8034351
Change-Id: I058d81cffbbf86426cc3c5aafcc91a76f4fe6b62
2013-02-12 14:47:43 -08:00