aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrColorSpaceXform.cpp
Commit message (Collapse)AuthorAge
* Clamp colors after gamut xform in GaneshGravatar Brian Osman2016-12-02
| | | | | | | | | | | Fixes many blatant errors with glnarrow config BUG=skia: Change-Id: I729cda350ebce126bdac4eb41c91f30294e1c61e Reviewed-on: https://skia-review.googlesource.com/5469 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Osman <brianosman@google.com>
* Cache GrColorSpaceXformsGravatar Brian Osman2016-10-20
| | | | | | | | | | | | | | | | | | | | Even with a modest cache, we're going to get nearly 100% hit rate for typical usage scenarios. I'm hoping to avoid the special case caching of sRGB -> destination, and just rely on the more general mechanism. Yes, this is yet-another cache class. I wanted to use one of many that are laying around, but couldn't find a good fit. On the plus side, it's not much code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3726 Change-Id: I943be5c99f0d691a87ffe8c5bc3067a8eb491fc2 Reviewed-on: https://skia-review.googlesource.com/3726 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Hash the gamut of XYZ color spaces, to speed up comparisonGravatar Brian Osman2016-10-20
| | | | | | | | | | | | | | Also going to use this to allow caching of GrColorSpaceXforms BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3670 Change-Id: I56ed2dcbdddc22046263f56d68f2d6aea55547c8 Reviewed-on: https://skia-review.googlesource.com/3670 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Refactored SkColorSpace and added in a Lab PCS GMGravatar raftias2016-10-18
| | | | | | | | | | | | | | | | | | | | The refactoring breaks off A2B0 tag support into a separate subclass of SkColorSpace_Base, while keeping the current (besides CLUT) functionality in a XYZTRC subclass. ICC profile loading is now aware of this and creates the A2B0 subclass when SkColorSpace::NewICC() is called on a profile in need of the A2B0 functionality. The LabPCSDemo GM loads a .icc profile containing a LAB PCS and then runs a Lab->XYZ conversion on an image using it so we can display it and test out the A2B0 SkColorSpace functionality, sans a/b/m-curves, as well as the Lab->XYZ conversion code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2389983002 Review-Url: https://codereview.chromium.org/2389983002
* Move toXYZD50() to SkColorSpace_BaseGravatar msarett2016-09-28
| | | | | | | | | | | | SkColorSpace needs to become more versatile, in order to support profiles that cannot specified with just a "to XYZ D50" matrix. This a just first step to clean up the public API. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2381553002 Review-Url: https://codereview.chromium.org/2381553002
* Add storage and computation of SkColor4f version of gradient stops.Gravatar brianosman2016-09-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For now, we still only have the SkColor factory, but the Descriptor can now carry either an SkColor or SkColor4f specified gradient. Base class constructor automatically populates both forms of color, so that legacy raster backend will continue to work, and new backend work can operate directly from the float4 version. On the GPU side, we have similar logic, but GrGradientEffect only keeps one version of colors around: SkColor if the destination is legacy, and SkColor4f (with an optional gamut xform) if the destination is gamma correct. The 4f colors are already linear, and we gamut xform them in setData, so gradients are now fully color-correct in sRGB and F16 modes... ... unless there are more than three stops. Then we use a texture, and that code path isn't handled yet. We have a few choices here (do we use an 8-bit sRGB atlas, or just always use F16 linear atlas so we can share it among both sRGB and wide-gamut rendering). In any case, I'd like to defer that to a second CL. This change does fix the non-texture gradients in the gamut GM. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2337313002 Review-Url: https://codereview.chromium.org/2337313002
* Gamut transformation of the paint color in GaneshGravatar brianosman2016-09-12
| | | | | | | | | | | | Conversion from sRGB to destination gamut is going to be very common, so I'm caching that xform (if there is one) on the draw context. Results verified in the gamut GM (two more boxes correct). BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2330553003 Review-Url: https://codereview.chromium.org/2330553003
* Two changes:Gravatar brianosman2016-09-12
| | | | | | | | | | | | | | | | | 1. Remove special premul handling from gamut xform code Alpha is a constant, so the gamut transformation results remain unchanged (it distributes across the linear matrix multiply). 2. Use SkMatrix44 rather than array of floats Preserves semantic intention, and makes upcoming code (where we transform colors on the CPU by that matrix) simpler. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2329553002 Review-Url: https://codereview.chromium.org/2329553002
* Fix color gamut xform matrices in GPU codeGravatar brianosman2016-09-09
| | | | | | | | | | | Now that we're not storing them transposed, we can plumb them to the shader column-major all the way, and then multiply colors on the right, as it should be. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2326093002 Review-Url: https://codereview.chromium.org/2326093002
* Fix storage of gamut transform matrices in SkColorSpaceGravatar brianosman2016-09-09
| | | | | | | | | | | | | | | We were effectively storing the transpose, which made all of our operations on individual colors, and our concatenation of matrices awkward and backwards. I'm planning to push this further into Ganesh, where I had incorrectly adjusted to the previous layout, treating colors as row vectors in the shaders. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324843003 Review-Url: https://codereview.chromium.org/2324843003
* Cache the inverse matrix on SkColorSpace. Rename xyz() to toXYZ().Gravatar brianosman2016-09-08
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2323003002 Review-Url: https://codereview.chromium.org/2323003002
* Add color gamut xform helpers to GrGLSLShaderBuilderGravatar brianosman2016-09-07
| | | | | | | | | | | | | | New helper functions inject the necessary shader function. Texture lookup functions can now insert the gamut xform at the appropriate place, too. As written, could be used to transform non-texture colors (e.g. vertex colors) as well. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2180803005 Review-Url: https://codereview.chromium.org/2180803005
* Simplify color space xform storage and usage (float[] vs. SkMatrix44)Gravatar brianosman2016-07-27
| | | | | | | | | | Public API is really just internal. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2185533005 TBR=bsalomon@google.com Review-Url: https://codereview.chromium.org/2185533005
* Introduce GrColorSpaceXform, for gamut conversion on texturesGravatar brianosman2016-07-18
GrTextureAccess optionally includes an instance, computed from the src and dst color spaces. In all common cases (no color space for either src or dst, or same color space for both), no object is allocated. This change is orthogonal to my attempts to get color space attached to render targets - regardless of how we choose to do that, this will give us the source color space at all points where we are connecting src to dst. There are many dangling injection points where I've been inserting nullptr, but I have a record of all of them. Additionally, there are now three places (the most common simple paths for bitmap/image rendering) where things are plumbed enough that I expect to have access to the dst color space (all marked with XFORMTODO). In addition to getting the dst color space, I need to inject shader code and uniform uploading for appendTextureLookup and friends. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2154753003 Review-Url: https://codereview.chromium.org/2154753003