[gimp] libgimpcolor: optimize gimp_color_profile_get_format() for cairo-RGB24
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpcolor: optimize gimp_color_profile_get_format() for cairo-RGB24
- Date: Wed, 25 May 2016 10:33:57 +0000 (UTC)
commit 7326f346c37b3f200086c9a0118ed994902c1aa4
Author: Michael Natterer <mitch gimp org>
Date: Wed May 25 12:24:06 2016 +0200
libgimpcolor: optimize gimp_color_profile_get_format() for cairo-RGB24
Trick lcms into converting cairo-RGB24 pixels directly, by using
TYPE_BGRA_8 on little endian and TYPE_ARGB_8 on big endian. They have
the same byte order, and the alpha channel (ignored by lcms anyway)
takes the place of the unused byte of cairo-RGB24.
This saves two babl conversions around cmsDoTransform().
libgimpcolor/gimpcolorprofile.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index 93f291c..385a79b 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -1480,9 +1480,13 @@ gimp_color_profile_get_format (const Babl *format,
if (format == babl_format ("cairo-RGB24"))
{
- *lcms_format = TYPE_RGB_8;
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ *lcms_format = TYPE_BGRA_8;
+#else
+ *lcms_format = TYPE_ARGB_8;
+#endif
- return babl_format ("R'G'B' u8");
+ return format;
}
else if (format == babl_format ("cairo-ARGB32"))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]