mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 04:33:32 +00:00
[MSPAINT] Add CachedBufferDIB function and use it
We do caching on buffering paint. This will improve performance a little. CORE-18867
This commit is contained in:
parent
c706222f3f
commit
2f856f6f0d
8 changed files with 73 additions and 9 deletions
|
@ -59,6 +59,26 @@ CreateColorDIB(int width, int height, COLORREF rgb)
|
|||
return ret;
|
||||
}
|
||||
|
||||
HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight)
|
||||
{
|
||||
if (minimalWidth <= 0)
|
||||
minimalWidth = 1;
|
||||
if (minimalHeight <= 0)
|
||||
minimalHeight = 1;
|
||||
|
||||
BITMAP bm;
|
||||
if (!GetObject(hbm, sizeof(bm), &bm))
|
||||
hbm = NULL;
|
||||
|
||||
if (hbm && minimalWidth <= bm.bmWidth && minimalHeight <= bm.bmHeight)
|
||||
return hbm;
|
||||
|
||||
if (hbm)
|
||||
DeleteObject(hbm);
|
||||
|
||||
return CreateDIBWithProperties((minimalWidth * 3) / 2, (minimalHeight * 3) / 2);
|
||||
}
|
||||
|
||||
int
|
||||
GetDIBWidth(HBITMAP hBitmap)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue