1049 Commits

Author SHA1 Message Date
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
Pablo Ceballos
63afb86381 Merge "Remove GLTrace support" 2015-10-19 17:55:59 +00:00
Seigo Nonaka
2d04780803 Remove MinikinSkiaFont::GetGlyph.
MinikinSkiaFont::GetGlyph is no longer used and MinikinFont:GetGlyph
interface is removed by I13398503841ac06f930b04815017d4b33338efa1.
No behavior chnages are expected with this CL.

Change-Id: I8496aad446c6809f74a5effc7ef1baa25c4381b8
2015-10-15 02:52:38 +00:00
Pablo Ceballos
a4d4e82927 Remove GLTrace support
GLTrace is defunct, it does not support newer GL features, breaks
security requirements, and has no supported tooling now that Eclipse
is at end of life.

Bug 22329852

Change-Id: I64c58464f8c2c7ae6125f5d5c7884e3fd34d68ea
2015-10-06 15:18:40 -07:00
John Reck
dbffd25000 Fix Paint's JNI
Bug: 22409077
Change-Id: I99e1a11bf14f5b62c41107528f573eaf9f2d4b2f
2015-10-02 09:27:10 -07:00
Keisuke Kuroyanagi
2c53a07597 Merge "Consolidate native methods for text measurement." 2015-09-29 21:31:56 +00:00
Keisuke Kuroyanagi
536afe6ef7 Consolidate native methods for text measurement.
Bug: 24505153

Change-Id: I6a00b0516442f7d6108ed0598516365310bd85e8
2015-09-29 13:52:45 -07:00
Elliott Hughes
434a481b21 am ea1831d2: am b57dd722: resolved conflicts for a884d81e to stage-aosp-master
* commit 'ea1831d211ea0e6b2d161c714bb0786369ef2df5':
  constify JNINativeMethod function pointer tables
2015-09-24 17:23:00 +00:00
Elliott Hughes
b57dd722f1 resolved conflicts for a884d81e to stage-aosp-master
Change-Id: Ice485967fa96f13786024b6939b826638e906ff0
2015-09-24 10:01:32 -07:00
Daniel Micay
76f6a86de2 constify JNINativeMethod function pointer tables
Change-Id: I4036c924958221cbc644724f8eb01c5de3cd7954
2015-09-22 17:10:35 -04:00
Matthew Dempsky
1fa606b867 Eliminate uses of Skia's SkDELETE macro
Skia no longer uses these macros internally.  They're now only
provided for backwards compatibility, so remove their uses within
Android.

See thread on skia-discuss:
https://groups.google.com/d/msg/skia-discuss/l9TSgpYCHpU/sNpA1y8YCQAJ

Change-Id: Ia7313f5bbdf4d2d9fb4a10fc5bdc1572e6b84f6c
2015-09-18 19:17:57 -07:00
Pablo Ceballos
e442b63c83 Implement single buffer mode using setMaxBufferCount
Bug 13174928

Change-Id: I5319c3d7d07b8ddeaf8fd8e8efe0dbfb58d5c1ac
2015-09-02 16:49:20 -07:00
Matt Sarett
2a4db1327e Build fix for change in skia headers
Change-Id: I3cfb15cd31186a90ee60f89035efa6b237c1d3ec
2015-08-26 14:39:21 +00:00
Derek Sollenberger
1ad545d207 Fix path direction enum to match native SkPath values
Change-Id: I4010e400cef0baf6dd23d7f7e837a2bfb7154059
2015-08-20 14:27:10 -04:00
Ben Wagner
e3a40ea488 Use static_assert instead of SK_COMPILE_ASSERT.
Now that static_assert is allowed, there is no need to use a non-
standard compile time assertion.

Change-Id: I0b294efcf494983f8241e9d5a2c476e2f2a9fff0
2015-08-19 17:21:17 -04:00