This patch uses the Minikin's new doLayout API that supports context,
and has some simple refactoring (pass css as string rather than setting
on the Layout object) to use this api.
Change-Id: I899474f81d377f3106e95ee3eb8d0fcc44c23ac2
Passes textScaleX and textSkewX parameters, as well as paint flags from
the paint to Minikin, to support nontrivial scale and stretch of text.
Passing paint flags should minimize kerning artifacts arising from
mismatch of glyph rendering in layout and drawing.
Also, replaces unsafe snprintf to a fixed size buffer with a safe
version, which still avoids an allocation per layout operation.
This is part of the fix for bug 15186705 "Usability of the suggestion
strip in recent OTA's is severely reduced"
Change-Id: I79788383135836f4c21fb84405f36382627bf959
This patch sets fStyle on the TypefaceImpl based on querying the font,
which is important in the Typeface.createFromAsset path. This fixes both
the style returned from getStyle() and also selects fallback fonts to
best match the style of the main font.
Fixes bug 15429916: "Typeface.getStyle always returning 0 in some L
devices".
Change-Id: I1992ba1e65e7f488d331e175f5f12843f67c2faa
This patch wires up getStringBounds to do the layout with Minikin to get
accurate bounds, and with the correct typeface. It fixes bug 15416575
"getStringBounds gives wrong result in Minikin".
Change-Id: I5c020bc372acb1d785a33c3c296239c151bd8c87
This patch improves the Minikin integration in a number of ways,
including:
Software rendering does text decorations and handles alignment
correctly. This fixes bug 15139067 "Centered text isn't working".
Paint implements getTextPath. This fixes bug 15143354 "Text rendering in
Maps Navigation wrong typeface?"
Also a bit of refactoring, since there was duplicated code for iterating
font runs that's now a static method in MinikinUtils.
Change-Id: I4cfdb2c0559982376348325a757d95235fab1768
It's possible for a TypefaceImpl to contain a null pointer, which was
causing crashes on unref. This patch just checks for NULL.
Fixes bug 15104801 "Aviate Launcher crashes on startup - Hammerhead L
AAV49B"
Change-Id: Idf9f176c54bf81ff3daacc0b33e95aa9d8bbe57f
This patch adds the fallback font list to custom typefaces created from
files and assets, as well as those created by name. This is a fix for
the deskclock half of bug 15139067 "Centered text isn't working".
Change-Id: I0cc60951953dfb73817a98ddfee5713f0387ee90
This is the frameworks/base side of what's needed to support language
selection (especially Han unification, but also compact/elegant
selection for scripts that require more vertical space).
This is part of the fix for bug 15179652 "Japanese font isn't shown on
LMP".
Change-Id: I8f0f3aa9a1915659f8d0b590cf1c56529356049a
cherry-pick of Iaa7189178bda1c55f96da044d2a9fa602ba36034
Instead of duplicating internal info about SkShader, inspect the
SkShader installed on the SkPaint.
core/java/android/view/GLES20Canvas.java:
Remove setupModifiers, nResetModifiers, and nSetupShader.
core/jni/android/graphics/Shader.cpp:
Remove calls to create/destroy the (previously) attached SkiaShader.
core/jni/android_view_GLES20Canvas.cpp:
Remove native code for setupShader and resetModifiers.
graphics/java/android/graphics/BitmapShader.java:
graphics/java/android/graphics/ComposeShader.java:
graphics/java/android/graphics/LinearGradient.java:
graphics/java/android/graphics/RadialGradient.java:
graphics/java/android/graphics/Shader.java:
graphics/java/android/graphics/SweepGradient.java:
Remove code keeping track of native SkiaShader.
libs/hwui/Caches.h:
Include Extensions.h.
libs/hwui/DeferredDisplayList.cpp:
Compare shaders on the paint, instead of on DrawModifiers.
libs/hwui/DisplayList.cpp:
libs/hwui/DisplayList.h:
Remove vector of SkiaShaders.
libs/hwui/DisplayListOp.h:
Access the SkShader on mPaint.
Remove SetupShaderOp and ResetShaderOp.
libs/hwui/DisplayListRenderer.cpp:
libs/hwui/DisplayListRenderer.h:
Remove resetShader, setupShader, refShader, and mShaderMap.
libs/hwui/FontRenderer.cpp:
Pass SkShader to setupDrawShader and setupDrawShaderUniforms.
libs/hwui/OpenGLRenderer.cpp:
libs/hwui/OpenGLRenderer.h:
Add LayerShader, a class inheriting from SkShader, to mimic the
behavior of SkiaLayerShader. Unlike SkiaLayerShader, it can be set on
the SkPaint so it can be inspected later.
Set a LayerShader instead of a SkiaLayerShader.
setupDrawShader and setupDrawShaderUniforms now inspect an SkShader
passed in.
Inspect SkShader instead of mDrawModifiers.mShader.
Remove resetShader and setupShader.
setupDrawColorUniforms now takes a boolean indicating whether there is
a shader.
Add an inline function for accessing the SkShader on an SkPaint.
In setupDrawBlending(Layer*, bool), do not check the shader (which will
never be set), but do check whether the color filter may change the
alpha (newly fixed behavior).
In setupDrawBlending(SkPaint, ...), check the SkShader and whether the
color filter affects alpha (the latter is new behavior).
libs/hwui/Renderer.h:
Remove pure virtual functions setupShader and resetShader.
libs/hwui/ResourceCache.cpp:
libs/hwui/ResourceCache.h:
Remove functions for refing/unrefing shaders.
libs/hwui/SkiaShader.cpp:
libs/hwui/SkiaShader.h:
Much of this code was redundant and has been removed.
Convert structs into class with nothing but static functions for
calling describe/setupProgram.
libs/hwui/TextureCache.cpp:
libs/hwui/TextureCache.h:
Use the SkPixelRef as the key to the bitmap Lru cache, since shader
inspection will provide a different SkBitmap pointer (though it will
hold the correct SkPixelRef with the correct generation ID).
tests/CanvasCompare/src/com/android/test/hwuicompare/DisplayModifier.java:
tests/CanvasCompare/src/com/android/test/hwuicompare/ResourceModifiers.java:
Update manual test to have more shaders: radial, sweep, compose,
invalid compose.
BUG:10650594
Change-Id: I2e7182b3fc28268e7ca82fac6780540b6b45365c
Allocating the bitmap using getSafeSize() causes problems since
getSafeSize64() < getSize() if there is a stride. Since everywhere
else uses getSize() it results in a lot of possible buffer overruns.
The fix reverts to using getSize instead of getSafeSize64.
Bug: 15089814
Change-Id: Ia471cf9715672d57bb7eb61bf735064aeb405ffe
Required for a merge in external/skia
(I88b4d5cc81c357a8e223bd7860b1029590265200).
Includes two cherry-picks:
I456df543e1925b280f785c7b3bb81370157f9b09:
replace SkRasterizer* with NativeRasterizer* in JNI
I98adb200e023369d3ee75f21927fa98f23095a77:
Fix Paint.getFlags,setFlags wrt FILTER_BITMAP_FLAG
In Paint.setFlags(), turn FILTER_BITMAP_FLAG into a call to
SkPaint::setFilterLevel().
In Paint.getFlags(), read SkPaint::getFilterLevel() to determine
whether to include FILTER_BITMAP_FLAG in the result.
Fixes CTS tests with ToT Skia.
Change-Id: I2736f3f68683651574d79a169ff0ab563e0a469e
We need to render PDF documents for two main use cases. First,
for print preview. Second, for resterizing the PDF document by
a print service before passing it to a printer which does not
natively support PDF (most consumer ones).
Adding PDF rendering APIs improves guarantees for print quality
as the same library is used for preview and rasterization. Also
print vendors do not have to license third-party rendering engines.
Last but not least as the platform uses PDF as its main print
format it should also be able to natively render it.
Change-Id: I57004a435db147663cafea40cf3296465aba7f99
This patch plumbs the bidiFlags for the various text drawing and
measurement functions down to Minikin, so that the latter can do layout
in a BiDi-aware manner. With the corresponding changes to Minikin, it
is sufficient to correctly display RTL text in TextViews.
Change-Id: Ie904f297373b9ad418050a474506605c7c127b0f
This patch introduces proper lifecycle maintenance (based on reference
counting) for Minkin objects, particularly FontFamily and
FontCollection. The patch depends on the corresponding Ref and Unref
methods being available in Minikin.
Change-Id: I91935e953d5a522e1adc496f2ce3a598be35de2b
This patch improves Minikin-based font handling, to deal with error
conditions (missing fonts and so on), and also moves the parsing of
fallback_fonts.xml and system_fonts.xml into Java code.
Change-Id: Ib0debdbd56ad3b0196be6d2a35668d711c98f1e5
This is the current state of the Minikin integration. All changes are
hidden behind USE_MINIKIN #ifdef, so it should be safe to apply. To
play with the Minikin branch, set this in your BoardConfig.mk .
This change also merges in 64-bit changes that were happenening in
parallel.
Change-Id: Idd94553bcbe324c5875d0ff06495c966c3e95b7f
Allow the client of a SurfaceTexture to specify the Handler to
which the update callback should be directed to avoid unnecessary
scheduling ping-pong between threads.
Fixed an invalid assumption in TextureView that it is attached
to the main looper which could result in a crash under certain
circumstances. In normal app processes, it is true that TextureViews
must be created on the main looper since hardware rendering is
currently only supported on the main looper. However, in the
system server, UI components run a different thread. Although
hardware rendering is normally disabled in the system server,
it may be enabled for certain developer features.
Bug: 14445309
Change-Id: I5ae17ad018b9ef05ba87ec2f972c7c82e2bca70a
This patch adds an elegantTextHeight text appearance attribute and
plumbs it through to the paint. This attribute selects the elegant
variant of fonts (when appropriate, which is typically Arabic and indic
scripts), and also specifies larger vertical metrics, to avoid clipping.
The intent is for this to be the default for quantum themes, but this
patch doesn't change any default behavior, just adds the attribute.
The larger vertical metrics are applied to top and bottom, but should
not affect line spacing in the common case. Also, with the setting,
metrics are no longer dependent on the font, so setting a custom font
will preserve layout and spacing.
Change-Id: If3b7d41f141deff50ca078f479ca90c2aa07829a
It is invalid to call SkShader::getFlags() before calling
SkShader::setContext() - it will always return 0. Instead, call
SkShader::isOpaque().
Change-Id: If35108dc7f0eca55d2ec8466b8a50fd54dfb13a2
Now that SkScalar is always float (it may someday be double, but
float to double is trivial), remove callers of SkFloatToScalar,
which is deprecated in Skia.
BUG:13694396
Change-Id: I524a9bb6f7702bc810bac55fb9d2cd5361a01cf7
I816129d49c0118453222916f3c818eccac33663d merges a new version of
Skia that updates various APIs. Call the new ones.
SkBitmap::copyTo now takes an SkColorType instead of an
SkBitmap::Config, so do the conversion with
SkBitmapConfigToColorType or use the enum when it makes sense.
Call SkImageDecoder::decodeSubset instead of (deprecated)
SkImageDecoder::decodeRegion.
Override SkCanvas::ClipVisitor::clipRRect in ClipCopier.
In Canvas::clip calls, call SkCanvas::isClipEmpty(), which was
previously called inside the clip call, to determine the return value.
For various SkPaint effects, call the new factories (as the constructors
have been made protected).
Implement SkJavaOutputStream::bytesWritten(), overriding a new pure
virtual function on SkWStream.
Update Matrix calls to always return true (since SkMatrix calls no
longer return a value).
Depends on I816129d49c0118453222916f3c818eccac33663d (skia).
Change-Id: I5cdcea827ebff587df0bbddc0965e3e0fbf48002
These changes are needed due to changes in the Skia API.
Depends on https://googleplex-android-review.git.corp.google.com/#/c/439626/1
(Ic3cf846b74d6f10ec30c477b50fd774cc30ad52c)
BitmapFactory.cpp:
Use SkColorType instead of SkBitmap::Config, where possible.
Call SkBitmap::info() instead of deprecated SkBitmap::asImageInfo().
Remove calls to deprecated SkBitmap::getSize64().
Canvas.cpp:
ColorFilter.cpp:
Matrix.cpp
Remove the deprecated SK_SCALAR_IS_FIXED path. Leave in an else case for
SK_SCALAR_IS_FLOAT, to allow for eventual SK_SCALAR_IS_DOUBLE path.
Graphics.cpp:
Like in BitmapFactory.cpp, use new methods for determining the size of
pixels.
Paint.cpp:
Use more precise SkScalar_ToInt versions of macros.
TextLayoutCache.cpp:
Fix bug in macro definition for HB_SurrogateToUcs4.
Use the new name for SkCreateTypefaceForScriptNG.
android_view_SurfaceControl.cpp:
Replace ScreenshotPixelRef with a Skia pixel ref.
This is a merge from master-skia branch:
https://googleplex-android-review.git.corp.google.com/#/c/430554/
(Ie11503bcefd3883c466279fde5ce147c8a72b452)
Change-Id: Idf15746f93dabeb7862ac02cc6bd925f0dcc68ba
Changes in this patch include
[x] Use %zu for size_t, %zd for ssize_t
[x] Some minor changes have been done to conform with
standard JNI practice (e.g. use of jint instead of int
in JNI function prototypes)
Change-Id: Id1aaa7894a7d0b85ac7ecd7b2bfd8cc40374261f
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>