diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-04-12 10:29:42 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-04-12 10:32:25 +0200 |
commit | 063af4a4f333ebfb500ccc82eb2f507d0e89836e (patch) | |
tree | 913e34446e785bb11ec5df0d9efdcee0f698617d /common/pixman_utils.c | |
parent | 03fb4e05be48fb47ff38b100e649f9aa263ceb58 (diff) |
Always tread depth 24 (i.e. non alpha) as depth 32 when blitting
When blitting we don't really care about alpha mismatches, we just copy bits
anyway.
Diffstat (limited to 'common/pixman_utils.c')
-rw-r--r-- | common/pixman_utils.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/common/pixman_utils.c b/common/pixman_utils.c index b946a1c0..758b24f2 100644 --- a/common/pixman_utils.c +++ b/common/pixman_utils.c @@ -521,7 +521,7 @@ void spice_pixman_blit(pixman_image_t *dest, int width, int height) { uint32_t *bits, *src_bits; - int stride, depth; + int stride, depth, src_depth; int src_width, src_height, src_stride; uint8_t *byte_line; uint8_t *src_line; @@ -532,10 +532,19 @@ void spice_pixman_blit(pixman_image_t *dest, depth = pixman_image_get_depth(dest); /* stride is in bytes, depth in bits */ + if (depth == 24) { + depth = 32; /* Needed for pixman_blt */ + } + src_bits = pixman_image_get_data(src); src_stride = pixman_image_get_stride(src); src_width = pixman_image_get_width(src); src_height = pixman_image_get_height(src); + src_depth = pixman_image_get_depth(src); + + if (src_depth == 24) { + src_depth = 32; /* Needed for pixman_blt */ + } /* Clip source */ if (src_x < 0) { @@ -569,11 +578,7 @@ void spice_pixman_blit(pixman_image_t *dest, ASSERT(dest_y + height <= pixman_image_get_height(dest)); ASSERT(src_x + width <= pixman_image_get_width(src)); ASSERT(src_y + height <= pixman_image_get_height(src)); - ASSERT(depth == pixman_image_get_depth(src)); - - if (depth == 24) { - depth = 32; /* Needed for pixman_blt */ - } + ASSERT(depth == src_depth); if (pixman_blt(src_bits, bits, @@ -616,7 +621,7 @@ void spice_pixman_blit_rop (pixman_image_t *dest, SpiceROP rop) { uint32_t *bits, *src_bits; - int stride, depth; + int stride, depth, src_depth; int src_width, src_height, src_stride; uint8_t *byte_line; uint8_t *src_line; @@ -626,10 +631,19 @@ void spice_pixman_blit_rop (pixman_image_t *dest, depth = pixman_image_get_depth(dest); /* stride is in bytes, depth in bits */ + if (depth == 24) { + depth = 32; /* Needed for pixman_blt */ + } + src_bits = pixman_image_get_data(src); src_stride = pixman_image_get_stride(src); src_width = pixman_image_get_width(src); src_height = pixman_image_get_height(src); + src_depth = pixman_image_get_depth(src); + + if (src_depth == 24) { + src_depth = 32; /* Needed for pixman_blt */ + } /* Clip source */ if (src_x < 0) { @@ -663,7 +677,7 @@ void spice_pixman_blit_rop (pixman_image_t *dest, ASSERT(dest_y + height <= pixman_image_get_height(dest)); ASSERT(src_x + width <= pixman_image_get_width(src)); ASSERT(src_y + height <= pixman_image_get_height(src)); - ASSERT(depth == pixman_image_get_depth(src)); + ASSERT(depth == src_depth); if (depth == 8) { copy_rop_8_func_t rop_func = copy_rops_8[rop]; |