[babl] extensions: make fastpath for R'G'B'A u8 to cairo-ARGB32 have 0 error
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] extensions: make fastpath for R'G'B'A u8 to cairo-ARGB32 have 0 error
- Date: Mon, 30 Jul 2012 20:49:50 +0000 (UTC)
commit 89e2e350985cf363c16184cd0b9c4866f7a1c76d
Author: Ãyvind KolÃs <pippin gimp org>
Date: Mon Jul 30 22:48:57 2012 +0200
extensions: make fastpath for R'G'B'A u8 to cairo-ARGB32 have 0 error
extensions/cairo.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/extensions/cairo.c b/extensions/cairo.c
index 2e224d0..69e7275 100644
--- a/extensions/cairo.c
+++ b/extensions/cairo.c
@@ -54,14 +54,14 @@ conv_rgb8_cairo24_le (unsigned char *src, unsigned char *dst, long samples)
}
static inline long
-conv_rgbA8_cairo32_le (unsigned char *src, unsigned char *dst, long samples)
+conv_rgbA8_premul_cairo32_le (unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
while (n--)
{
- dst[0] = src[2] * src[3];
- dst[1] = src[1] * src[3];
- dst[2] = src[0] * src[3];
+ dst[0] = src[2];
+ dst[1] = src[1];
+ dst[2] = src[0];
dst[3] = src[3];
src+=4;
dst+=4;
@@ -69,15 +69,19 @@ conv_rgbA8_cairo32_le (unsigned char *src, unsigned char *dst, long samples)
return samples;
}
+static float lut_linear[1 << 8];
+
static inline long
-conv_rgbA8_premul_cairo32_le (unsigned char *src, unsigned char *dst, long samples)
+conv_rgbA8_cairo32_le (unsigned char *src, unsigned char *dst, long samples)
{
long n = samples;
while (n--)
{
- dst[0] = src[2];
- dst[1] = src[1];
- dst[2] = src[0];
+#define div_255(a) ((((a)+127)+(((a)+127)>>8))>>8)
+ dst[0] = div_255 (src[2] * src[3]);
+ dst[1] = div_255 (src[1] * src[3]);
+ dst[2] = div_255 (src[0] * src[3]);
+#undef div_255
dst[3] = src[3];
src+=4;
dst+=4;
@@ -85,6 +89,7 @@ conv_rgbA8_premul_cairo32_le (unsigned char *src, unsigned char *dst, long sampl
return samples;
}
+
int
init (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]