Fix alpha handling in Scintilla when not using wxGraphicsContext.

When using raw bitmap data access classes such as wxAlphaPixelData we must
destroy them to ensure that the changes done via them are committed to the
bitmap before drawing the bitmap.

Just add an extra block (the diff should be viewed ignoring white space to see
the only significant change) to ensure that wxAlphaPixelData is destroyed
before DrawBitmap() is called.

Closes #14680.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72525 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-09-20 20:00:48 +00:00
parent ac896cd53a
commit 4f97cb83cf

View File

@@ -337,6 +337,10 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
int x, y; int x, y;
wxRect r = wxRectFromPRectangle(rc); wxRect r = wxRectFromPRectangle(rc);
wxBitmap bmp(r.width, r.height, 32); wxBitmap bmp(r.width, r.height, 32);
// This block is needed to ensure that the changes done to the bitmap via
// pixel data object are committed before the bitmap is drawn.
{
wxAlphaPixelData pixData(bmp); wxAlphaPixelData pixData(bmp);
// Set the fill pixels // Set the fill pixels
@@ -387,6 +391,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
p.Blue() = wxPy_premultiply(blue, alphaOutline); p.Blue() = wxPy_premultiply(blue, alphaOutline);
p.Alpha() = alphaOutline; p.Alpha() = alphaOutline;
} }
}
// Draw the bitmap // Draw the bitmap
hdc->DrawBitmap(bmp, r.x, r.y, true); hdc->DrawBitmap(bmp, r.x, r.y, true);