1063 Commits

Author SHA1 Message Date
Philip P. Moltmann
7c90661a6f Do not move PDF content as the content is already moved.
Bug: 26961589
Change-Id: I444a4164f3b98af7aeb6df6e9a0b025d20a4a93b
2016-03-03 13:20:38 -08:00
Yujie Qin
c1d7b7f71c Use SkFILEStream directly when possible
When decoding from a file descriptor, if the descriptor is seekable and
has no offset, use SkFILEStream directly instead of wrapping in an
SkFrontBufferedStream.
This will let the SkRawCodec take advantage of a seekable stream.
One can see 2x speed up for RAW cases.

Bug: 27097104
Change-Id: I369fbb3af1170c94ec7cd9bb35e8e0007dde9fd5
2016-02-29 15:49:51 +01:00
Ben Wagner
31af215b26 Merge "Use UTF32 directly in HarfBuzz<->Skia interface." into nyc-dev 2016-02-19 15:03:48 +00:00
Keisuke Kuroyanagi
f491051143 Merge "Optimize: Use measureText instead of doLayout." into nyc-dev 2016-02-18 23:19:44 +00:00
Ben Wagner
c1fa6d0deb Use UTF32 directly in HarfBuzz<->Skia interface.
This fixes a TODO to use kUTF32_TextEncoding directly. This avoids
encoding UTF32 codepoints from HarfBuzz into UTF16 to pass to Skia,
which will then re-decode to UTF32. This also removes a use of
SkUtils.h which Skia desires to move to private use.

Change-Id: I087f4216c25f7874e496920cd33e2f109530c397
2016-02-18 17:20:17 -05:00
Keisuke Kuroyanagi
4c8a526478 Optimize: Use measureText instead of doLayout.
measureText is a light weight method dedicated to measure text width.
With this CL, breakText, doRunAdvance and doOffsetForAdvance use
measureText.

Bug: 24505153

Change-Id: Ibd62de2e0fe2e196cf07472f2270cc8c6325daab
2016-02-18 11:31:56 -08:00
Derek Sollenberger
fd00820ca3 Update Region parcelling to use SkRegion::Iter
Bug: 26593930
Change-Id: Ie673c776ed7e1c327ca0f3196900fbb229c2a936
2016-02-17 12:22:20 -05:00
Leon Scroggins
8e552f2eae Merge "use std factory for compose-shader" into nyc-dev 2016-02-16 14:51:36 +00:00
Ben Wagner
fb95699364 Deduplicate font file mappings.
With ttc and gx variation fonts, it is now possible and common that a
number of fonts will use the same font file for data but with different
parameters. In the current code each font will map the font file data,
taking up an unecessary amount of virtual address space and is
inefficient with respect to memory management (like the tlb). This CL
deduplicates these file mappings so that a given font file will only be
mapped into memory once.

DO NOT MERGE
Change-Id: I5ca69f963a434c72ec4028402ecbf9e0f0ee7148
(cherry picked from commit fffcf0a31fd4c9a4ec8aa7de70b1eda0d48fb337)
2016-02-12 19:33:26 +00:00
Ben Wagner
e2caaa9c8d Merge "Add support for gx font variation axes." into nyc-dev 2016-02-12 18:50:12 +00:00
Ben Wagner
a87b07d7fa Add support for gx font variation axes.
This adds an 'axis' child element to the 'font' element. The 'axis'
element has attributes 'tag' (a four byte identifier) and 'stylevalue'
(a float value) to the parser. This also modifies reading the font file
name in a backwards compatible fashion by using only the direct #text
children of the 'font' element. (Both the Minikin and Skia parsers now
allow the font file name on a separate line in the fonts.xml file).

This information is then passed through to Skia in order to select the
desired variation. The Skia parser already parses this way and has for
some time, so Chrome and WebView can already read this format.

Change-Id: I15623fe864fa92b2bf0705af5e389daedfb77e5c
(cherry picked from commit b8e367fb7428076ff2e4aa2a97adaed1ef806e92)
2016-02-12 16:28:35 +00:00
Matt Sarett
96ffbdc9dd Use SkCodec::MinBufferedBytes() for front buffered image decode stream
This should not change decode behavior, but it's worth noting that
the number of bytes buffered will decrease from 64 to 30.

Change-Id: I66b0e38a487c1786823b0125686b094dae5d13dc
2016-02-12 15:15:12 +00:00
Mike Reed
c3703a258d use std factory for compose-shader
Change-Id: I4562d66cb8b9b8237e6aae7c205228731732cf17
2016-02-12 14:35:28 +00:00
Matt Sarett
1819bb5230 Copy appropriate number of rows in RecyclingClippingPixelAllocator
This is used by BitmapRegionDecoder to decode into a recycled
bitmap.

Since the specification does not guarantee that the recycled
bitmap will be larger than the decoded region, we must be careful
to only to copy min(recycledHeight, decodeHeight) rows.

This should fix flakiness in the BitmapRegionDecoderTest on cts.

BUG:26978886
Change-Id: I318468b0eaa67bd9a7860824f75d45df9bf5fbce
2016-02-05 15:08:56 +00:00
Leon Scroggins III
66ce1c3b1a Lock SkBitmap before accessing color table
This only affects kIndex_8 Bitmaps, which can only be created by
decoding particular images (e.g. GIF). Without locking the SkBitmap,
colorTable() always returns NULL. Lock it so we can write the color
table to the Parcel.

BUG:26527976
Change-Id: Ifc54b06ca08db26ba6455a3830b7e671b64f37c4
2016-02-02 19:05:02 +00:00
Craig Donner
4bbb8504a7 Setting consumer protected mode on from SurfaceTexture when in a protected context.
Bug: 22775237
Bug: 22855417

Change-Id: I9608ba08b28b02f3df1cc334fdc22d645831f1f6
2016-01-22 18:00:00 -08:00
Keisuke Kuroyanagi
a3024bd702 Use light weight method for text measurement.
Bug: 24505153

Change-Id: I94823e8d546fbe0a29bc05e8841672c4cf9b5ecd
2016-01-21 18:23:57 +09:00
Richard Uhler
56178b8fcb Merge "Use NativeAllocationRegistry for Paint, Canvas, and Bitmap" 2016-01-15 18:23:29 +00:00
Leon Scroggins III
c95d2d1bd6 Restore old behavior of setLocalMatrix
We updated the API of SkShader (changed in
https://codereview.chromium.org/1553743002) but the function still does
the same thing. As such, undo the changes in
f4eca05cdc19c095cdc0a9140d512737533a87c5 which call the method
differently.

BUG:26549769

This partially reverts commit f4eca05cdc19c095cdc0a9140d512737533a87c5.

Change-Id: I52f2fab7da748cfe351e2fa27ade24aa572176a7
2016-01-15 11:07:23 -05:00
Richard Uhler
775873a66a Use NativeAllocationRegistry for Paint, Canvas, and Bitmap
Bug: 23130675
Change-Id: I3fbd84ba417ac63df75f87ee2c56e3e7f3c9eb46
2016-01-13 16:14:33 -08:00
Mike Reed
8ee246b4c7 CreateLightingFilter is now on SkColorMatrixFilter
Change-Id: Ic53071aa5dc618ce1a72c531180d18304c7e522a
2016-01-13 14:35:45 +00:00
Derek Sollenberger
e1721099b5 Fix build breakage due to API update in SkShader.
bug: 25344771
Change-Id: I64198a77c75d6768091dafd5c045b02ef66dfdad
(cherry picked from commit f4eca05cdc19c095cdc0a9140d512737533a87c5)
2016-01-12 18:21:17 +00:00
Matt Sarett
3b1b68d6c7 Allow ninepatches to be encoded using non-RGBA modes
The original intention for forcing ninepatches to be encoded as
RGBA (with alpha) was to avoid the possibility of the decoder
producing 565 output.

565 output is bad for ninepatches because dithering tiny images
that we intend to scale later leads to bad results.  I would
argue that, since the new BitmapFactory does not dither, we might
now be ok to allow 565 decodes for ninepatches.  However, we
will maintain the old behavior by disabling 565 decodes for
ninepatch.

There are two changes to PNG encodings:
(1) Allows ninepatch images to be encoded in any mode.  Forcing
    them to RGBA makes things awkward for the decoder.  Currently,
    BitmapFactory's png decoder checks every pixel for alpha.
    That way, RGBA images that are actually opaque can be marked
    as opaque, in order to optimize drawing.  We want to remove
    this complexity from the decoder.
(2) Make sure ninepatch chunks are stored in the png header.  That
    way we know immediately that the png is a ninepatch, and can
    refuse to decode to 565 (if we feel this is best).

Change-Id: I724f5dbefb1be7b412f9b362dff83cbc0603f0bf
2016-01-07 18:17:33 +00:00
Seigo Nonaka
4ea7d1d2ab Move Language normalization code from Paint.cpp to Minikin.
This is 2nd attempt of I277a08b5a17d45c3edb8fb597fdf6786bbe9f83b

The language code to BCP47 conversion is done by Minikin.

Also this CL addresses the signature changes by
I8df992a6851021903478972601a9a5c9424b100c

Bug: 26168983
Change-Id: Id106e9bb5c3eaa6652b44a1735f427accaca1368
2016-01-05 12:32:26 +09:00
Matt Sarett
e3b8f255cf Merge "Make BitmapFactory.Options API Changes" 2016-01-04 22:55:38 +00:00
Matt Sarett
5e2496bcee Make BitmapFactory.Options API Changes
This changes the documentation for inPreferQualityOverSpeed,
inDither, and requestCancelDecode().

These changes are a result of modifying the backends of
BitmapFactory and BitmapRegionDecoder to be faster, higher quality,
and to use standard libraries.

BUG:26266063
BUG:25556965
Change-Id: I9008fd276a38c737e242bcc6930ffe4e36d9fd1d
2016-01-04 17:20:17 -05:00
Bart Sears
fb68de3fb1 Merge "Revert "Move Language normalization code from Paint.cpp to Minikin."" 2015-12-22 09:07:08 +00:00
Bart Sears
143f50789e Revert "Move Language normalization code from Paint.cpp to Minikin."
This reverts commit 5640ae00e76f71a35b10b805bbee55efac6b16f2.

Change-Id: If6dfcd74154c3fa49d1fb037ae78fd84f9844591
2015-12-22 09:03:19 +00:00
Seigo Nonaka
e824f8287b Merge "Move Language normalization code from Paint.cpp to Minikin." 2015-12-22 04:01:19 +00:00
Matt Sarett
d31512b9a6 Clean-ups for BitmapRegionDecoder
Check for OOM after calling encodedFormatToString().

Do not correct Alpha8 to Gray8.  This will be handled in Skia.

Change-Id: Id573548608fbd5fbeef2898844480d8f8f73e1d0
2015-12-16 18:40:44 -05:00
Seigo Nonaka
5640ae00e7 Move Language normalization code from Paint.cpp to Minikin.
The language code to BCP47 conversion is done by Minikin.

Also this CL addresses the signature changes by
I8df992a6851021903478972601a9a5c9424b100c

Bug: 26168983
Change-Id: I277a08b5a17d45c3edb8fb597fdf6786bbe9f83b
2015-12-15 10:03:36 -08:00
Matt Sarett
9e7cd6351b Allow SkAndroidCodec to compute the decode color type and alpha type
This CL will not cause a behavior change.  SkAndroidCodec implements
the same logic.

Change-Id: I81ef12748d165f4c7a6e86a6e2562a949378940a
2015-12-14 13:53:42 -05:00
Matt Sarett
b8adc9a37f Modify BitmapFactory to use SkAndroidCodec
Change-Id: Ifa7c1e2f2a22a0af5426dacdc50a82beecf0e2e3
2015-12-14 13:53:21 -05:00
Leon Scroggins III
6f634e54c8 Make NinePatchPeeker inherit from SkPngChunkReader
SkImageDecoder is being phased out. The SkImageDecoder::Peeker has been
repurposed as SkPngChunkReader, which is shared by SkImageDecoder and
SkCodec (SkImageDecoder's replacement). Make NinePatchPeeker inherit
from the new class, and make its SkImageDecoder mHost optional, so we
can easily switch to SkCodec.

Change-Id: I74eeb909d1a4f4fe928d079857f92c142351b496
2015-12-14 13:53:00 -05:00
Seigo Nonaka
3fa667e224 Introduce ttcIndex attribute into system font configuration.
ttcIndex is used for specifying index of the TrueType Collection.
No user visible change is expected with this CL.

BUG: 10861108
Change-Id: I76a1c890164bb55a7ece7b9c7db2ce2bac3f8b89
2015-12-10 16:50:44 -08:00
Seigo Nonaka
cfc607cf57 Introduce cache mechanism for LocaleList.
Setting the LocaleList to the native Paint object is not a lightweight
operation since it needs to propagate a string object to the native code
which then needs to parse it for making minikin language list.

To avoid performance regressions, cache the minikin language ID in
android.graphics.Paint and send the LocaleList with cached ID
instead of a string the next time native code is called.

BUG: 25122318
Change-Id: Ib5ce8bcff8a1c0a2b1a1c3d1868ea8be5a0e642f
2015-12-07 16:50:20 -08:00
Matt Sarett
00d70d36f9 Merge "Merge new implementation of BitmapRegionDecoder." 2015-12-03 13:38:03 +00:00
Matt Sarett
1f979639c1 Merge new implementation of BitmapRegionDecoder.
This is a combination of the following 4 commits.

=====================================================================

Make SkBitmapRegionDecoder use SkAndroidCodec

The current implementation of SkBitmapRegionDecoder relies
on SkImageDecoder::decodeSubset() which itself relies on
forked copies of libjpeg and libpng.

This implementation has caused numerous correctness and memory
bugs, and also prevented us from updating to the latest
optimized versions of libjpeg-turbo and libpng.
https://docs.google.com/a/google.com/document/d/1w0vdC9sPPquwgJLY4wjBvzwm8QZIqIgg1q3tDEvOoUU/edit?usp=sharing

The SkAndroidCodec implementation fixes known correctness and
memory bugs, at least matches the performance of the
the old implementation (and in many cases improves upon it),
and uses standard copies of libjpeg-turbo and libpng.

In addition to improving region decodes, switching to new
copies of libjpeg-turbo and libpng will improve performance
of full image decodes significantly.  Jpeg, in particular,
will be about 2x faster.

Change-Id: Ia51645009b243607d3022d49e8e0c82ec4e959bc

=====================================================================

Make JavaPixelAllocator and RCPAllocator implement SkBRDAllocator

This will allow us to optimize decodes when destination memory
is zero initialized.

Change-Id: I1e56cd5410d1e9b6544b0e47aac8da740bca5252

=====================================================================

Fix build by using SkBRDAllocator

Change-Id: Icf031409f0e58496d80b9bdc91def8ff97f7d0d2

=====================================================================

Fix bug in RecyclingPixelAllocator::copyIfNecessary()

This was exposed by a new test that I hope to add to
the BitmapRegionDecoderTests.

Change-Id: Ic5a32e095ff3ce457abab7216a8da1acf17db27b

=====================================================================

Depends on adding libjpeg-turbo to the manifest.
Change-Id: Ic8ffa339722bfa9f40f44f68d03ce9a3faef1ee2

Depends on update to Skia.
Change-Id: I4bdaacb8a04e2dee5e3eccc58033601384c77b7d

BUG:25424175
BUG:25344771
http://skbug.com/1243
http://skbug.com/4475
https://code.google.com/p/android/issues/detail?id=77195
http://skbug.com/4417
https://code.google.com/p/android/issues/detail?id=162760
http://skbug.com/4264
https://code.google.com/p/android/issues/detail?id=76976
http://skbug.com/4418
http://skbug.com/1282
https://code.google.com/p/android/issues/detail?id=189248
https://code.google.com/p/android/issues/detail?id=80316
https://buganizer.corp.google.com/u/0/issues/20224409
http://skbug.com/4319
http://skbug.com/4361
https://code.google.com/p/android/issues/detail?id=165546
https://code.google.com/p/android/issues/detail?id=81068
https://buganizer.corp.google.com/u/0/issues/22527238
https://buganizer.corp.google.com/u/0/issues/23731509
https://code.google.com/p/skia/issues/detail?id=4469
http://skbug.com/4360
http://skbug.com/4489
http://skbug.com/4490
2015-11-19 15:39:34 +00:00
Seigo Nonaka
bb1a96647a Make Paint.hasGlyph variation selector aware.
With this CL, Paint.hasGlyph returns true if the typeface supports
the passed code point and variation selector pair.

Bug: 11256006

Change-Id: If29cd0c5942dc78bd862804106e29539bdeee569
2015-11-18 21:17:58 +09:00
Erik Wolsheimer
fa17e61291 Log errno when dup fd cannot be allocated BUG: 25165471 am: 211abad3b9 am: b45defae8e am: 529893f84c am: 7698dd970f
am: ae4ab3501a

* commit 'ae4ab3501a0400940ace2d0bfdf0d7021c740603':
  Log errno when dup fd cannot be allocated BUG: 25165471
2015-11-16 19:26:12 +00:00
Erik Wolsheimer
211abad3b9 Log errno when dup fd cannot be allocated
BUG: 25165471

Change-Id: I7342e2b4c566325fc2e15643a7c7b6ba989ee8c7
2015-11-16 10:29:20 -08:00
Matt Sarett
746f86815b Rename SkBitmapRegionDecoder to BitmapRegionDecoder
This is temporary, we are planning to delete this class.
Renaming will allow us to have an SkBitmapRegionDecoder class
in Skia.

Change-Id: I8d24d481d4e8cf782f578fa6deb6e3245c998a37
2015-11-06 16:30:34 +00:00
Ian Pedowitz
18896e0893 Merge "Limit persistent ashmem backed fds to a minimum of 128kB." into mnc-dr-dev am: 966d6040c6 am: 95fc53b029 am: d6f3e38738
am: 87455c7397

* commit '87455c7397605fba4bf3ad04af8df3c599a7a6ba':
  Limit persistent ashmem backed fds to a minimum of 128kB.
2015-11-03 23:34:54 +00:00
Ian Pedowitz
87455c7397 Merge "Limit persistent ashmem backed fds to a minimum of 128kB." into mnc-dr-dev am: 966d6040c6 am: 95fc53b029
am: d6f3e38738

* commit 'd6f3e38738c88821b28b2571d034fc1b189a35de':
  Limit persistent ashmem backed fds to a minimum of 128kB.
2015-11-03 22:21:48 +00:00
Riley Andrews
8cee7c1711 Limit persistent ashmem backed fds to a minimum of 128kB.
Bug 25256717

Change-Id: Ieb356006df0a6545b89de44d3d8fd4b46312b3b8
Signed-off-by: Riley Andrews <riandrews@google.com>
2015-11-03 17:46:15 +00:00
Leon Scroggins III
f35b989d26 Merge six commits from master-skia to master
Also corrects some code under development behind the HWUI_NEW_OPS flags
to match the updated Skia API.

Include external/skia/include/private
use SrcConstraint for drawBitmapRect
clean up to allow removal of flags for SCALAR_DIV and IMAGEINFO_FIELDS
don't call DEPRECATED getDevice()
update to newer API for drawBitmapRect
asABitmap is deprecated, used isABitmap

previous-Change-Id: I12208855a95948897077b1c1549eb35416cc801e
previous-Change-Id: I5044f0f61315fe48c60d7af5e261a7d0ed574f56
previous-Change-Id: Ic34a3ba77b3f9e091fa7aaba75018a307abacdab
previous-Change-Id: I79f8dd779920565d1204f7fe67b3286b1bbf4e9b
previous-Change-Id: Ic04d1f8274f6a862ea00f8d241363cf31f5ec1ec
previous-Change-Id: I9e4ae257a1976c74302b6a73f17405174ae58cec
previous-Change-Id: I85de3462ad1e4877784df38edc4bcd0acbd24e5e
Change-Id: Ide8e2f669e91a13c32521af3a16efdaa085c81d0
2015-10-29 12:29:03 -04:00
Tom Hudson
d8f904f256 Revert "Merge six commits from master-skia to master"
This reverts commit 550780745fa28ae9a87d02331841ca5ce4f9c763.

Change-Id: Ic71eccea454b26261fe6e9a9a7a24eff56396989
2015-10-28 20:35:36 +00:00
Leon Scroggins III
550780745f Merge six commits from master-skia to master
Include external/skia/include/private
use SrcConstraint for drawBitmapRect
clean up to allow removal of flags for SCALAR_DIV and IMAGEINFO_FIELDS
don't call DEPRECATED getDevice()
update to newer API for drawBitmapRect
asABitmap is deprecated, used isABitmap

Change-Id: I519f54f97321a7a365ea81a3b78cb03b9bdca021
previous-Change-Id: I12208855a95948897077b1c1549eb35416cc801e
previous-Change-Id: I5044f0f61315fe48c60d7af5e261a7d0ed574f56
previous-Change-Id: Ic34a3ba77b3f9e091fa7aaba75018a307abacdab
previous-Change-Id: I79f8dd779920565d1204f7fe67b3286b1bbf4e9b
previous-Change-Id: Ic04d1f8274f6a862ea00f8d241363cf31f5ec1ec
previous-Change-Id: I9e4ae257a1976c74302b6a73f17405174ae58cec
2015-10-28 13:41:38 -04:00
Derek Sollenberger
eba81d0f88 Add missing include for SkPath
Change-Id: Ib1577714d0e5c7e7c7d0e6593debe30e78f0df59
2015-10-26 14:23:58 +00:00
Roozbeh Pournader
f036ead2a2 Pass the whole locale list down to Minikin.
Also, compute LocaleList's string representation at construction.
This is to further push the cost of doing costly operations related
to LocaleLists to construction time.

Change-Id: Ia55b8ce66b1088ff54cb42eb1e11149b5bd10f17
2015-10-22 13:14:13 -07:00