985 Commits

Author SHA1 Message Date
Raph Levien
1149cdc84b Make measureText(String, int, int) not use context
The measureText method when applied to a string should just measure
the substring, rather than treat the entire string as context. It was
less likely to cause problems than the similar issues with char
arrays, but still wrong. This patch makes the behavior consistent.

Bug: 20087437
Change-Id: I1c6e07a694b151f4fb097edae8e271805e996d06
2015-06-24 14:05:52 -07:00
Leon Scroggins III
2a6d6e5047 Fixes for Region_writeToParcel.
Check the return value of Parcel::writeInplace. If it is NULL, there
was a failure, so do not attempt to write to it. Instead, report the
error and return false.

If SkRegion::writeToMemory claims to have written a different amount of
memory than it claimed it needed, report that error as well.

Change uses of NULL in this function to nullptr.

BUG:21271229
BUG:20666821
Change-Id: Ia6160f74f30bf42f5ff97f716dadb01d1f0d6961
2015-06-17 11:56:43 -04:00
Chris Craik
1b83edc616 Merge "Workaround shader crash" into mnc-dev 2015-06-11 20:29:05 +00:00
Chris Craik
b786bbdd11 Workaround shader crash
bug:21706035

Change-Id: Ia1cd4824c742b2d6fc0feb2861ccfde0b6ac2189
2015-06-10 16:58:50 -07:00
Eino-Ville Talvala
ef9db7d81b Add more specific consumer names for common buffer queue endpoints.
Change-Id: I744bdcba6e60e5efd8865f725b09a9f791d76160
2015-06-09 14:15:15 -07:00
Jeff Brown
a316c5dfbc Fix Bitmap parceling through ashmem.
Fixes a bug where the Bitmap parceling code was unable to deal with
sending bitmaps through Parcels that disallow file descriptors.
Uses extended functionality of the Parcel blob interface to pass
buffers around more efficiently while adapting to whether FDs
are allowed.

Bug: 21428802
Change-Id: If24926f4388d29aa2aac627000436beb015edcb9
2015-06-06 04:23:45 +00:00
Svet Ganov
fbd0288655 Update the pdfium library - framework
Change-Id: I4880e9310c02c6e26d4560fb8515f2ce51c597f4
2015-06-04 14:57:06 -07:00
Raph Levien
36ff86c9a3 Apply contextStart consistently in getRunAdvance
The contextStart needs to be applied to all offsets relative to the
actual start of context. The code was missing "offset", which caused
mischief especially in mixed LTR and RTL text.

Bug: 21573666
Change-Id: I47a1b6cde5862442b9c7236ee72b2ceb0df9b2e9
2015-06-03 10:58:33 -07:00
John Reck
0781a2f116 Fix reconfigure & setPremult alpha handling
Bug: 20948129
Change-Id: Ifba35e5d87772a304fd3655e4a2363b293a6d8ac
2015-05-27 16:29:17 -07:00
Leon Scroggins III
462dd01046 Fix overflow in NinePatchImpl.
Cast numXDivs to a size_t before adding 1, so that if numXDivs is 255
it does not overflow. Move the calculation outside of alloca().

BUG:20727488
Change-Id: I2ecc9d650338acba7316554cb72195e02816b1f8
2015-05-21 12:20:26 -04:00
Derek Sollenberger
252893df57 Merge "Check that the parcel contained the expected amount of region data." into mnc-dev 2015-05-19 14:38:52 +00:00
Riley Andrews
721ae5fec5 Add internal bitmap api for creating immutable ashmem backed bitmaps.
Bug 21037890
Change-Id: I827e83dd75e301e7d93ead5efdd744f0d8435ae5
2015-05-18 19:55:39 +00:00
Riley Andrews
39d7f30ebe Use ashmem to optimize all bitmap copies.
Bug 21037890
Change-Id: Ie32ca3a0c527755f1a1b77db7548cb9629e2001b
2015-05-18 19:55:21 +00:00
Derek Sollenberger
cdadfc211d Check that the parcel contained the expected amount of region data.
bug:20883006
Change-Id: Ib47a8ec8696dbc37e958b8dbceb43fcbabf6605b
2015-05-18 14:29:02 -04:00
Derek Sollenberger
beda8613ad Merge "Ensure that unparcelling Region only reads the expected number of bytes" into mnc-dev 2015-05-18 17:37:08 +00:00
Jérôme Poichet
58cff53a5d Merge "SkScalarDiv and its variants are deprecated" into mnc-dev 2015-05-16 02:05:12 +00:00
John Reck
6d8371e73f Check for setting to already set
Bug: 20105644
Change-Id: Ia79d2ae5c725c139d2b7c423a899be625cb8f14f
2015-05-14 16:06:12 -07:00
Derek Sollenberger
3082fe440f Ensure that unparcelling Region only reads the expected number of bytes
bug: 20883006
Change-Id: I4f109667fb210a80fbddddf5f1bfb7ef3a02b6ce
2015-05-13 15:45:04 -04:00
Mike Reed
47b3441537 SkScalarDiv and its variants are deprecated
Change-Id: Icf2c13d0b19360753c9eed5f991b056201eb63df
(cherry picked from commit 4069f39b30084c4c907ce9921275975ff3d1b9d5)
2015-05-13 17:24:01 +00:00
Hiroshi Yamauchi
5b406cb7b5 Replace JNI primitive array critical calls with non-critical ones.
The files generated by glgen + manually edited util.cpp.

Bug: 19235243

Change-Id: Id48d39bafc21c27fbf667ed0f4e082dda3a37be3
2015-05-12 14:24:09 -07:00
Derek Sollenberger
2a94a10bec Update the rowBytes when reconfiguring to match the new imageInfo.
bug: 20872840
Change-Id: Ic98a9d16e095c27ddcc193a18641732c1ee4bad0
2015-05-07 14:26:01 -04:00
John Reck
ae2e8b4891 Add warning if an in-use Bitmap is reconfigured
Bug: 18928352

Also fix an issue around re-configure not properly handling
mPinnedCount in android::Bitmap

Change-Id: I1815b121f1474ad931060771bb1d52ef31d2aac7
2015-05-06 15:30:16 -07:00
John Reck
f29ed28c7b Attempt to solve the double-GC problem
Fix the issue where Bitmap requires two GC passes
to release its byte[] by using some questionable
ref-counting hacks to manage whether or not
native has a strong or weak ref to the byte[]

Change-Id: Ia90a883579f61c0b1904b5549a66bd0ef34b32c5
2015-05-04 16:05:12 -07:00
John Reck
7c103a36f6 Remove Bitmap#getSkBitmap
Change-Id: Ifb9047b426122d3e5a445eb7a0eb3fce38dedf27
2015-05-01 14:38:44 -07:00
John Reck
c6e2e8ff47 Move AssetAtlas off of SkBitmap*
Switched to SkPixelRef*

Change-Id: I4a1d9dc6c55c1ebcce6b0b8c585e69559e523898
2015-05-01 14:30:21 -07:00
John Reck
3731dc220e A bunch more cleanups
Switch a few places to using android::canvas
instead of SkCanvas as well which eliminated
some JNI

Change-Id: I8f98b56442a06362b82b984cd1bd3a92398d8dbc
2015-04-30 14:34:55 -07:00
John Reck
ed207b9274 Change how Java Bitmaps are accessed in a few places
Stop assuming that a Java Bitmap has a SkBitmap* that
has some externally managed lifecycle, and instead switch
a bunch of users to accessing the bitmap by providing
their own SkBitmap* on which to set the (ref counted!)
SkPixelRef* instead

Attempt #2 to land this, original issue was in getSkBitmap
and should be fixed

Change-Id: I0fd9e193968b41e5597784140d56b4885906864a
2015-04-30 12:46:57 -07:00
John Reck
c1b33d665c GraphicsJNI Canvas cleanup
Change-Id: I72e142986a8bc9f464c1951b6b5187919de3462e
2015-04-22 09:34:34 -07:00
Raph Levien
1c17ba5f83 Merge "Add Paint methods for cursor positioning" 2015-04-20 22:13:55 +00:00
John Reck
edc22fba59 Revert "Change how Java Bitmaps are accessed in a few places"
Bug: 20207616

This reverts commit a771b9861d11671c780092d35c0062eeefcf37c0.

Change-Id: Ifd891cc075274a7986e987229e0fed5a04ed9ff0
2015-04-20 22:06:31 +00:00
Raph Levien
a027ec5c2d Add Paint methods for cursor positioning
Adds methods to Paint for finding an offset corresponding to an
advance, and for finding the advance corresponding to an offset,
useful for positioning and drawing a cursor.

Change-Id: Id57402ddd1980650f1d0d2f8bbdb75e43612ec51
2015-04-14 23:51:46 -07:00
John Reck
a771b9861d Change how Java Bitmaps are accessed in a few places
Stop assuming that a Java Bitmap has a SkBitmap* that
has some externally managed lifecycle, and instead switch
a bunch of users to accessing the bitmap by providing
their own SkBitmap* on which to set the (ref counted!)
SkPixelRef* instead

Change-Id: I0fd9e193968b41e5597784140d56b4885906864a
2015-04-13 09:50:42 -07:00
John Reck
4147877b38 Remove user of GraphicsJNI::createBitmap
Change-Id: I2f31bf98ed08eb4bd39a6ce7236c7a23ef309177
2015-04-10 13:35:27 -07:00
Raph Levien
3544e6fa56 Merge "Don't use context in measureText(char[])" 2015-04-06 19:21:58 +00:00
Raph Levien
80b485daa6 Don't use context in measureText(char[])
The measureText(CharSequence) method calls into measureText(char[]),
using a temporary buffer, which may be longer than the CharSequence,
and may have additional characters. The existing implementation was
treating the entire char[] as potential context, but this is
incorrect.

This patch does the measurement on just the substring; measureText
doesn't process context. There are other methods for that, such as
getTextRunAdvances.

Bug: 19962931
Change-Id: Ia00cc004f9fa9d45aaf028683e78404d66c1388f
2015-04-03 10:41:52 -07:00
Raph Levien
f7f969e67e Add Paint.hasGlyph method
This patch adds a method to determine whether a typeface has a glyph
to support a particular Unicode character or sequence.

The implementation is based on shaping the text and checking for the
presence of .notdef glyphs, and counting the number of glyphs in the
ligature case. In the case of variation selector control characters, it
currently just returns false because there is no variation selector
support yet (Mongolian Free Variation Selectors work because they're
shaped with GSUB instead).

Change-Id: I8ee4ae0d6e81a0ac57f961eb02dcc35aabd87042
2015-04-02 23:14:58 +00:00
Raph Levien
c94f742f7e Calculate line breaks using Minikin
This patch moves the calculation of line breaks for StaticLayout into
the new LineBreaker class provided by Minikin. This specific patch
should preserve existing functionality, but perhaps performance is
better, and the movement opens the door to much more sophisticated
line-breaking.

Change-Id: Iafccb9da4e3559bbeaeb2c7c85f86ddfd8ae2fa1
2015-03-26 22:52:32 -07:00
Derek Sollenberger
0b8606266c Fix DrawFilter's usage in HWUI.
Also add additional compile time checks to ensure that the Java
and Skia APIs remain in sync.

bug:19890753
Change-Id: I8503cacf2859307e3f480a78603f9f05901b58cc
2015-03-25 10:08:30 -04:00
Mike Reed
2a1ce8a4e5 use SkFilterQuality instead of SkPaint::FilterLevel
Change-Id: I5d26869de746107b8a35a7a662236f993a824b0d
2015-03-16 11:31:38 -04:00
Raph Levien
210a189e22 Add HyphenEdit support to Paint
This adds HyphenEdit on the C++ and also to Java via JNI. HyphenEdit is
a Minikin feature for adding hyphens to text without having to edit the
string on the client side.

Change-Id: Icfb228407c1d11a716d055f813da7507acb38fbf
2015-03-14 06:00:23 +00:00
Derek Sollenberger
ee248599d4 Refactor DisplayList path caching.
This removes dependence on SkPath ptrs that HWUI does not control
the lifecycle of. This clears up some errors where the paths are
not generated from Java, but rather the Skia test suites.

Cherry-pick of a change that originally landed in master-skia and is
dependent on a skia merge (ag/655422).

Change-Id: I41b9797a2b0af5d6b4ea51891565469d4f1d832d
2015-03-13 08:05:55 -04:00
Leon Scroggins III
247dc6e125 Fix use of SkMutex.
Recent change to Skia moved SkMutex into its own header file. Include
it to use and SkMutex.

Use SK_DECLARE_STATIC_MUTEX to remove static initializer/finalizer.

Fixes master-skia build.

Change-Id: I2ab43c511587167b81310d5d55a65604d82761f5
2015-03-13 08:05:07 -04:00
Leon Scroggins III
3449789b9c SkStream is no longer a ref counted object.
With https://codereview.chromium.org/849103004/, SkStream is no longer
ref counted. Change callers that currently unref() SkStreams to one of
either:
- delete the stream
- pass ownership of the stream

screencap.cpp:
Call EncodeData directly, bypassing SkDynamicMemoryWStream and SkBitmap.

Utils.cpp:
Write directly to an SkData, and then use that to construct a new
SkStream.

Cherry-pick of a change that originally landed in master-skia and is
dependent on a skia merge (ag/655422).

Change-Id: Idc99ad7d5a70c893dc012d59915216f301ab3c9d
2015-03-12 19:51:57 +00:00
Leon Scroggins III
ec419e0b73 Make Bitmap_createFromParcel check the color count.
When reading from the parcel, if the number of colors is invalid, early
exit.

Add two more checks: setInfo must return true, and Parcel::readInplace
must return non-NULL. The former ensures that the previously read values
(width, height, etc) were valid, and the latter checks that the Parcel
had enough data even if the number of colors was reasonable.

Also use an auto-deleter to handle deletion of the SkBitmap.

BUG=19666945

Change-Id: Icbd562d6d1f131a723724883fd31822d337cf5a6
2015-03-11 17:34:51 +00:00
Chris Craik
2d08eaf034 Merge "Revert "Revert "Remove references to SkPorterDuff as it is deprecated.""" 2015-03-06 18:42:30 +00:00
Chris Craik
1526a458a3 Revert "Revert "Remove references to SkPorterDuff as it is deprecated.""
Fix build breakage.

This reverts commit 26b4f598c8b1e99b43261614a6861785638c8c00.

Change-Id: If39ce2a41d26a8520091f330234c3d35e413ee92
2015-03-06 18:42:15 +00:00
Chris Craik
fdbf68ff6c Merge "Revert "Remove references to SkPorterDuff as it is deprecated."" 2015-03-06 18:16:45 +00:00
Chris Craik
26b4f598c8 Revert "Remove references to SkPorterDuff as it is deprecated."
bug:19627342

This reverts commit a9aded1f6253afbea7906509992a8a3721f731ab.

Change-Id: Ic865edfbd31c9e24d18a1397a1d346633376e20a
2015-03-06 18:15:39 +00:00
John Reck
f4faeac352 Cleanup Bitmap JNI attempt #2
Original version missed a spot

This reverts commit c02977e3bbfaaedcb1b1d67e1692becc7dddd59b.

Change-Id: I56244ce10d709fcdef42a001fe4c6ba7b6bbb04d
2015-03-05 13:56:16 -08:00
Chad Jones
b9a468eb19 Merge "Revert "Cleanup Bitmap JNI"" 2015-03-05 19:35:15 +00:00