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
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
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
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
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
Bug: 18928352
Also fix an issue around re-configure not properly handling
mPinnedCount in android::Bitmap
Change-Id: I1815b121f1474ad931060771bb1d52ef31d2aac7
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
Switch a few places to using android::canvas
instead of SkCanvas as well which eliminated
some JNI
Change-Id: I8f98b56442a06362b82b984cd1bd3a92398d8dbc
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
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
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
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
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
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
Also add additional compile time checks to ensure that the Java
and Skia APIs remain in sync.
bug:19890753
Change-Id: I8503cacf2859307e3f480a78603f9f05901b58cc
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
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
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
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
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