From ca614860fa2a56d469064b5e05070d8201597728 Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Fri, 1 Jul 2011 17:02:10 +0800 Subject: [PATCH] glamor: convert if too large source or mask . Some strange web page has 20000*1 png picture, and actually only use partial of it. We force to convert it to a actuall size rather than its original size,if it is the case. Then to avoid latter's failure uploading. Signed-off-by: Zhigang Gong --- glamor/glamor_render.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index 9599d978a..72e0f83c6 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -1170,8 +1170,10 @@ glamor_composite(CARD8 op, if ((!source->pDrawable && (source->pSourcePict->type != SourcePictTypeSolidFill)) || (source->pDrawable && !GLAMOR_PIXMAP_PRIV_HAS_FBO(source_pixmap_priv) - && (width * height * 4 - < (source_pixmap->drawable.width * source_pixmap->drawable.height)))){ + && ((width * height * 4 + < (source_pixmap->drawable.width * source_pixmap->drawable.height)) + || !(glamor_check_fbo_width_height(source_pixmap->drawable.width, + source_pixmap->drawable.height))))) { temp_src = glamor_convert_gradient_picture(screen, source, x_source, y_source, width, height); if (!temp_src) { temp_src = source; @@ -1184,8 +1186,10 @@ glamor_composite(CARD8 op, && ((!mask->pDrawable && (mask->pSourcePict->type != SourcePictTypeSolidFill)) || (mask->pDrawable && (!GLAMOR_PIXMAP_PRIV_HAS_FBO(mask_pixmap_priv)) - && (width * height * 4 - < (mask_pixmap->drawable.width * mask_pixmap->drawable.height))))) { + && ((width * height * 4 + < (mask_pixmap->drawable.width * mask_pixmap->drawable.height)) + || !(glamor_check_fbo_width_height(mask_pixmap->drawable.width, + mask_pixmap->drawable.height)))))) { /* XXX if mask->pDrawable is the same as source->pDrawable, we have an opportunity * to do reduce one convertion. */ temp_mask = glamor_convert_gradient_picture(screen, mask, x_mask, y_mask, width, height);