Open Bug 1615404 Opened 5 years ago Updated 2 years ago

Images copied to clipboard should not color managed directly

Categories

(Core :: Graphics: Color Management, defect, P3)

defect

Tracking

()

People

(Reporter: aosmond, Unassigned)

References

(Blocks 1 open bug)

Details

We currently do color management for tagged images unless SurfaceFlags::NO_COLORSPACE_CONVERSION is used. We don't specify that flag when we copy an image on the clipboard, which means it will be color managed for that particular display. This may have unintended consequences.

On OS X, we get the surface for the image and put the pixel data into a CGImage:
https://searchfox.org/mozilla-central/rev/a4be2fbe9bd4f405c91cc16e4e3a80400f5a9301/widget/cocoa/nsClipboard.mm#513

We should get the pixel data without colorspace conversion and premultiplication, extract the ICC data and use CGColorSpaceCreateWithICCData in conjunction with the CGImage creation.

Similarly on Windows:

https://searchfox.org/mozilla-central/rev/a4be2fbe9bd4f405c91cc16e4e3a80400f5a9301/widget/windows/nsClipboard.cpp#471
https://searchfox.org/mozilla-central/rev/a4be2fbe9bd4f405c91cc16e4e3a80400f5a9301/widget/windows/nsDataObj.cpp#969

We need to get the ICC profile, and bind it to the reencoded image.

Similarly on Linux:

https://searchfox.org/mozilla-central/rev/a4be2fbe9bd4f405c91cc16e4e3a80400f5a9301/widget/gtk/nsImageToPixbuf.cpp#58

gdk_pixbuf_save can be used to bind an ICC profile to the image.

We also need to disable color management when drawing the vector image to a surface as well if color management mode is 1 (everything).

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.