From 9d8bcefaf4ab3f914752a1c1e7695899aeb30d42 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 14 Sep 2009 12:52:20 -0500 Subject: [PATCH] winex11.drv: Re-add the optimization for blending 1x1 pixel bitmaps. --- dlls/winex11.drv/xrender.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index efa8d02..cc257fc 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -1834,14 +1834,10 @@ BOOL CDECL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT wid heightSrc = pts[1].y - pts[0].y; if (!widthDst || !heightDst || !widthSrc || !heightSrc) return TRUE; - /* If the source is a 1x1 bitmap, tiling is equivalent to stretching, but - tiling is much faster. Therefore, we do no stretching in this case. */ - repeat_src = widthSrc == 1 && heightSrc == 1; - #ifndef HAVE_XRENDERSETPICTURETRANSFORM - if((widthDst != widthSrc || heightDst != heightSrc) && !repeat_src) + if(widthDst != widthSrc || heightDst != heightSrc) #else - if(!pXRenderSetPictureTransform && !repeat_src) + if(!pXRenderSetPictureTransform) #endif { FIXME("Unable to Stretch, XRenderSetPictureTransform is currently required\n"); @@ -1859,6 +1855,10 @@ BOOL CDECL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT wid return FALSE; } + /* If the source is a 1x1 bitmap, tiling is equivalent to stretching, but + tiling is much faster. Therefore, we do no stretching in this case. */ + repeat_src = dib.dsBmih.biWidth == 1 && abs(dib.dsBmih.biHeight) == 1; + if (xSrc < 0 || ySrc < 0 || widthSrc < 0 || heightSrc < 0 || xSrc + widthSrc > dib.dsBmih.biWidth || ySrc + heightSrc > abs(dib.dsBmih.biHeight)) { @@ -1963,10 +1963,16 @@ BOOL CDECL X11DRV_AlphaBlend(X11DRV_PDEVICE *devDst, INT xDst, INT yDst, INT wid HeapFree( GetProcessHeap(), 0, rgndata ); } - /* Make sure we ALWAYS set the transformation matrix even if we don't need to scale. The reason is - * that later on we want to reuse pictures (it can bring a lot of extra performance) and each time - * a different transformation matrix might have been used. */ - set_xrender_transformation(src_pict, widthSrc/(double)widthDst, heightSrc/(double)heightDst, 0, 0); + if (!repeat_src) + { + /* Make sure we set the transformation matrix even if we don't need to scale. The reason is + * that later on we want to reuse pictures (it can bring a lot of extra performance) and each time + * a different transformation matrix might have been used. + + * We can skip this step when tiling a 1x1 image because the result will be the same no matter + * what transformation matrix is used. */ + set_xrender_transformation(src_pict, widthSrc/(double)widthDst, heightSrc/(double)heightDst, 0, 0); + } pXRenderComposite(gdi_display, PictOpOver, src_pict, 0, dst_pict, 0, 0, 0, 0, xDst + devDst->dc_rect.left, yDst + devDst->dc_rect.top, widthDst, heightDst); -- 1.5.4.3