3072 Commits

Author SHA1 Message Date
Seigo Nonaka
1a625911a2 Merge "Add wordSpacing parameter to Paint" 2016-11-17 08:00:01 +00:00
Teng-Hui Zhu
18ad5f4368 Update the documentation related to VD / AVD
fix:32705240
fix:32683765
fix:32831830
fix:32705244

Test: make offline-sdk-docs and view the HTML file.

Change-Id: I6ae3e5850494f13a241b2e9e4d2c5b95d5199aae
2016-11-16 15:14:10 -08:00
Seigo Nonaka
219e2c7949 Add wordSpacing parameter to Paint
Adds the ability to control word spacing from Java, wiring up the
plumbing to the corresponding change that adds it at the Minikin
level.

Bug: 31707212
Test: ran graphicstests
Change-Id: I568186aca961d51ee5231cb0331f882b7b005e90
2016-11-16 16:24:07 +09:00
John Reck
3bdecbf0fd return 0 for allocation size if recycled
Change-Id: Ic471701faf026411938ebe87131533a8ef09bbd7
Fixes: 19804653
Test: none
2016-11-14 11:28:17 -08:00
John Reck
9192d5e8d7 Remove unused method
Test: builds

Change-Id: I8ad660f083a57f30db5ed0e2fe777286720033ca
2016-10-31 10:44:12 -07:00
John Reck
1ece145e01 Re-order draw methods to make update-api happy
update-api orders methods alhabetically by name, but when
there's multiple methods with the same name it falls back to
the ordering within the file.

Re-order the methods in canvas.java to match what's already in
current.txt to avoid unnecessary changes.

Also auto-formatted the draw methods as some were mis-indented.

Test: No behavior change, just method re-ordering
Change-Id: I2a7d313c8e7a6bd9187c4ed7dbde944b88aa32bb
2016-10-20 17:05:10 +00:00
John Reck
caa08ff5e9 The bigger update to Canvas
All draw* calls in Canvas are regular JNI
All draw* calls in DisplayListCanvas are FastNative
Unifies Canvas JNI on nMethodName naming

CanvasPerf results before:
INSTRUMENTATION_STATUS: basicViewGroupDraw_min=12492
INSTRUMENTATION_STATUS: recordSimpleBitmapView_min=13912

and after:
INSTRUMENTATION_STATUS: basicViewGroupDraw_min=11945
INSTRUMENTATION_STATUS: recordSimpleBitmapView_min=13318

Test: refactor, makes & boots
Change-Id: I06000df1d125e17d60c6498865be7a7638a4a13e
2016-10-17 11:33:28 -07:00
Romain Guy
1158b6d4ee layoutlib relies on refSkPixelRef(), put it back
Test: Build aosp_arm64-eng successfully
Change-Id: Ic00cacac9aa1006ec16060a95bd1a22133e9a4bd
2016-10-12 10:55:50 -07:00
Romain Guy
253f2c213f Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
      feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
  or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
  colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
  to disable linear blending. This is only for GLES 2.0 GPUs
  with no hardware sRGB support. This flag is currently assumed
  to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
  This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
  why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
  of the source pixel. The asumption is that a bright pixel will be
  blended on a dark background and the other way around. The source
  alpha is gamma corrected to thicken dark on bright and thin
  bright on dark to match the intended design of fonts. This also
  matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
  could not be sampled in sRGB without a yet-to-be-defined GL
  extension
- The last column of color matrices is converted to linear space
  because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-10-11 17:47:58 -07:00
John Reck
5cb74bca88 Canvas fastjni -> @FastNative
Just the basic cleanup first, will follow-up with a more
comprehensive update later
Test: builds & boots, refactor no behavior change

Change-Id: Ie3a7144b5fefdfda085e2ab50da8b0e627a1ecb8
2016-10-10 08:19:15 -07:00
Alan Viverette
39a561f5bb Scale bitmap shaders for target density am: 0d2a46b733 am: 444f2043d1
am: 36d83ffc5b

Change-Id: I97a23b431247f4541f5517787a486aca7d95a618
2016-10-10 14:30:50 +00:00
Alan Viverette
444f2043d1 Scale bitmap shaders for target density
am: 0d2a46b733

Change-Id: I8e3274a9c6047d943336827e7e0c8563e40c2ca5
2016-10-07 20:39:48 +00:00
TreeHugger Robot
0f6cec369f Merge "Scale bitmap shaders for target density" into nyc-mr1-dev 2016-10-07 20:31:01 +00:00
Alan Viverette
0d2a46b733 Scale bitmap shaders for target density
Also fixes progress bar sample tile to reflect density and ensures
that ProgressBar.tileify() clones inner drawables into the correct
density.

Bug: 31841123
Test: BitmapDrawableTest#testPreloadDensity()
Test: ThemeHostTest
Test: Visual inspection of ApiDemos
Change-Id: I9dcb9817d8d91d61ff0215987247e9e7fb089c46
2016-10-07 16:23:32 -04:00
John Reck
299659ddb7 Convert VD/AVD to FastNative
Test: build & boots
Change-Id: I6519ba245eca1a43fb00de36c91a05a9740c8c5f
2016-10-07 10:33:44 -07:00
Doris Liu
0b6849133a Restrict AVD and VD parsing to the current element instead of the whole document am: 1f859716a8 am: 897f5ca748
am: 43104389f9

Change-Id: I1730b80585c5d5064fda8ec4d598a95651d7c3eb
2016-10-07 01:02:09 +00:00
Teng-Hui Zhu
a08b1a37a5 Update JavaDoc about animatable on VectorDrawable am: bb12929470 am: 8bf7fd89e7
am: a504e12e25

Change-Id: I8b97f242a22e763e23169b9cb55d87afd2a6f471
2016-10-07 01:00:32 +00:00
Doris Liu
897f5ca748 Restrict AVD and VD parsing to the current element instead of the whole document
am: 1f859716a8

Change-Id: Ic2fe385089997f89675be8f8a1559db979387dbb
2016-10-06 20:15:40 +00:00
Teng-Hui Zhu
8bf7fd89e7 Update JavaDoc about animatable on VectorDrawable
am: bb12929470

Change-Id: I476d1416b0f734fbc87895c22de3e95efdbf25b9
2016-10-06 20:14:23 +00:00
Doris Liu
8d4c87b0bf Merge "Restrict AVD and VD parsing to the current element instead of the whole document" into nyc-mr1-dev 2016-10-03 23:28:54 +00:00
Tenghui Zhu
99224b311c Merge "Update JavaDoc about animatable on VectorDrawable" into nyc-mr1-dev 2016-10-03 22:53:45 +00:00
Doris Liu
1f859716a8 Restrict AVD and VD parsing to the current element instead of the whole document
This CL changes the AVD xml parsing to parsing only within the current
element, which prevents AVD parsing from always skipping to the end of
the doucment. So things that are defined after AVD in the same document
can be picked up by the xml parser.

The same fix has been applied to VD as well.

BUG: 31865175
Test: Manually following comment #1 in the bug above

Change-Id: I4ebdce1eb2e92d6f6e2c37caed9607253d24602f
2016-10-03 21:32:11 +00:00
TreeHugger Robot
f03f8e59b0 Merge "Paint conversion to @FastNative/@CriticalNative" 2016-10-03 18:34:56 +00:00
John Reck
170219c5d8 Merge "Matrix JNI update" 2016-10-03 18:06:51 +00:00
John Reck
f22859757b Paint conversion to @FastNative/@CriticalNative
Test: Refactor, device still boots

Change-Id: Ibf106607070860958c4317d6013d14ecf236f35a
2016-10-03 09:59:23 -07:00
Hemal Patel
c5d6e74dff Docs: Added info about vector drawable am: 47876e79de am: f1f89fa935
am: d0cff7a3af

Change-Id: If20b595f5b278c81afd0f3b263566ea11ad4a67f
2016-09-30 23:51:18 +00:00
TreeHugger Robot
7ef8dbed50 Merge "Make bitmap backed by native memory instead of java byte array Test: refactoring CL. Existing unit tests still pass. bug:27762775" 2016-09-30 20:57:40 +00:00
sergeyv
4508218850 Make bitmap backed by native memory instead of java byte array
Test: refactoring CL. Existing unit tests still pass.
bug:27762775

Change-Id: Ic4e914b3a941c3d545f8ce9e320e638973df0e91
2016-09-30 12:25:07 -07:00
Hemal Patel
d0cff7a3af Docs: Added info about vector drawable am: 47876e79de
am: f1f89fa935

Change-Id: Iadc8240aab4fce954fd0813f6817d6313ed094e7
2016-09-30 19:07:00 +00:00
Hemal Patel
da400e9dd4 Docs: Added info about vector drawable am: 47876e79de
am: bfa9663e97

Change-Id: I5649e6f9f0e6254d43e7229ef3e88b40351b14e5
2016-09-30 19:03:53 +00:00
Hemal Patel
f1f89fa935 Docs: Added info about vector drawable
am: 47876e79de

Change-Id: I9fcc130c50302885397e80411858ed2ca4994db5
2016-09-30 19:00:12 +00:00
Hemal Patel
bfa9663e97 Docs: Added info about vector drawable
am: 47876e79de

Change-Id: I73d39d61210064e9de4ec212fac51a43e7a791ae
2016-09-30 18:59:09 +00:00
Hemal Patel
47876e79de Docs: Added info about vector drawable
Added overview of vector drawable in the class overview section.

Bug: 25129687
Change-Id: I976177ddd3a8bddcbc6544cbc227b6b2099c7b0a
2016-09-29 13:31:27 -07:00
John Reck
94931bd87e Matrix JNI update
Switches to @FastNative & @CriticalNative
Switches to NativeAllocationRegistry
Updated formatting
Changes native_* to n* naming for native methods

Test: refactor CL, no behavior change; device still boots

Change-Id: Ic3b115b7aef26811bf8fef3777c131778608da30
2016-09-29 08:07:49 -07:00
Teng-Hui Zhu
bb12929470 Update JavaDoc about animatable on VectorDrawable
b/31782834

Change-Id: I64279fd14841302caaa71c817feaf01b855126ad
2016-09-27 16:56:35 -07:00
John Reck
6c12392f17 Expose SurfaceTexture(boolean) constructor
Fixes: 31709954
Test: 'cts-tradefed run singleCommand cts-dev --module CtsUiRenderingTestCases --test android.uirendering.cts.testclasses.TextureViewTests' passes

Change-Id: I358ae97aa90b27ee5757271d83c8a5b96a31a3f0
2016-09-23 13:27:55 -07:00
Doris Liu
edc684940d Improve Javadoc for AnimatedVectorDrawable am: 7d76fc4433 am: f6088e45e0
am: ab4f8f2f1d

Change-Id: I0b2eaa0f435f5bfe42be94d5ef796306fe3e0a1c
2016-09-21 19:05:43 +00:00
Doris Liu
7d76fc4433 Improve Javadoc for AnimatedVectorDrawable
This CL adds a summary of what developers can expect from running
AVD on RenderThread.

Also re-structure the class level Javadoc summary to better organize
the examples.

Test: make offline-sdk-docs

BUG: 30402908
Change-Id: I7111f67db5f2ec352730f633bb34f2e89e1c70e9
2016-09-21 00:36:16 +00:00
TreeHugger Robot
6d256ad021 Merge "Fast-path Drawable#setColorFilter" 2016-09-19 22:27:18 +00:00
John Reck
6d8eb89da0 Fast-path Drawable#setColorFilter
Some apps really like to call setColorFilter with the
same parameters, so check if there's anything to set
before creating a color filter

Change-Id: I20b8431123f9e6a333b69771b5f5f3eb7e566034
2016-09-19 13:41:29 -07:00
John Reck
5d31a293ad Cleanup Xfermode
We only support PorterDuff Xfermodes

Removes some unneeded JNI and finalizers()

Change-Id: I4988d6b05c6fd113a8ed8f7dcbf95abe0de95060
2016-09-19 12:52:50 -07:00
Dianne Hackborn
491bc2b8d6 Cherrypick so we can publish N version code description ASAP
Fix issue #30766518: Document what targeting N does

Also small documentation cleanup in a few other places.

(cherry picked from commit b34cbedb4e36f184232d7f40b093bdc9fd0cd752)

Change-Id: I9560b29faa4f2674277349272af8193122a1f95e
2016-09-19 19:31:19 +00:00
John Reck
b5c30800e5 Merge "Add API to copy a window" 2016-09-08 16:23:45 +00:00
John Reck
9580146f50 Add API to copy a window
Change-Id: I9bb5209010db6665be4b6f8db81a6fc1b7debc45
2016-09-07 11:41:15 -07:00
Keisuke Kuroyanagi
f5af4a344e Always redraw text that protrude from line bounds.
With I63af3a6ecbf92, we create RenderNode lazily, but
blocks containing contents that protrude from line top or
bottom cannot be simply lazily redrawn after edit or
scroll.
With this CL, we check if the contents protrude from line
top or bottom by comparing the text bounds with relevant
font metrics values and we always redrawn such blocks after
edit or scroll.

Bug: 27889485
Change-Id: I666da5eeb39f780c341597f347bfcba21eb34295
2016-09-05 17:45:37 +09:00
Pablo Ceballos
1209bc144b Fail createVirtualDisplay with single-buffered Surface am: aff2f94939 am: d387b20dcb
am: 658f26634f

Change-Id: I499988d911ffd5ccd4b5bc10c75f3e0ed9a897c8
2016-08-31 02:56:35 +00:00
Pablo Ceballos
d387b20dcb Fail createVirtualDisplay with single-buffered Surface
am: aff2f94939

Change-Id: I5cfcbd0352240d7ac2a9bb0804896cae5396450e
2016-08-29 17:59:07 +00:00
Pablo Ceballos
23784fd6d9 Merge "Fail createVirtualDisplay with single-buffered Surface" into nyc-mr1-dev 2016-08-29 17:42:00 +00:00
Kirill Grouchnikov
ce3338ea36 Merge "Fix typo in PathMeasure javadocs" 2016-08-29 17:08:22 +00:00
Kirill Grouchnikov
6a03c39e0a Fix typo in PathMeasure javadocs
Change-Id: I7c637d791c7ca9b4b1d982602a6cd108385ca905
2016-08-29 11:46:21 -04:00