This retains gamut correction (adjusting colors for screens with different capabilities), but does all blending and interpolation with sRGB-encoded values. That matches the behavior expected by most users, as well as the behavior of nearly all other systems. It also greatly simplifies the EGL code.
A future Skia change will make this behavior more of a first-class citizen, so some of these implementation details will change again, but the behavior will not. The bulk of this change (elimination of complication from the GL surface code) is permanent - it's just the SkColorSpaceXformCanvas that will be replaced.
The bitmap used to hold a prerolled image in the raster cache must have an
integer width/height in pixels. However, the picture used to draw the image
may have a non-integer width/height in physical coordinates and thus not
completely fill the bitmap. The compositor should only select the subset
of the bitmap that reflects the portion filled by the rendered picture.
* Revert "Revert "Reland "Run Flutter on iOS and Android with color correct Skia" (#3818)" (#3823)"
This reverts commit db8d8a9979901d05b011368226ad5bf61b1da13f.
* Fix test code to match internal API change
* Revert "Revert "Run Flutter on iOS and Android with color correct Skia (#3743)" (#3775)"
This reverts commit cfe70e07d386d6052267fe3772bbd641c8413a54.
* Enable sRGB on IO thread, too
* Add 4444 as a fallback rendering mode
* Use bare ptr to SkColorSpace (not sk_sp) in PrerollContext
* Run Flutter on iOS and Android with color correct Skia (#3716)
***Turns on color correct rendering for Android and iOS
***Communicates dst color space to raster cache
***Turns on color space aware image decoding
Test:
***color_testing_demo on Pixel XL
***flutter_gallery on iPad Mini and iPad Pro (haven't figured out how to run manual_tests on iOS)
TODO:
I needed to split up this CL somewhere. These are follow-up tasks.
***Make desktop backends color correct
***Make debugging tools (ex: encoding frames to png) preserve color space
***Investigate using UIKit API to allow iOS to fine tune color space of rendered content
* Fix pixel rounding error in the picture layer by first ensuring that
the texture for the image is at least as big as the next integer size
along each dimension and using kStrict_SrcRectConstraint while
drawing the same image. We already select the source subset by
looking at the cull rect of the picture.
* Decompose the transformation matrix into a series of operations that
generated the same to calculate the scale at which to rasterize the
picture. This make the rasterization scale resilient to
transformations that introduce a perspective component to the
resultant matrix.
* The scale in the decomposed matrix is now part of the key in the
cache.
* Raster cache images that could never be rasterized were still taking
part in the cache. Now, those entries are rejected early on. This
leads to the sweep after the frame iterating over fewer items.
* Added a unit test target.
***Turns on color correct rendering for Android and iOS
***Communicates dst color space to raster cache
***Turns on color space aware image decoding
Test:
***color_testing_demo on Pixel XL
***flutter_gallery on iPad Mini and iPad Pro (haven't figured out how to run manual_tests on iOS)
TODO:
I needed to split up this CL somewhere. These are follow-up tasks.
***Make desktop backends color correct
***Make debugging tools (ex: encoding frames to png) preserve color space
***Investigate using UIKit API to allow iOS to fine tune color space of rendered content
This patch introduces a //glue library that isolates our dependency on //base.
This will let us clean up our //base dependencies ahead of actually being able
to fully remove them.
The code that draws the picture knows more about the picture (and the future)
than we do. This patch gives them a way to hint us about what's going to
happen with the picture in the future.
Instead, make Layer::Paint take a new PaintContext that has just exactly
the state that it needs, mirroring PrerollContext. Also, rename
PaintContext to CompositorContext because it holds the context for the
whole compositor.
After an application is suspended and the GrContext associated with the
Flutter view is destroyed, the raster cache still contains images tied
to the defunct context. The SkyShell process will crash if these images
are used after the application resumes.
When rasterzing with a non-zero left and top offset, we need to apply the scale
first so that we're translating in the correct coordinate system.
Fixes https://github.com/flutter/flutter/issues/1292
The matrix argument to drawPicture doesn't seem to do what we want exactly.
Instead, use the normal matrix in the canvas. Also, handle cull rects with
non-zero left and top coordinates.
Fixes#1229