[Spice-devel,1/3] canvas_utils: Make sure strides are aligned to multiple of 4

Submitted by Soeren Sandmann on Aug. 24, 2012, 1 a.m.

Details

Message ID 1345770051-13184-2-git-send-email-sandmann@cs.au.dk
State New
Headers show

Not browsing as part of any series.

Commit Message

Soeren Sandmann Aug. 24, 2012, 1 a.m.
From: Søren Sandmann Pedersen <ssp@redhat.com>

Pixman requires all strides to be aligned to a multiple of 4. With the
upcoming a8 images, this is not guaranteed anymore.
---
 common/canvas_utils.c | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/common/canvas_utils.c b/common/canvas_utils.c
index 7b92436..feb89cb 100644
--- a/common/canvas_utils.c
+++ b/common/canvas_utils.c
@@ -282,6 +282,9 @@  pixman_image_t *alloc_lz_image_surface(LzDecodeUsrData *canvas_data,
 
     stride = (gross_pixels / height) * (PIXMAN_FORMAT_BPP (pixman_format) / 8);
 
+    /* pixman requires strides to be 4-byte aligned */
+    stride = SPICE_ALIGN(stride, 4);
+    
     if (!top_down) {
         stride = -stride;
     }