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 <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-07-01 17:02:10 +08:00
parent 1444fed4a8
commit ca614860fa

View File

@ -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);