Fixes a bug introduced in I3c3316377874e89fccc85afb864bc038b0ef3890.
CreateLocalMatrixShader combines the existing matrix with the new
matrix, which is not what we want. Keep track of the original
SkShader at all times, and always create the local matrix shader
with the original. Store the SkShader with a local matrix as
Shader.native_with_local_matrix.
Make Shader.native_instance private. Instead of allowing direct
access, add an init() method which sets it, and getNativeInstance(),
which returns either native_instance or native_with_local_matrix,
as appropriate.
Make Shader subclasses call init(), instead of setting native_instance
directly.
Pass native_with_local_matrix pointer to nativeSetLocalMatrix and
nativeDestructor, which unrefs it (if not null).
Since nativeSetLocalMatrix no longer replaces the original, do not
unref it.
Add a comment to Shader.updateLocalMatrix that it does not affect
ComposeShaders created with this Shader. (This should have been a
part of I3c3316377874e89fccc85afb864bc038b0ef3890.)
BUG:16293121
Change-Id: Ieb31c7e1fe99081f6b81493178f4a18d3c5df643
Symptom: SkBitmap::getAddr(int, int) may return NULL due to unrecognized config
(ex: kRLE_Index8_Config). This will cause memcmp method to crash. Since bm0 and
bm1 both have pixel data() (have passed NULL == getPixels() check), those 2
bitmaps should be valid (only unrecognized), we return JNI_FALSE to warn user
those 2 unrecognized config bitmaps may be different.
Cherry-pick of 3a1bffa835f279628e50385af3c85789bc737f64 from AOSP
Change-Id: I6970c27de412110a3035d0a783112c4cd3ebc35b
The idea is that extra paint parameters that only affect text layout
(not rendering) will go in android.Paint instead of going into
SkPaintOptionsAndroid. We will eventually move those out of SkPaint
too.
This is currently implemented in PaintImpl.cpp. Will be renamed when
current Paint.cpp that has JNI bits is moved to android_graphics_Paint.cpp.
Change-Id: Iba66c34dea5da503a13b9c864cb9f2211ac4ba7d
This introduces Canvas.h which is a pure virtual interface that
is intended to be used by both Skia and HWUI implementation. To help
stage this transition this CL only introduces the interface and Skia
implementation. The interface is not intended to be final and will
undoubtedly go through iterations in both style and location as we
look to introduce the HWUI implementation.
BUG:15672762
Change-Id: Ibaccdddb87d3b9358f4f0c1d317ead5282d4ee16
This reverts commit e28a5afee885cd69a5be5809f88116b601cb1a72.
Appears to cause memory corruption and random appearances of
chinese
Bug: 16343240
Bug: 16336642
Change-Id: Ife169181f40adff4b12948ed5f9d3a88dcec935b
This introduces Canvas.h which is a pure virtual interface that
is intended to be used by both Skia and HWUI implementation. To help
stage this transition this CL only introduces the interface and Skia
implementation. The interface is not intended to be final and will
undoubtedly go through iterations in both style and location as we
look to introduce the HWUI implementation.
BUG:15672762
Change-Id: Idefadede356f688edb8eb09b4a02aa01b4077f62
b/15856895
Nine patches now have outline round rect metadata stored as optional
png tags. aapt generates these automatically by inspecting the bitmap
pixels to estimate outline bounds and round rect radius, based on
opacity.
Change-Id: I226e328a97873010d9e1adb797ac48f93a31183c
Previously, calling setLocalMatrix updated any Paint that had the
Shader attached. This depended on deprecated behavior in Skia. Use
new Skia APIs, and do not modify any Paints that use the Shader.
In addition, update callers to call setShader (again) after modifying
the Shader.
Sample app at ag/499573 for testing.
Depends on I673801444f0a8fd4f192b5b7effdde1aa83e702b in external/skia.
BUG:14315916
Change-Id: I3c3316377874e89fccc85afb864bc038b0ef3890
This change adds the pring preview part of the new print UX. The
UI has two parts, the top section is the print options and the
bottom section print preview with a list of pages. The user can
interact only with one of them. When print options are expanded
they cover the preview content and a scrim is laid out on top of
the preview. Tapping the scrim collapses the print options. When
the user types in page ranges and closes the options to look at
the preview, the latter is updated to show only these pages. In
the list of pages the user can further prune pages by deselecting
them.
Change-Id: I0b23d2c598afe2a34400ccfa43e4e935af83c72f
Creating a typeface from a missing file crashes when it tries to extract
the style from the font. This patch just uses default style when the
resulting font object is NULL.
Bug: 15930808
Change-Id: I9438687100026f336db7aa204fe3a0232eee2db6
Replace the Java variable with mRequestPremultiplied, to better
reflect what it represents. In both native and Java, the SkBitmap
is used as the decision maker of whether a Bitmap is premultiplied.
When changing other settings, mRequestedPremultiplied is used to
determine whether it should be premultiplied (if the new config/
hasAlpha-ness etc supports it).
ChooseFromColorProc now reads both the colortype (instead of the
deprecated Config) and alphatype on the SkBitmap. Same with
ChooseToColorProc. In the process, this caught a bug, where the
wrong procs were being used for Index8.
Replace instances of SkBitmap::Config with SkColorType where I
was already changing code.
Use the new versions of setConfig/allocPixels that take an SkImageInfo
as a parameter.
Document isPremultiplied's return value for ALPHA_8.
BUG:13618134
Change-Id: I91fc1f1e46e9294364b1af0ab4bdb37c68d7058e
Adds a constructor that doesn't require a GLES texture name and sets
up the SurfaceTexture in detached mode.
Bug: 15616428
Change-Id: I375495f481bfbe43b3830ab7d124cef8f1be0ac6
Other files were including GraphicsJNI.h and didn't have Minikin in the
include path. This patch eliminates the offending include.
Change-Id: I05c9dbf80b93f1731fd0192015e2c9c68a9dd3c6
This patch switches all text layout operations to use Minikin, removes
the USE_MINIKIN #ifdef, and deletes some of the code that was only used
in the old TextLayout path (although some more refactoring remains).
Change-Id: I51b5c4e2bb46cfd9d204c12b9f16f135c769f5b5
The Paint.getTextGlyphs() method was used for testing the old Arabic
shaper and is entirely obsolete. Note that this is the very last
dependency (other than some enums in the header) for the old TextLayout
code path.
Change-Id: I7b596f0c0942ed50987fc8e0478cd93e667f1f9e
This patch uses the Minikin implementation of grapheme cluster breaking,
which improves the behavior of left and right arrow keys for moving the
cursor. Among other things, it fixes the behavior of jumping over the
"fi" ligature in Roboto.
Part of a fix for b/15653110 Improve behavior of arrow keys in EditText
Change-Id: I80ca54c973d85c49f23b81d51a0fe07a7a853d81
The existing implementation of drawPosText is broken in various subtle
ways, in any case doesn't work with Minikin. This patch just implements
it by drawing a separate run for each Unicode character, which should
have the least surprising results for complex scripts such as Khmer.
Part of b/11750374 Resolve TODO items for Minikin
Change-Id: I874ae3c163f0cbe3cdf0160564fab04305aed5aa
This patch contains an implementation of drawTextOnPath for both
software and hardware Canvas using Minikin for text layout. One of the
steps for switching all remaining text operations to Minikin so the old
TextLayout and Skia fallback fonts mechanisms can be deleted.
Bug: 11750374 Resolve TODO items for Minikin
Change-Id: I06bfe74a101fa1dcdfc38f530f7194d71e522a85
The dirFlags and bidiFlags enums are distinct, and have different
meanings. The former is a determined direction for a run of text, while
the latter is a request for the bidi algorithm. They have been used
interchangeably, and this has caused some problems, notably running the
bidi algorithm needlessly when the direction for a run is already
determined.
This patch cleans up the confusion, by always naming each occurrence
explicitly "boolean isRtl" or "int bidiFlags" (the previous code often
just used "int flags", which added to the confusion), and converts
between the meanings when a function takes an isRtl argument but passes
it to another function expecting bidiFlags.
Fixes b/15089607 Clean up bidi flag mess
Change-Id: I410b6604376e853dd12c255e7f5a9d2b9a310dd9
This fixes CTS tests which are crashing on an SkASSERT due to a
mismatch of SkImageInfo between the SkPixelRef and SkBitmap.
Also directly call ref() and unref() instead of SkSafeRef/SkSafeUnref,
since we would already crash if the SkPixelRef in question was NULL.
Also if the user attempts to reconfigure to 4444, use 8888 instead.
Change-Id: I473ef225c6cd1c92d67ae103c53c6cff0dad92de
Consists of 3 cherry-pick from changes by robertphillips@google.com
in master-skia:
-----------------------------------------------------------------------
New AndroidPicture wrapper class
Address code review comments & use new SkPictureRecorder::partialReplay
entry point
Addressing code review issues
Switch MakePartialCopy to makePartialCopy
Conflicts:
core/jni/android/graphics/Picture.cpp
Ie530ab15b3d549f0ecfb0ecc131f9144a7b72a91
Remove AndroidPicture from GraphicsJNI and split into .h and .cpp
-----------------------------------------------------------------------
Fix lingering legacy picture recording behavior
Address code review issues
Iaf870c2c400dbe70dc32d6d445574904f5ea718f
-----------------------------------------------------------------------
Update Android to new SkCanvas::drawPicture interface
As of Skia 9b14f26d (Alter SkCanvas::drawPicture (devirtualize,
take const SkPicture, take pointer) -
https://codereview.chromium.org/313613004) SkCanvas::drawPicture
has an alternate signature. The old entry point is deprecated.
I63395da61ecc3b58bfd2bc094752081f4b2f7535
-----------------------------------------------------------------------
Change-Id: I041133aeb5639abd853370e512acf93870f82aea
With granular state flags being deprecated, always pass full
save flags to the native canvas.
Legacy behavior is emulated in NativeCanvasWrapper, with a focus
on minimizing the overhead when there are no side effects to be
persisted.
Change-Id: Ifdad2ff9bb3a1f9736c6c41afc9ec6c07f62320e
This patch adds fake italics, using essentially the same mechanism as
the fake bold implementation. Also combines fake bold/italic settings
with ones explicitly set in the paint.
Change-Id: Ia7eb3ddc8a6192d191711ba723ffd0d1d9d93f2e
Part of the fix for bug 15436379 Fake bold doesn't fully work (Minikin)
This patch queries the Minikin layout for when fake bold is needed,
and applies that to both shaping and drawing paint.
Also simplifies refcounting (the lifetime of all MinikinFont objects
is subsumed by the enclosing FontCollection).
Note: the fake bold flag set by the user is ignored in this patch.
Fake italics would be possible using the same mechanism, but it's
slightly more complicated (fake and user-set textSkewX values would need
to be combined, and the latter restored after drawing).
Change-Id: Ica2c4604846cbb37e5a783778b18d8993c9d4563
Fixes a number of individual problems. In Minikin builds, gets base font
from TypefaceImpl rather than using whatever random font was in the
paint. Respects elegant metrics in ascent and descent methods as well as
getFontMetrics. Sets fixed ascent and descent values to 1900, -500,
which matches the Roboto font.
Part of the fix for bug 15467288 "Inconsistent line heights on
Minikin builds"
Change-Id: I12915f4a62de28932469c7279241eecf7320c47b