[babl] extensions: add fastpath for R'G'B'A u8 to cairo-ARGB32 conversion
- From: Alexia Death <alexiade src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] extensions: add fastpath for R'G'B'A u8 to cairo-ARGB32 conversion
- Date: Mon, 30 Jul 2012 20:07:16 +0000 (UTC)
commit b8c08b2ff763d83facc49c73fe79cef0ab5e4e99
Author: Alexia Death <alexiadeath gmail com>
Date: Fri Jul 27 21:49:35 2012 +0300
extensions: add fastpath for R'G'B'A u8 to cairo-ARGB32 conversion
extensions/cairo.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/extensions/cairo.c b/extensions/cairo.c
index abc87fd..2e224d0 100644
--- a/extensions/cairo.c
+++ b/extensions/cairo.c
@@ -59,6 +59,22 @@ conv_rgbA8_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[3] = src[3];
+ src+=4;
+ dst+=4;
+ }
+ return samples;
+}
+
+static inline long
+conv_rgbA8_premul_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];
@@ -101,7 +117,10 @@ init (void)
);
babl_conversion_new (babl_format ("R'aG'aB'aA u8"), f32, "linear",
+ conv_rgbA8_premul_cairo32_le, NULL);
+ babl_conversion_new (babl_format ("R'G'B'A u8"), f32, "linear",
conv_rgbA8_cairo32_le, NULL);
+
babl_conversion_new (babl_format ("R'G'B'A u8"), f24, "linear",
conv_rgba8_cairo24_le, NULL);
babl_conversion_new (babl_format ("R'G'B' u8"), f24, "linear",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]