3791 Commits

Author SHA1 Message Date
Derek Sollenberger
eb69cbbe22 Change behavior of setBitmap to cleanly reset the canvas
- identity matrix
 - no save stack
 - wide-open clip

This reverts commit 4f641d1e4586b027969052cc0ad6b65c1158e72e

Test: bit CtsGraphicsTestCases:.CanvasTest
Bug: 36218535
Change-Id: Id11deb06e37d6df61f1f171d424ab150d812a7a8
2017-04-11 14:00:25 -04:00
Romain Guy
8242656f49 Color management, the missing pieces
Implement missing color management pieces for bitmaps:

- Bitmap.createBitmap(Bitmap src, ...) now creates a bitmap
  in the same color space as the source bitmap
- Bitmap.createScaledBitmap() now creates a bitmap in the
  same color space as the source bitmap
- Bitmap.createBitmap(..., ColorSpace colorSpace) to create
  bitmaps in a specific color space
- Fix copy from A8 to F16
- Copying bitmaps in F16 or with a color space does not work,
  it's currently a limitation in Skia

Bug: 36905374
Test: BitmapColorSpaceTest
Change-Id: I0092fe4432511db50daa3a9393389a9db05e0c2a
2017-04-07 07:56:14 -07:00
TreeHugger Robot
c273784c91 Merge changes I6f00614d,I987eeab2 into oc-dev
* changes:
  Convert 16 bit bitmaps to 8 bit on devices that do not have GLES3.0
  Fix HardwareBitmapTests.testBitmapConfigFromRGB565
2017-04-06 21:21:59 +00:00
Romain Guy
89de234c72 Convert 16 bit bitmaps to 8 bit on devices that do not have GLES3.0
Bug: 37077308
Test: CtsUiRenderingTests (ran to manually emulate 2.0 devices)
Change-Id: I6f00614d79797835adcfe4716bd331573e1463e3
2017-04-06 12:24:29 -07:00
Romain Guy
7c98f5da3d Fix HardwareBitmapTests.testBitmapConfigFromRGB565
Bug: 37077304
Test: HardwareBitmapTests.testBitmapConfigFromRGB565
Change-Id: I987eeab243f93f9ee8fe8d1b6a12ddbd23225651
2017-04-06 11:00:21 -07:00
Matt Sarett
ea70d22dc8 Xform bitmaps to sRGB on SW and PDF canvases
For picture-backed canvases, we will defer the xform
until playback.

Test: Unit tests and cts test.
Bug: 32984164
Change-Id: Ib74663bcb688b74b6ba8792b403b0475126732af
2017-04-06 15:14:00 +00:00
Stan Iliev
d7410f7829 Fix pop-up shadow drawn in the wrong place with Skia pipeline
Fix a bug in DrawShadow matrix calculation. Recorded matrix does
not need to be applied, because parent display lists have already
replayed matrix transformations.

Test: added a new HWUI unit test that is passing only after this fix
Bug: 33103723
Change-Id: I7a47dbe879df6b9e5920a47c0e1168d9902a3e70
2017-04-04 16:24:55 -04:00
TreeHugger Robot
f9340ca491 Merge "Fix HWUI/Skia Gradients to premultiply the colors prior to interpolation" into oc-dev 2017-04-04 19:06:32 +00:00
Chris Craik
eabb5621dd Merge "Revert "Switch libplatformproto to sharedlib"" into oc-dev 2017-04-04 17:16:43 +00:00
Derek Sollenberger
669b15a935 Fix HWUI/Skia Gradients to premultiply the colors prior to interpolation
This is fixed in Skia by passing the appropriate flag when the shader is
generated.  The fix in HWUI is to reverse the premultiplication and
interpolation steps.

Test: bit CtsUiRenderingTestCases:.testclasses.ShaderTests
Bug: 34323783
Change-Id: I3417141949f62fcc696b6d8213a4b446d7d0cbf8
2017-04-04 12:07:28 -04:00
Chris Craik
817b494739 Revert "Switch libplatformproto to sharedlib"
Bug:36847782

This reverts commit e5549d414c7231ee0037cf413dad17e28b8905ba.

Change-Id: I38f1c501b7e40be11ba5f0a7a50651e0c3e41fc5
2017-04-03 21:46:44 +00:00
TreeHugger Robot
72c2760943 Merge "Switch libplatformproto to sharedlib" into oc-dev 2017-03-30 16:42:36 +00:00
John Reck
e5549d414c Switch libplatformproto to sharedlib
libplatformprotos is really really unhappy if it gets
loaded twice into the same process which trivially happens
if it's a static library. Switch it to a shared library
instead to fix this.

Change-Id: I90297d076d0739bab683fbd9607d7fc0884a002d
Fixes: 36272398
Test: Ran hwui_unit_test, didn't crash
2017-03-29 18:41:27 -07:00
Romain Guy
caaaa66e57 Convert bitmaps to sRGB/scRGB when they have a color profile
This change also fixes an issue with RGBA16F bitmaps when modulated
with a color (for instance by setting an alpha on the Paint object).

The color space conversion is currently done entirely in the shader,
by doing these operations in order:

1. Sample the texture
2. Un-premultiply alpha
3. Apply the EOTF
4. Multiply by the 3x3 color space matrix
5. Apply the OETF
6. Premultiply alpha

Optimizations:
- Steps 2 & 6 are skipped for opaque (common) bitmaps
- Step 3 is skipped when the color space's EOTF is close
  to sRGB (Display P3 for instance). Instead, we use
  a hardware sRGB fetch (when the GPU supports it)
- When step 3 is necessary, we use one of four standard
  EOTF implementations, to save cycles when possible:
  + Linear (doesn't do anything)
  + Full parametric (ICC parametric curve type 4 as defined
    in ICC.1:2004-10, section 10.15)
  + Limited parametric (ICC parametric curve type 3)
  + Gamma (ICC parametric curve type 0)

Color space conversion could be done using texture samplers
instead, for instance 3D LUTs, with or without transfer
functions baked in, or 1D LUTs for transfer functions. This
would result in dependent texture fetches which may or may
not be an advantage over an ALU based implementation. The
current solution favor the use of ALUs to save precious
bandwidth.

Test: CtsUiRenderingTests, CtsGraphicsTests
Bug: 32984164
Change-Id: I10bc3db515e13973b45220f129c66b23f0f7f8fe
2017-03-28 18:35:49 -07:00
TreeHugger Robot
2c6ac0ead0 Merge "Add missing assert that task isn't queued" 2017-03-28 00:41:11 +00:00
TreeHugger Robot
55bea5e308 Merge "Add a few asserts for possible corruption cases" 2017-03-27 23:30:22 +00:00
John Reck
1b7184f8d2 Add a few asserts for possible corruption cases
Bug: 36502346
Test: builds & boots
Change-Id: Id96a26a30e4a8c6f51a68bf07cfe6bd6d07c244e
2017-03-27 14:47:46 -07:00
John Reck
2f944482ec Add missing assert that task isn't queued
Probably won't fix anything but this assert is in queue()
but not queueAtFront() and inserting a task twice is Really Bad.

Bug: 36139852
Test:  ¯\_(ツ)_/¯
Change-Id: Ida0f829eecfdd46c17c36b816528c49d12b7cf29
2017-03-27 21:38:09 +00:00
Chris Craik
48f9bb6254 Register functor draw correctly
Bug: 36602041
Test: existing tests still pass

Change-Id: I9f385da89e9e49e562031578a02f13a68697e0df
2017-03-24 17:12:19 -07:00
Robert Phillips
3c01a07fff Update RenderNodeDrawableTests to new onNewImageSnapshot API
Test: does it compiles

Change-Id: I55e3d7e2e59bfde88357fd455fe567d07c8a26b7
2017-03-23 12:29:39 -04:00
Robert Phillips
d9770c3c6c Update SkiaPipelineTests.cpp to use new onNewImageSnapshot signature
Test: code compiles & test continues to succeed

https://skia-review.googlesource.com/c/9882/ (Remove budgeted parameter 
from SkSurface::makeImageSnapshot (take 2)) seems to have stuck so this 
should be safe to land.

Change-Id: I9e6fdcc8debe7964e9522f7acd8829b54bc90986
2017-03-21 15:33:33 +00:00
TreeHugger Robot
2c64d5739b Merge "Modify VectorDrawable to scale path through canvas matrix" 2017-03-21 13:29:24 +00:00
TreeHugger Robot
da3ab1a2dd Merge "use SkVertices::Builder in drawBitmapLattice override new virtual onDrawVerticesObject" 2017-03-20 19:23:08 +00:00
Stan Iliev
cc29a5dde1 Modify VectorDrawable to scale path through canvas matrix
Apply the path matrix to the canvas instead of creating a new path.
Delete logic that scales the stroke, because this is done through
the matrix as well. Merge/delete some functions.

Bug: 36392701
Test: CTS graphics tests pass with minor changes in 6 golden images.
Quick settings and settings app drawables are OK. Vector icon app
draws identical paths.
Change-Id: If623bc0a535fad95a2839f79bd997c016bcd9d4d
2017-03-20 11:49:51 -04:00
Mike Reed
871cd2dd60 use SkVertices::Builder in drawBitmapLattice
override new virtual onDrawVerticesObject

Test:  CtsGraphicsTestCases

Change-Id: I38e3ee0aa2a1ee9c11474c2c5d648ee5fca20d78
2017-03-20 08:40:12 -04:00
Ben Wagner
3aeda5c5c4 Use access directly instead of sk_exists.
Skia would like to move SkOSFile and make it private spi. This appears
to be the only place SkOSFile is used outside Skia, and using access
here directly is more apropriate.

Test: Simple inline refactor, built and ran. Changes test code only.
Change-Id: Ib76c180bb3bccc54c20dcadc842837e3e8270929
2017-03-17 17:22:01 -04:00
Derek Sollenberger
08153e655a Merge "Remove usage of deprecated makeImageSnapshot parameter Test: Does it compile?" 2017-03-17 00:41:16 +00:00
Romain Guy
6183c97e5f Bowing my head in shame, going back to gamma interpolated gradients
Frankengradients (linearly interpolated RGB, gamma interpolated alpha) look
fantastic but unfortunately create sligh compatibility issues. For instance,
a gradient from 0xffea1030 to 0x00ea1030 (opaque to alpha, with a single
color) blended on top of 0xff101010 would not look the same as a single
opaque gradient from 0xffea1030 to 0xff101010. The difference is hardly
noticeable on simple gradients but it could cause confusion amongst app
developers. Their life is hard enough as it is, let's be good to them.

My crusade against the gamma world is not over and one day I shall
be the victor. I am patience.

Bug: 35485208
Test: UiRendering.ShaderTests, UiRendering.GradientTests, manual testing
Change-Id: I8204e60cdf0a6b12dfe22638d30ca9622687000e
2017-03-16 12:29:03 -07:00
Robert Phillips
cd2eb91c40 Remove usage of deprecated makeImageSnapshot parameter
Test: Does it compile?

Change-Id: Ia51ad621daa3409f65b2f3e4d5691891271918a2
2017-03-16 19:13:39 +00:00
Romain Guy
0d86d7ebc2 Improve dithering of alpha gradients
Bug: 32984164
Test: CtsUiRenderingTestCases
Change-Id: Ic728725845befd3c52cc7b043d5c6f8e33fcfcd2
2017-03-15 20:38:11 -07:00
TreeHugger Robot
402a384ac8 Merge "Pass FontCollection to doLayout's argument instead of ctor" 2017-03-15 17:34:21 +00:00
Seigo Nonaka
51218e80f7 Pass FontCollection to doLayout's argument instead of ctor
Test: minikin_unit_tests
Test: minikin_stress_tests
Bug: 36223724
Change-Id: I55aca62eab4df0c138fec764d616984b50bd73f1
2017-03-14 16:56:10 -07:00
Chris Craik
95e8afbb5e Merge "Revert "Change behavior of setBitmap to cleanly reset the canvas - identity matrix - no save stack - wide-open clip"" 2017-03-14 23:35:29 +00:00
Tony Mantler
4f641d1e45 Revert "Change behavior of setBitmap to cleanly reset the canvas - identity matrix - no save stack - wide-open clip"
https://buganizer.corp.google.com/issues/36218535

This reverts commit 269f989fbf198b17994baf9141c4640aeaf34b4e.

Change-Id: Ib2473e4fce90c9abaa39eea2b77082ae26197b80
2017-03-14 22:40:31 +00:00
TreeHugger Robot
9b0a5d1919 Merge "use _deprecated suffix for deprecated clipops" 2017-03-13 19:19:34 +00:00
Mike Reed
a0a74d5f8e use _deprecated suffix for deprecated clipops
Allows skia to remove legacy flag for older names
- SK_SUPPORT_EXOTIC_CLIPOPS
- SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES

Test: CtsGraphicsTestCases

Change-Id: I78478d94d059641a9381579cae6d28f9f0685ad1
2017-03-13 17:38:16 +00:00
TreeHugger Robot
1965d2898c Merge "Change behavior of setBitmap to cleanly reset the canvas - identity matrix - no save stack - wide-open clip" 2017-03-13 17:33:05 +00:00
Mike Reed
269f989fbf Change behavior of setBitmap to cleanly reset the canvas
- identity matrix
- no save stack
- wide-open clip

Behavior around the new bitmap is the same.

Tests : CtsGraphicsTestCases

Change-Id: Ieaf8c2a1b96262ed33940dd852a86089eb93efdb
2017-03-13 15:39:57 +00:00
Stan Iliev
7d73fc2303 Add a new macrobench to test layer resize
Create a new HWUI macrobench to test hardware layer resize code path.

Test: Executed the new test on bullhead device with "adb shell
/data/benchmarktest64/hwuimacro hwlayersize --onscreen --wait-for-gpu -c
1000".

Change-Id: I9ed411d76ac3d51339a69add8ab1843c3256994a
2017-03-13 10:16:08 -04:00
TreeHugger Robot
cfdfd997bd Merge "Modify SurfaceView to use SurfaceFlinger child surfaces." 2017-03-10 05:15:21 +00:00
TreeHugger Robot
0c1563d3dd Merge "Prematurely optimizing a Path." 2017-03-09 21:43:01 +00:00
Derek Sollenberger
d7f13f84f8 Prematurely optimizing a Path.
If the path had an inverse fill type we were incorrectly
converting ovals and roundRects to their primitive form
without checking to ensure the path was not inverse fill.

This CL removes these optimizations as they happen internally
within Skia.

Bug: 34245907
Test: verified broken app is fixed and that skia has existing tests
Change-Id: I8c1ff6522ae19fc6c21520adc7e9bc2473a8a4ad
2017-03-09 13:59:23 -05:00
Robert Carr
d5c7dd6da8 Modify SurfaceView to use SurfaceFlinger child surfaces.
Here we have SurfaceView bypass the WindowManager and speak
directly to SurfaceFlinger using child surfaces. We also
implement some logic in the WM to handle child surfaces
in various Surface replacement scenarios.

For those following along in the revert Saga, this
also includes the follow up CLs to the original CL.
- Surface inset calculation
- Animation fixes.

The error causing the revert was an incorrect JNI signature
around deferTransactionUntilSurface. I've noted it inline.

Bug: 28858420
Bug: 31518219
Bug: 34888808
Bug: 35588318
Bug: 35396882
Test: Existing tests still pass (except for the ones that don't and will be deleted).
Change-Id: Ie56b6f7ab16f32d7fc459b8eba26594337ad55de
2017-03-08 17:36:10 -08:00
Mathias Agopian
2bd7d98fe8 fallout from getting rid of IGraphicBufferAlloc
Test: compiled & run
Bug: cleanup
Change-Id: I1590105d3abef985c2ae7c1a03cdf5fd2ec4bef9
2017-03-08 23:12:06 +00:00
Wonsik Kim
5aec7b9031 Revert "Modify SurfaceView to use SurfaceFlinger child surfaces."
This reverts commit cd4aeef88052571365d4e193a2c41e2e6d145491.

Bug: 36027342
Bug: 36015884
Change-Id: Ifd5b69caf64d65a8cd6570b7fe1fb6abe90e30b8
2017-03-08 01:52:19 +00:00
TreeHugger Robot
7ef25b7894 Merge "Add ColorSpace information on Bitmap" 2017-03-07 18:37:13 +00:00
Chris Craik
3cad2c33ee Merge "Workaround arc textures drawing outside of bounds" 2017-03-07 17:53:22 +00:00
Romain Guy
efb4b06493 Add ColorSpace information on Bitmap
This is the first step toward interpreting color spaces at render time.

Bug: 32984164
Test: BitmapColorSpaceTest in CtsGraphicsTestCases

Change-Id: I0164a18f1ed74a745874fe5229168042afe27a04
2017-03-06 19:33:25 -08:00
Chris Craik
49b403dc9c Workaround arc textures drawing outside of bounds
Fixes: 34077513
Test: hwui unit tests passing

This fixes an issue where drawArc operations would cause artifacts by
drawing outside of the clip / screen damage area. We now more
conservatively clip drawArc operations specifically, as they tend to
draw into the outer parts of their path textures more than other
operations.

A more long term fix would involve alignment between draw operation
sizing (in terms of what's resolved in a BakedOpState), and
PathTexture sizing (which currently conservatively expands beyond
stroked op bounds).

Change-Id: I5aff39cc04382323b457b159974032f5f371251a
2017-03-06 13:51:44 -08:00
Tom Cherry
4d7094dc99 Merge "Check for spurious wake ups" am: 3a3cd0a27f am: c2dcebe6e6
am: 1344c034c5

Change-Id: I8ffc749ab6fbd825ce238fff4ba1d12609585c04
2017-03-06 20:14:37 +00:00