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:
@@ -337,55 +337,60 @@ 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);
|
||||||
wxAlphaPixelData pixData(bmp);
|
|
||||||
|
|
||||||
// Set the fill pixels
|
// This block is needed to ensure that the changes done to the bitmap via
|
||||||
ColourDesired cdf(fill.AsLong());
|
// pixel data object are committed before the bitmap is drawn.
|
||||||
int red = cdf.GetRed();
|
{
|
||||||
int green = cdf.GetGreen();
|
wxAlphaPixelData pixData(bmp);
|
||||||
int blue = cdf.GetBlue();
|
|
||||||
|
|
||||||
wxAlphaPixelData::Iterator p(pixData);
|
// Set the fill pixels
|
||||||
for (y=0; y<r.height; y++) {
|
ColourDesired cdf(fill.AsLong());
|
||||||
p.MoveTo(pixData, 0, y);
|
int red = cdf.GetRed();
|
||||||
for (x=0; x<r.width; x++) {
|
int green = cdf.GetGreen();
|
||||||
p.Red() = wxPy_premultiply(red, alphaFill);
|
int blue = cdf.GetBlue();
|
||||||
p.Green() = wxPy_premultiply(green, alphaFill);
|
|
||||||
p.Blue() = wxPy_premultiply(blue, alphaFill);
|
wxAlphaPixelData::Iterator p(pixData);
|
||||||
p.Alpha() = alphaFill;
|
for (y=0; y<r.height; y++) {
|
||||||
++p;
|
p.MoveTo(pixData, 0, y);
|
||||||
|
for (x=0; x<r.width; x++) {
|
||||||
|
p.Red() = wxPy_premultiply(red, alphaFill);
|
||||||
|
p.Green() = wxPy_premultiply(green, alphaFill);
|
||||||
|
p.Blue() = wxPy_premultiply(blue, alphaFill);
|
||||||
|
p.Alpha() = alphaFill;
|
||||||
|
++p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Set the outline pixels
|
// Set the outline pixels
|
||||||
ColourDesired cdo(outline.AsLong());
|
ColourDesired cdo(outline.AsLong());
|
||||||
red = cdo.GetRed();
|
red = cdo.GetRed();
|
||||||
green = cdo.GetGreen();
|
green = cdo.GetGreen();
|
||||||
blue = cdo.GetBlue();
|
blue = cdo.GetBlue();
|
||||||
for (x=0; x<r.width; x++) {
|
for (x=0; x<r.width; x++) {
|
||||||
p.MoveTo(pixData, x, 0);
|
p.MoveTo(pixData, x, 0);
|
||||||
p.Red() = wxPy_premultiply(red, alphaOutline);
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
p.Green() = wxPy_premultiply(green, alphaOutline);
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
p.Alpha() = alphaOutline;
|
p.Alpha() = alphaOutline;
|
||||||
p.MoveTo(pixData, x, r.height-1);
|
p.MoveTo(pixData, x, r.height-1);
|
||||||
p.Red() = wxPy_premultiply(red, alphaOutline);
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
p.Green() = wxPy_premultiply(green, alphaOutline);
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
p.Alpha() = alphaOutline;
|
p.Alpha() = alphaOutline;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y=0; y<r.height; y++) {
|
for (y=0; y<r.height; y++) {
|
||||||
p.MoveTo(pixData, 0, y);
|
p.MoveTo(pixData, 0, y);
|
||||||
p.Red() = wxPy_premultiply(red, alphaOutline);
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
p.Green() = wxPy_premultiply(green, alphaOutline);
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
p.Alpha() = alphaOutline;
|
p.Alpha() = alphaOutline;
|
||||||
p.MoveTo(pixData, r.width-1, y);
|
p.MoveTo(pixData, r.width-1, y);
|
||||||
p.Red() = wxPy_premultiply(red, alphaOutline);
|
p.Red() = wxPy_premultiply(red, alphaOutline);
|
||||||
p.Green() = wxPy_premultiply(green, alphaOutline);
|
p.Green() = wxPy_premultiply(green, alphaOutline);
|
||||||
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
p.Blue() = wxPy_premultiply(blue, alphaOutline);
|
||||||
p.Alpha() = alphaOutline;
|
p.Alpha() = alphaOutline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the bitmap
|
// Draw the bitmap
|
||||||
|
Reference in New Issue
Block a user