727 Commits

Author SHA1 Message Date
Raph Levien
0ead890d1c Merge "Support for context in Minikin shaping" into lmp-preview-dev 2014-06-05 19:37:08 +00:00
Raph Levien
30d3c97f29 Merge "Support for scaleX and skewX in Minikin" into lmp-preview-dev 2014-06-05 19:26:33 +00:00
Raph Levien
6bfd7e7df3 Support for context in Minikin shaping
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
2014-06-05 11:01:21 -07:00
Raph Levien
e95b5850ac Support for scaleX and skewX in Minikin
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
2014-06-05 10:57:18 -07:00
Raph Levien
1633caef58 Query style from asset-created font (Minikin)
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
2014-06-04 13:46:35 -07:00
Raph Levien
854363e3d2 Fix incorrect getStringBounds (Minikin)
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
2014-06-03 21:11:06 -07:00
Raph Levien
f2114d5646 Better Minikin integration
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
2014-06-03 17:44:35 -07:00
Raph Levien
596f0b1a03 Merge "Support fallbacks for custom typefaces (Minikin)" into lmp-preview-dev 2014-06-02 22:54:58 +00:00
Raph Levien
a0cba0fde3 Check for NULL on TypefaceImpl unref
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
2014-06-02 13:37:34 -07:00
Raph Levien
d573794d83 Support fallbacks for custom typefaces (Minikin)
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
2014-06-02 10:56:23 -07:00
Raph Levien
f9e3d31127 Language and variant selection for Minikin
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
2014-05-29 14:21:24 -07:00
Leon Scroggins III
0fa2bd699a DO NOT MERGE Inspect SkShader to determine hw shader.
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
2014-05-23 11:50:38 -04:00
Mathieu Chartier
304bbd287c Temporary fix for buffer overrun issue.
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
2014-05-21 15:14:02 -07:00
Victoria Lease
49f0db3481 fix argument order in call to SkBlurDrawLooper constructor
This fixes all sorts of badness.

Bug: 15074512
Change-Id: I5e96983c58d19e0dc2d8fa61d1efa9dcff076ca1
2014-05-19 16:12:22 -07:00
Raph Levien
b98de0dcd6 Get rid of dirFlags log spam
I was logging the BiDi flags for debugging, did not mean to commit this.

Change-Id: I0a89c68fe17562f2ed38843efacbaa310dca24fa
2014-05-16 11:50:50 -07:00
Svetoslav
dbef65f1a1 Merge "Adding APIs to render PDF documents." 2014-05-15 20:15:06 +00:00
Mike Reed
4c9355c35a Frameworks changes to support latest Skia (r14729)
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
2014-05-15 10:17:44 -04:00
Raph Levien
1044a8211d Merge "BiDi support for Minikin" 2014-05-15 02:11:48 +00:00
Raph Levien
9e2b288ba8 Merge "Proper refcounting for Minikin objects" 2014-05-15 02:03:48 +00:00
Raph Levien
018646adac Merge "Parsing of XML font configuration files for Minikin" 2014-05-15 02:03:34 +00:00
Raph Levien
2836c4722a Merge "Start of Minikin integration" 2014-05-15 02:03:05 +00:00
Svetoslav
2961769ea9 Adding APIs to render PDF documents.
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
2014-05-13 18:32:42 -07:00
Raph Levien
9d9ee3d666 BiDi support for Minikin
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
2014-05-12 15:16:17 -07:00
Raph Levien
15cf4757dc Proper refcounting for Minikin objects
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
2014-05-12 10:41:43 -07:00
Raph Levien
9a5b61ccc8 Parsing of XML font configuration files for Minikin
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
2014-05-12 10:41:42 -07:00
Raph Levien
1a73f732f9 Start of Minikin integration
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
2014-05-12 10:41:42 -07:00
John Reck
c42bfb95c6 Merge "Refactor VirtualLightRefBase & JNI" 2014-05-09 23:18:26 +00:00
John Reck
9fa4071c47 Refactor VirtualLightRefBase & JNI
Change-Id: I8e244e7109e59d5be96871b23bb9b1201c7f9eaa
2014-05-09 15:28:54 -07:00
Chris Craik
32054b0b3e Fix Bitmap.cpp line endings
Change-Id: Icc0b067437fffaa599c92841518ad0d526112f59
2014-05-09 13:59:36 -07:00
Derek Sollenberger
5b554f0103 Merge "Avoid caching shadow properties in Java & HWUI." 2014-05-08 14:41:47 +00:00
Derek Sollenberger
c29a0a4664 Avoid caching shadow properties in Java & HWUI.
bug: 10650594
Change-Id: I6f57df002710bb0567ed7e53fc0bfe96cfd504b8
2014-05-07 09:36:04 -04:00
Jeff Brown
c7282e57cd Fix crash due to texture view callback threading invariants.
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
2014-05-06 17:13:43 -07:00
John Reck
52244fff29 Add CanvasProperty for drawCircle
Change-Id: Icbcc030f5033d2094e567d7c519b9d672f2aac1c
2014-05-02 13:43:46 -07:00
Elliott Hughes
fae7bedcf0 am f84493ec: am 91ff3c18: am 7d3f9e97: Merge "Fix for native leaks in YuvToJpegEncoder.cpp"
* commit 'f84493ec95bfce41106673645a3e56b185e54df5':
  Fix for native leaks in YuvToJpegEncoder.cpp
2014-04-30 23:19:03 +00:00
Elliott Hughes
91ff3c18db am 7d3f9e97: Merge "Fix for native leaks in YuvToJpegEncoder.cpp"
* commit '7d3f9e9730b100de4c0e643e13bf59bf54ef7819':
  Fix for native leaks in YuvToJpegEncoder.cpp
2014-04-30 19:02:53 +00:00
Elliott Hughes
7d3f9e9730 Merge "Fix for native leaks in YuvToJpegEncoder.cpp" 2014-04-30 18:59:54 +00:00
Bill Yi
293513a59d Merge commit '0b62467b142b61ee1e449ba958ba37dfd961ef56' into HEAD 2014-04-29 16:07:29 -07:00
Chris Craik
7979388d4f Support Oval GradientDrawable outlines, and ShapeDrawable
Change-Id: Ifc9e55757d3325cb28a1a812ec696512d4a18b39
2014-04-25 15:59:47 -07:00
Chris Craik
4d1c1538e2 Add floats-only drawRoundRect to Canvas
Change-Id: Ib0033a2d2486a808a44984ec4adf7fef76d9ea17
2014-04-24 14:23:52 -07:00
Raph Levien
0613657426 Merge changes Ia693f512,If3b7d41f
* changes:
  Enable elegant text metrics in Quantum theme
  Add elegantTextHeight text appearance attribute
2014-04-17 19:21:14 +00:00
Raph Levien
53c0077256 Add elegantTextHeight text appearance attribute
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
2014-04-17 11:16:46 -07:00
Skia_Android Canary Bot
5932b0d8fc Call SkShader::isOpaque() to determine opaqueness.
It is invalid to call SkShader::getFlags() before calling
SkShader::setContext() - it will always return 0. Instead, call
SkShader::isOpaque().

Change-Id: If35108dc7f0eca55d2ec8466b8a50fd54dfb13a2
2014-04-17 09:55:59 -04:00
Leon Scroggins III
2e0103eb34 Remove SkFloatToScalar.
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
2014-04-07 18:41:17 -04:00
Leon Scroggins
cc11f15f76 Update to call new Skia APIs.
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
2014-04-04 14:42:39 -04:00
Leon Scroggins
4a857b1d47 Merge "Update framework to use M34 version of Skia." 2014-03-27 19:36:43 +00:00
Narayan Kamath
ecd072161e resolved conflicts for merge of 22d07464 to master
Change-Id: Ic037261eedd6e224938c960d2b4597590c81ed9d
2014-03-27 14:22:47 +00:00
Leon Scroggins
46cb9bdbf5 Update framework to use M34 version of Skia.
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
2014-03-27 09:42:17 -04:00
Narayan Kamath
22d074643e resolved conflicts for merge of eaab4df0 to klp-modular-dev-plus-aosp
Change-Id: I871431e5a3ce45a33563ced845e044d37471689b
2014-03-27 12:50:58 +00:00
Ashok Bhat
f5df700e6c AArch64: Make frameworks/base code more portable
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>
2014-03-27 12:30:42 +00:00
Narayan Kamath
163b865564 am ea96d791: am 5f0d44f6: Merge "Fix scaleNinePatch."
* commit 'ea96d791c7eca3eb5d003b8559b89a573f81dac9':
  Fix scaleNinePatch.
2014-03-25 14:32:10 +00:00