551d08e2d50c7f73c5eb65fd366b92efba4f0ed5 |
|
20-Apr-2018 |
Derek Sollenberger <djsollen@google.com> |
Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositing This CL extracts the android_dataspace from the GLConsumer and converts it to a SkColorSpace. HWUI always expects to composite into an sRGB destination so when we draw the layer we run the draw through a colorFilter that converts the input colorSpace into that of the destination. Test: CtsViewTestCases Bug: 78016220 Merged-In: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b Change-Id: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
/frameworks/base/libs/hwui/utils/Color.h
|
8546c30fbfa7fc3e84d18d13a16cbfdd743d18e3 |
|
22-Mar-2018 |
Andrew Sapperstein <asapperstein@google.com> |
Revert "Revert "Update material_deep_teal_500 to #008577."" This reverts commit 431d9d63e993c6056e95811e9a84869aa324e7a0. Reason for revert: Rolling forward with a fix. Change-Id: I5804e240535b84e0f4b2d306649b1981a9871632 Merged-In: I5804e240535b84e0f4b2d306649b1981a9871632 Bug: 74118164 Test: atest cts/hostsidetests/theme
/frameworks/base/libs/hwui/utils/Color.h
|
431d9d63e993c6056e95811e9a84869aa324e7a0 |
|
22-Mar-2018 |
Andrew Sapperstein <asapperstein@google.com> |
Revert "Update material_deep_teal_500 to #008577." This reverts commit 5c228d5eb975de5e15970ae11ebddf95010875fe. Reason for revert: Breaks presubmit. b/76126268 Change-Id: Iffd8bbb62d05cae1c2a5dabfab2824899c5ff3cf Bug: 74118164 Bug: 76126268 Test: presubmit
/frameworks/base/libs/hwui/utils/Color.h
|
5c228d5eb975de5e15970ae11ebddf95010875fe |
|
18-Mar-2018 |
Andrew Sapperstein <asapperstein@google.com> |
Update material_deep_teal_500 to #008577. Better for accessibility. Also update some direct usage of the old value to use canonical versions. Bug: 74118164 Test: asset swap Change-Id: If0f07f04f72a16dc3662e2cf3a93e2b040d0bdb8
/frameworks/base/libs/hwui/utils/Color.h
|
1bcacfdcab0eaa0cee92bd7f5a1b5e271dd68e52 |
|
03-Nov-2017 |
John Reck <jreck@google.com> |
Format the world (or just HWUI) Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
/frameworks/base/libs/hwui/utils/Color.h
|
caaaa66e57293e4a6f312649bf472eab84d5c7fe |
|
27-Mar-2017 |
Romain Guy <romainguy@google.com> |
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
/frameworks/base/libs/hwui/utils/Color.h
|
efb4b06493fe7b1604c762a448b13c7af2845a8d |
|
27-Feb-2017 |
Romain Guy <romainguy@google.com> |
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
/frameworks/base/libs/hwui/utils/Color.h
|
91627f61705a68cd18fdbce1b8190a2ffdec5f10 |
|
01-Feb-2017 |
Romain Guy <romainguy@google.com> |
Fix incorrect comments Bug: 33010587 Test: comment only Change-Id: Icdfa79bac50545bb73f4c40727fe51780ef4a56d
/frameworks/base/libs/hwui/utils/Color.h
|
8762e332e3797fb41929a1c6069207f4906ca329 |
|
12-Oct-2016 |
Romain Guy <romainguy@google.com> |
Various fixes for linear blending and gradients With linear blending turned off some textures were still created as sRGB textures instead of linear textures. Multi-stop gradients were not behaving properly on devices with no support for float textures. Gradients are now always interpolated in linear space even if linear blending is off. New functions to always force sRGB->linear->sRGB conversions. Test: Manual testing Bug: 29940137 Change-Id: Ie2f84ee2a65fd85570e88af813e841e0e625df6c
/frameworks/base/libs/hwui/utils/Color.h
|
253f2c213f6ecda63b6872aee77bd30d5ec07c82 |
|
29-Sep-2016 |
Romain Guy <romainguy@google.com> |
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
/frameworks/base/libs/hwui/utils/Color.h
|
54fa17f667c285a5c9225e238c8132dfe830ef36 |
|
25-Nov-2015 |
Chris Craik <ccraik@google.com> |
Add ListView rendering benchmark Also fixes a bug in DrawRenderNodeOp recording, which was triggered by the new test. Change-Id: I328f2ed908495eb95ca8ce87a365d02650e72cd5
/frameworks/base/libs/hwui/utils/Color.h
|