babl r312 - in trunk: . extensions
- From: jheller svn gnome org
- To: svn-commits-list gnome org
- Subject: babl r312 - in trunk: . extensions
- Date: Tue, 20 May 2008 14:38:02 +0000 (UTC)
Author: jheller
Date: Tue May 20 14:38:02 2008
New Revision: 312
URL: http://svn.gnome.org/viewvc/babl?rev=312&view=rev
Log:
2008-05-20 Jan Heller <jheller svn gnome org>
* extensions/gimp-8bit.c (conv_rgbaF_linear_rgb8_linear),
(conv_rgbaF_linear_rgba8_linear), (init): added naive versions
of respective conversions.
Modified:
trunk/ChangeLog
trunk/extensions/gimp-8bit.c
Modified: trunk/extensions/gimp-8bit.c
==============================================================================
--- trunk/extensions/gimp-8bit.c (original)
+++ trunk/extensions/gimp-8bit.c Tue May 20 14:38:02 2008
@@ -296,6 +296,59 @@
return samples;
}
+static INLINE long
+conv_rgbaF_linear_rgb8_linear (unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ float *fsrc = (float *) src;
+ long n = samples;
+ long int v;
+
+ while (n--)
+ {
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ fsrc++;
+ }
+
+ return samples;
+}
+
+static INLINE long
+conv_rgbaF_linear_rgba8_linear (unsigned char *src,
+ unsigned char *dst,
+ long samples)
+{
+ float *fsrc = (float *) src;
+ long n = samples;
+ long int v;
+
+ while (n--)
+ {
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+
+ v = rint (*fsrc++ * 255.0);
+ *dst++ = (v < 0) ? 0 : ((v > 255) ? 255 : v);
+ }
+
+ return samples;
+}
+
int init (void);
int
@@ -402,5 +455,9 @@
o (g8_gamma_2_2, gF_linear);
o (g8_linear, rgbaF_linear);
o (g8_gamma_2_2, rgbaF_linear);
+
+ o (rgbaF_linear, rgb8_linear);
+ o (rgbaF_linear, rgba8_linear);
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]