uxtheme: Speed up UXTHEME_SizedBlt in the ST_TILE by building an appropriately-sized memory bitmap out of the tile instead of iterating with UXTHEME_Blt() directly.
This commit is contained in:
parent
2e798b52ef
commit
1706d0d63e
|
@ -340,27 +340,67 @@ static inline BOOL UXTHEME_SizedBlt (HDC hdcDst, int nXOriginDst, int nYOriginDs
|
||||||
{
|
{
|
||||||
if (sizingtype == ST_TILE)
|
if (sizingtype == ST_TILE)
|
||||||
{
|
{
|
||||||
int yOfs = nYOriginDst;
|
HDC hdcTemp;
|
||||||
int yRemaining = nHeightDst;
|
BOOL result = FALSE;
|
||||||
while (yRemaining > 0)
|
|
||||||
|
/* Create a DC with a bitmap consisting of a tiling of the source
|
||||||
|
bitmap, with standard GDI functions. This is faster than an
|
||||||
|
iteration with UXTHEME_Blt(). */
|
||||||
|
hdcTemp = CreateCompatibleDC(hdcSrc);
|
||||||
|
if (hdcTemp != 0)
|
||||||
{
|
{
|
||||||
int bltHeight = min (yRemaining, nHeightSrc);
|
HBITMAP bitmapTemp;
|
||||||
int xOfs = nXOriginDst;
|
HBITMAP bitmapOrig;
|
||||||
int xRemaining = nWidthDst;
|
int nWidthTemp, nHeightTemp;
|
||||||
|
int xOfs, xRemaining;
|
||||||
|
int yOfs, yRemaining;
|
||||||
|
int growSize;
|
||||||
|
|
||||||
|
/* Calculate temp dimensions of integer multiples of source dimensions */
|
||||||
|
nWidthTemp = ((nWidthDst + nWidthSrc - 1) / nWidthSrc) * nWidthSrc;
|
||||||
|
nHeightTemp = ((nHeightDst + nHeightSrc - 1) / nHeightSrc) * nHeightSrc;
|
||||||
|
bitmapTemp = CreateCompatibleBitmap(hdcSrc, nWidthTemp, nHeightTemp);
|
||||||
|
bitmapOrig = SelectObject(hdcTemp, bitmapTemp);
|
||||||
|
|
||||||
|
/* Initial copy of bitmap */
|
||||||
|
BitBlt(hdcTemp, 0, 0, nWidthSrc, nHeightSrc, hdcSrc, nXOriginSrc, nYOriginSrc, SRCCOPY);
|
||||||
|
|
||||||
|
/* Extend bitmap in the X direction. Growth of width is exponential */
|
||||||
|
xOfs = nWidthSrc;
|
||||||
|
xRemaining = nWidthTemp - nWidthSrc;
|
||||||
|
growSize = nWidthSrc;
|
||||||
while (xRemaining > 0)
|
while (xRemaining > 0)
|
||||||
{
|
{
|
||||||
int bltWidth = min (xRemaining, nWidthSrc);
|
growSize = min(growSize, xRemaining);
|
||||||
if (!UXTHEME_Blt (hdcDst, xOfs, yOfs, bltWidth, bltHeight,
|
BitBlt(hdcTemp, xOfs, 0, growSize, nHeightSrc, hdcTemp, 0, 0, SRCCOPY);
|
||||||
hdcSrc, nXOriginSrc, nYOriginSrc,
|
xOfs += growSize;
|
||||||
transparent, transcolor))
|
xRemaining -= growSize;
|
||||||
return FALSE;
|
growSize *= 2;
|
||||||
xOfs += nWidthSrc;
|
|
||||||
xRemaining -= nWidthSrc;
|
|
||||||
}
|
}
|
||||||
yOfs += nHeightSrc;
|
|
||||||
yRemaining -= nHeightSrc;
|
/* Extend bitmap in the Y direction. Growth of height is exponential */
|
||||||
|
yOfs = nHeightSrc;
|
||||||
|
yRemaining = nHeightTemp - nHeightSrc;
|
||||||
|
growSize = nHeightSrc;
|
||||||
|
while (yRemaining > 0)
|
||||||
|
{
|
||||||
|
growSize = min(growSize, yRemaining);
|
||||||
|
BitBlt(hdcTemp, 0, yOfs, nWidthTemp, growSize, hdcTemp, 0, 0, SRCCOPY);
|
||||||
|
yOfs += growSize;
|
||||||
|
yRemaining -= growSize;
|
||||||
|
growSize *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Use temporary hdc for source */
|
||||||
|
result = UXTHEME_Blt (hdcDst, nXOriginDst, nYOriginDst, nWidthDst, nHeightDst,
|
||||||
|
hdcTemp, 0, 0,
|
||||||
|
transparent, transcolor);
|
||||||
|
|
||||||
|
SelectObject(hdcTemp, bitmapOrig);
|
||||||
|
DeleteObject(bitmapTemp);
|
||||||
}
|
}
|
||||||
return TRUE;
|
DeleteDC(hdcTemp);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue