8834 Commits

Author SHA1 Message Date
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
Romain Guy
ef6c9b1d8b Merge changes I6f00614d,I987eeab2 into oc-dev am: c273784c91
am: 3b447f6ed7

Change-Id: Ia6c35dd4a3fff3c300cb8c390d9628481605928a
2017-04-06 22:46:04 +00:00
Matt Sarett
7c9fb6076e Merge "Xform bitmaps to sRGB on SW and PDF canvases" into oc-dev am: c29dffed16
am: fd5d5425ee

Change-Id: If960ccd900ebc2b841c2f13ca4f25820a48a950f
2017-04-06 22:16:49 +00: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
Mike Reed
d20f2c2d02 use new api for passing colortable to allocPixels
Test: Bitmap:colorTableRefCounting still passes

Change-Id: I5f20a55a98f5766da7c4a490c9be56f9140024c3
2017-04-05 17:39:25 -04:00
Mike Reed
826deefda5 switch over to SkVertices object, and stop using deprecated methods.
This allows Skia to remove
  SK_SUPPORT_LEGACY_CANVAS_VERTICES
  SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF
  SK_SUPPORT_LEGACY_PIXELREFFACTORY

Test: Existing CTS cover these changes

Running CtsGraphicsTestCases, there were 6 failures w/ and w/o this CL.
None of the 6 seems related to this CL.

Change-Id: I724082357d9f6cb699770df3c0b9ef555b957697
2017-04-05 14:20:38 +00:00
Stan Iliev
9b21b970bc Merge "Fix pop-up shadow drawn in the wrong place with Skia pipeline" into oc-dev am: a5c6ba3473
am: 563c5d3643

Change-Id: I8a24e8d642d49cb4822db50bbf3b2fe6e5ec9122
2017-04-04 22:34:40 +00:00
TreeHugger Robot
9d64a418bb Merge "Optimize Canvas::drawGlyphs" 2017-04-04 21:36:10 +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
Stan Iliev
0b58d99283 Optimize Canvas::drawGlyphs
Avoid one memcpy in Canvas::drawGlyphs for all pipelines.

Test: CTS passed with exception of SweepTests#testBasicDraws
shadowtext, which fails with and without this CL.
Change-Id: I0841232dc7a6173eb3b03f939dbde15a84186296
2017-04-04 15:43:12 -04:00
Derek Sollenberger
4d6141c297 Merge "Fix HWUI/Skia Gradients to premultiply the colors prior to interpolation" into oc-dev am: f9340ca491
am: d75510ab6f

Change-Id: Iffb6644220b68790553ca9fa08ab2e4b532e50cb
2017-04-04 19:33:52 +00: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
5d2e064ebf Merge "Revert "Switch libplatformproto to sharedlib"" into oc-dev am: eabb5621dd
am: f497ca5a2e

Change-Id: I0a7bf55e5614b5b8f380332c2cd43d7d14df4e66
2017-04-04 17:35:53 +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
TreeHugger Robot
29e77fe359 Merge "Don't use deprecated canvas methods" 2017-04-04 15:09:45 +00:00
Mike Reed
6c9bb2408f Don't use deprecated canvas methods
Allows skia to remove SK_SUPPORT_LEGACY_CANVAS_HELPERS

Test: Existing tests cover the change.

Change-Id: I764c11f7a9bd7b87fba8563968160ee7dc9a99a2
2017-04-04 13:19:38 +00: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
7a41511805 Merge "Fix error in RenderNode unit test with Skia pipeline" 2017-04-03 20:56:48 +00:00
Mike Reed
6813635aea add temporary cast to allow Skia roll
Test: refactoring CL. Existing unit tests still pass.

Change-Id: I2e2a647bfad76af313db70d196566e01bf909fc8
2017-04-03 13:14:35 -04:00
Stan Iliev
25912c78f5 Fix error in RenderNode unit test with Skia pipeline
Fix failing RenderNode unit tests with Skia pipeline, caused by
TestUtils::syncHierarchyPropertiesAndDisplayList not walking past
root node.

Test: ran HWUI unit tests.
bug: 32507847
Change-Id: I7e64fb02fd8f4874eadacafcac7e9f1ae4e56365
2017-03-31 14:00:20 -04:00
TreeHugger Robot
62027f69c0 Merge "Add test configs to hwui tests" 2017-03-31 17:04:33 +00:00
John Reck
3c9c29ee38 Merge "Switch libplatformproto to sharedlib" into oc-dev am: 72c2760943
am: af39ba5d49

Change-Id: I73d9035f13f83c80045004867b4470779095d603
2017-03-30 17:32:00 +00:00
TreeHugger Robot
72c2760943 Merge "Switch libplatformproto to sharedlib" into oc-dev 2017-03-30 16:42:36 +00:00
TreeHugger Robot
b7a10e6b4a Merge "Add comments to clarify how SkDrawable dtor is called" 2017-03-30 15:14:53 +00:00
Romain Guy
427bb80ea8 Merge "Convert bitmaps to sRGB/scRGB when they have a color profile" into oc-dev am: 33813bd439
am: 6869c55106

Change-Id: I69b4e1ba160032255891fbb2656445badd5b936e
2017-03-30 01:53:07 +00:00
Romain Guy
33813bd439 Merge "Convert bitmaps to sRGB/scRGB when they have a color profile" into oc-dev 2017-03-30 01:42:32 +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
Adam Lesinski
93e8fa3fdc Merge "AAPT2: Parse an ID encoded as a map" into oc-dev am: c26ace0754
am: 719349cdb3

Change-Id: Icab08b15c92a8b88b7348e0caf61dba2f025de1b
2017-03-30 00:41:25 +00:00
Stan Iliev
f7aa6cdca1 Add comments to clarify how SkDrawable dtor is called
Document the 3 variants of SkDrawable object lifetime in
SkiaRecordingCanvas:
- The only drawable that is using ref couting to delete itself is
"LayerDrawable"
- 2 other drawables (RenderNodeDrawable and GLFunctorDrawable) are
deleted by std::deque
- the rest are deleted by ~LinearAllocator

bug: 36717955
Test: built and ran on device
Change-Id: I16f7f6573f6e4dc8d665f58d051255d40b1b690d
2017-03-29 18:25:12 -04:00
Adam Lesinski
33af6c730f AAPT2: Parse an ID encoded as a map
ID types should not be encoded as a map. AAPT and AAPT2 emit
IDs as boolean types.

Some apps exist that for some reason have their ID types encoded
as empty maps. This is the case only for the auto generated IDs
from enum values in <attr> tags.

Allow IDs as maps and ignore their content when processing an APK
for optimizing.

Also fixes an issue with expected size of the ResTable_package struct.

Bug: 35861796
Test: tested against the APK in b/35861796
Change-Id: I29a19cd9777bb10bed6766cd42e35e50e098797b
2017-03-29 20:11:04 +00: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
Dan Shi
6619d61697 Add test configs to hwui tests
Details about test configs changes are tracked in doc
https://docs.google.com/document/d/1EWUjJ7fjy8ge_Nk0YQbFdRp8DSHo3z6GU0R8jLgrAcw/edit#

The 3 tests are in the same folder, have to be built together then run.

Bug: 35882476
Test: local test
make -j32 hwui_unit_tests
make -j32 hwuimicro
make -j32 hwuimacro
tradefed.sh run template/local --template:map test=hwuimacro

Change-Id: I13f785d8e3215c61776a1beecaa121c7dc30bfec
2017-03-28 14:26:55 -07:00
Matt Sarett
7771386256 Merge "Add SkiaBehaviorTest for SkBlurDrawLooper" 2017-03-28 17:37:13 +00:00
TreeHugger Robot
cd56408bd9 Merge "Update VectorDrawables cache at frame start" 2017-03-28 13:35:53 +00: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
Stan Iliev
23c38a9ed9 Update VectorDrawables cache at frame start
Draw VectorDrawables in GPU backed surface. Render VD cache
at the beginning of the frame to avoid context switching.

Test: CTS graphics tests pass.
Change-Id: Ia14e0ec4049c3fa87f03547fbda44043bf8dd793
2017-03-27 18:43:34 -04: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
TreeHugger Robot
81ff6ee47a Merge "Register functor draw correctly" 2017-03-27 18:36:28 +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
TreeHugger Robot
bbf038bc5e Merge "Remove "Allow persistent changes to the vendor overlay theme"" 2017-03-24 22:25:20 +00:00
Matt Sarett
3d2135931c Add SkiaBehaviorTest for SkBlurDrawLooper
Test: This is a test.

Change-Id: Ib14087168300eea97b9188f134b1cea6c35b3858
2017-03-24 16:18:55 -04: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
Jason Monk
cc5a731fd7 Remove "Allow persistent changes to the vendor overlay theme"
This reverts commit 2dc804be11444565e3d1d151c2a693db3ade94c0.
It also removes the related calls from UiModeManager.

Fixes: 32721178
Test: make & flash
Change-Id: Id371bccec611155cc6910e46b3277c3d27fc1c79
2017-03-23 11:25:59 -04:00
Yunlian Jiang
442c8226aa Merge "Fix warning: Potential leak of memory pointed to by 'set'" am: 58ba53bd53 am: 0889a8a070
am: 2b53748a21

Change-Id: Icec70d3e3efef0eea9c117911821dfd05bcb2ced
2017-03-22 00:36:30 +00:00