Fix a bug in IsColorSpaceSupportedByPCVR()
This bug was introduced in https://crrev.com/c/2321307. It was detected by the new Web platform test in my pending CL https://crrev.com/c/2304961. The following return statement in IsColorSpaceSupportedByPCVR() if (!image->alphaPlane) return true; actually elided a check that yuv_color_space was one of the four SkYUVColorSpace values supported by media::PaintCanvasVideoRenderer (PCVR). At that time (before https://skia-review.googlesource.com/c/skia/+/305596) SkYUVColorSpace had only those four values (except for kIdentity_SkYUVColorSpace) and our own GetSkYUVColorSpace() function returned only those four values on success, so it was fine to elide that check. After we switched from our own GetSkYUVColorSpace() function to gfx::ColorSpace::ToSkYUVColorSpace() in https://crrev.com/c/2321307, the newly added SkYUVColorSpace values may be returned, so it is no longer fine to elide the check. Also make two cleanup changes: 1. Replace the deprecated SkYUVColorSpace enumerators with the new more verbose ones. 2. Do not declare the yuv_color_space_ member as base::Optional. base::Optional made sense because our own GetSkYUVColorSpace() function returned base::Optional instead of using an output parameter. Since gfx::ColorSpace::ToSkYUVColorSpace() uses an output parameter, it is cumbersome to pass a base::Optional as an output parameter. Bug: 1108626 Change-Id: I96dba5c54dbe1b826be714141665adcaee47bccb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343535Reviewed-by:Peter Kasting <pkasting@chromium.org> Commit-Queue: Wan-Teh Chang <wtc@google.com> Cr-Commit-Position: refs/heads/master@{#796150}
Showing
Please register or sign in to comment