win32: erase paint buffer on creation

git-svn-id: trunk@30264 -
This commit is contained in:
paul 2011-04-11 01:40:28 +00:00
parent f724c04b0b
commit 9f4bb027ae

View File

@ -168,6 +168,7 @@ var
Details: TThemedElementDetails;
ShowAccel: Boolean;
Color: TColor;
PaintParams: TBP_PaintParams;
begin
glyphWidth := srcWidth;
glyphHeight := srcHeight;
@ -179,7 +180,12 @@ var
OldBitmapHandle := SelectObject(hdcNewBitmap, NewBitmap);
if UseThemes and AlphaDraw then
PaintBuffer := BeginBufferedPaint(hdcNewBitmap, @BitmapRect, BPBF_COMPOSITED, nil, TmpDC)
begin
FillChar(PaintParams, SizeOf(PaintParams), 0);
PaintParams.cbSize := SizeOf(PaintParams);
PaintParams.dwFlags := BPPF_ERASE;
PaintBuffer := BeginBufferedPaint(hdcNewBitmap, @BitmapRect, BPBF_COMPOSITED, @PaintParams, TmpDC);
end
else
begin
TmpDC := hdcNewBitmap;
@ -191,9 +197,7 @@ var
// clear background:
// for alpha bitmap clear it with $00000000 else make it solid color for
// further masking
if PaintBuffer <> 0 then
BufferedPaintClear(PaintBuffer, nil)
else
if PaintBuffer = 0 then
begin
Windows.FillRect(TmpDC, BitmapRect, GetSysColorBrush(COLOR_BTNFACE));
Color := BitBtn.Font.Color;