summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-11-16 12:15:49 +0100
committerAndrea Canciani <ranma42@gmail.com>2010-12-13 17:22:37 +0100
commit19dda0dd049d3ab2e5e9a7c0176745713e67db16 (patch)
treeffc32aa90a5b251efc118f6a2b94cffe7622f5ea
parent73607c8622ddd112ae602afce72f932f8b93f8a9 (diff)
remove argb_t
-rw-r--r--pixman/pixman-image.c4
-rw-r--r--pixman/pixman-private.h18
-rw-r--r--pixman/pixman-utils.c46
3 files changed, 26 insertions, 42 deletions
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 58cec13..bc91542 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -143,7 +143,7 @@ _pixman_image_get_scanline (pixman_image_t * image,
{
uint32_t *tmp = malloc (sizeof(pixman_component_t) * 4 * width);
_pixman_image_get_scanline_64 (image, x, y, width, tmp, NULL);
- pixman_expand_64 ((argb_t *)buffer, (uint64_t *)tmp, width);
+ pixman_expand_64 ((pixman_component_t *)buffer, (uint64_t *)tmp, width);
free (tmp);
}
@@ -155,7 +155,7 @@ _pixman_image_store_scanline (bits_image_t * image,
const uint32_t * buffer)
{
uint64_t *tmp = malloc (sizeof(uint64_t) * 4 * width);
- pixman_contract_64 (tmp, (argb_t *)buffer, width);
+ pixman_contract_64 (tmp, (pixman_component_t *)buffer, width);
_pixman_image_store_scanline_64 (image, x, y, width, (uint32_t *) tmp);
free (tmp);
}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 8c2e67d..69ea020 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -32,18 +32,8 @@ typedef struct radial_gradient radial_gradient_t;
typedef struct bits_image bits_image_t;
typedef struct circle circle_t;
-typedef struct argb_t argb_t;
-
typedef float pixman_component_t;
-struct argb_t
-{
- pixman_component_t a;
- pixman_component_t r;
- pixman_component_t g;
- pixman_component_t b;
-};
-
typedef void (*fetch_scanline_t) (pixman_image_t *image,
int x,
int y,
@@ -697,13 +687,13 @@ pixman_expand (uint64_t * dst,
pixman_format_code_t format,
int width);
void
-pixman_expand_to_float (argb_t *dst,
+pixman_expand_to_float (pixman_component_t *dst,
const uint32_t *src,
pixman_format_code_t format,
int width);
void
-pixman_expand_64 (argb_t *dst,
+pixman_expand_64 (pixman_component_t *dst,
const uint64_t *src,
int width);
@@ -714,12 +704,12 @@ pixman_contract (uint32_t * dst,
void
pixman_contract_from_float (uint32_t *dst,
- const argb_t *src,
+ const pixman_component_t *src,
int width);
void
pixman_contract_64 (uint64_t *dst,
- const argb_t *src,
+ const pixman_component_t *src,
int width);
/* Region Helpers */
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index fd30c69..3a984d8 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -145,7 +145,7 @@ unorm_to_float (uint16_t u, int n_bits)
}
void
-pixman_expand_to_float (argb_t *dst,
+pixman_expand_to_float (pixman_component_t *dst,
const uint32_t *src,
pixman_format_code_t format,
int width)
@@ -168,15 +168,15 @@ pixman_expand_to_float (argb_t *dst,
{
const uint32_t pixel = src[i];
- dst[i].a = a_size? unorm_to_float (pixel >> a_shift, a_size) : 1.0;
- dst[i].r = r_size? unorm_to_float (pixel >> r_shift, r_size) : 0.0;
- dst[i].g = g_size? unorm_to_float (pixel >> g_shift, g_size) : 0.0;
- dst[i].b = b_size? unorm_to_float (pixel >> b_shift, b_size) : 0.0;
+ dst[4*i+0] = a_size? unorm_to_float (pixel >> a_shift, a_size) : 1.0;
+ dst[4*i+1] = r_size? unorm_to_float (pixel >> r_shift, r_size) : 0.0;
+ dst[4*i+2] = g_size? unorm_to_float (pixel >> g_shift, g_size) : 0.0;
+ dst[4*i+3] = b_size? unorm_to_float (pixel >> b_shift, b_size) : 0.0;
}
}
void
-pixman_expand_64 (argb_t *dst,
+pixman_expand_64 (pixman_component_t *dst,
const uint64_t *src,
int width)
{
@@ -194,12 +194,10 @@ pixman_expand_64 (argb_t *dst,
{
const uint64_t pixel = src[i];
- dst[i].a = a_size? unorm_to_float (pixel >> a_shift, a_size) : 1.0;
- dst[i].r = r_size? unorm_to_float (pixel >> r_shift, r_size) : 0.0;
- dst[i].g = g_size? unorm_to_float (pixel >> g_shift, g_size) : 0.0;
- dst[i].b = b_size? unorm_to_float (pixel >> b_shift, b_size) : 0.0;
- if (0)
- printf ("%08llX = (%g, %g, %g, %g)\n", pixel, dst[i].a, dst[i].r, dst[i].g, dst[i].b);
+ dst[4*i+0] = a_size? unorm_to_float (pixel >> a_shift, a_size) : 1.0;
+ dst[4*i+1] = r_size? unorm_to_float (pixel >> r_shift, r_size) : 0.0;
+ dst[4*i+2] = g_size? unorm_to_float (pixel >> g_shift, g_size) : 0.0;
+ dst[4*i+3] = b_size? unorm_to_float (pixel >> b_shift, b_size) : 0.0;
}
}
@@ -217,7 +215,7 @@ pixman_unorm_to_float (uint16_t u, int n_bits)
void
pixman_contract_from_float (uint32_t *dst,
- const argb_t *src,
+ const pixman_component_t *src,
int width)
{
int i;
@@ -226,10 +224,10 @@ pixman_contract_from_float (uint32_t *dst,
{
uint8_t a, r, g, b;
- a = float_to_unorm (src[i].a, 8);
- r = float_to_unorm (src[i].r, 8);
- g = float_to_unorm (src[i].g, 8);
- b = float_to_unorm (src[i].b, 8);
+ a = float_to_unorm (src[4*i+0], 8);
+ r = float_to_unorm (src[4*i+1], 8);
+ g = float_to_unorm (src[4*i+2], 8);
+ b = float_to_unorm (src[4*i+3], 8);
dst[i] = (a << 24) | (r << 16) | (g << 8) | (b << 0);
}
@@ -237,7 +235,7 @@ pixman_contract_from_float (uint32_t *dst,
void
pixman_contract_64 (uint64_t *dst,
- const argb_t *src,
+ const pixman_component_t *src,
int width)
{
int i;
@@ -246,16 +244,12 @@ pixman_contract_64 (uint64_t *dst,
{
uint64_t a, r, g, b;
- a = float_to_unorm (src[i].a, 16);
- r = float_to_unorm (src[i].r, 16);
- g = float_to_unorm (src[i].g, 16);
- b = float_to_unorm (src[i].b, 16);
- if (0)
- printf ("(%g, %g, %g, %g) ", src[i].a, src[i].r, src[i].g, src[i].b);
+ a = float_to_unorm (src[4*i+0], 16);
+ r = float_to_unorm (src[4*i+1], 16);
+ g = float_to_unorm (src[4*i+2], 16);
+ b = float_to_unorm (src[4*i+3], 16);
dst[i] = (a << 48) | (r << 32) | (g << 16) | (b << 0);
- if (0)
- printf ("= %08llX\n", dst[i]);
}
}