Use skcms_AlphaFormat_Unpremul if !has_alpha
If has_alpha is false, pass skcms_AlphaFormat_Unpremul instead of skcms_AlphaFormat_Opaque to skcms_Transform(). Brian Osman explains in an email to Peter Kasting: If we don't care about the "alpha" data, then using Unpremul is (slightly) faster. Unlike Skia, skcms interprets Opaque as instructions to *guarantee* that things are treated as opaque. This means that we will load the source data, then replace the alpha with 1.0, and also set it to 1.0 before writing if the dstAlpha is opaque. With unpremul src and dst, the alpha is never used, so it just gets loaded and stored without any extra work. After this CL, skcms_AlphaFormat_Opaque is only used in third_party/skia/tools/HashAndEncode.cpp, and only for srcAlpha. Change-Id: I38062ca46583ea0586be80e6a69980a1b1e777d3 Bug: 1085550 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212781 Commit-Queue: Wan-Teh Chang <wtc@google.com> Reviewed-by:Peter Kasting <pkasting@chromium.org> Reviewed-by:
Brian Osman <brianosman@google.com> Reviewed-by:
Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#771197}
Showing
Please register or sign in to comment