[Pixman] [PATCH 04/32] pixman-general: Tighten up calculation of temporary buffer sizes

Ben Avison bavison at riscosopen.org
Thu Aug 7 09:50:00 PDT 2014


There's no need to align after the end of the temporary destination buffer,
and each of the remaining aligns can only add a maximum of 15 bytes to the
space requirement. This permits some edge cases to use the stack buffer
where previously it would have deduced that a heap buffer was required.
---
 pixman/pixman-general.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 7cdea29..c8f272b 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -159,10 +159,10 @@ general_composite_rect  (pixman_implementation_t *imp,
     mask_buffer = ALIGN (src_buffer + width * Bpp);
     dest_buffer = ALIGN (mask_buffer + width * Bpp);
 
-    if (ALIGN (dest_buffer + width * Bpp) >
+    if (dest_buffer + width * Bpp >
 	    scanline_buffer + sizeof (stack_scanline_buffer))
     {
-	scanline_buffer = pixman_malloc_ab_plus_c (width, Bpp * 3, 32 * 3);
+	scanline_buffer = pixman_malloc_ab_plus_c (width, Bpp * 3, 15 * 3);
 
 	if (!scanline_buffer)
 	    return;
-- 
1.7.5.4



More information about the Pixman mailing list