Restore handling of XPMs with a mask in wxStyledTextCtrl
Fix XPM to RGBA conversion code for Scintilla markers to handle mask correctly. Closes #18374.
This commit is contained in:
committed by
Vadim Zeitlin
parent
a15004fc5f
commit
211b81f459
@@ -1346,12 +1346,32 @@ void ScintillaWX::DoMarkerDefineBitmap(int markerNumber, const wxBitmap& bmp) {
|
|||||||
wxImage img = bmp.ConvertToImage();
|
wxImage img = bmp.ConvertToImage();
|
||||||
int curRGBALoc = 0, curDataLoc = 0, curAlphaLoc = 0;
|
int curRGBALoc = 0, curDataLoc = 0, curAlphaLoc = 0;
|
||||||
|
|
||||||
for ( int i = 0; i < totalPixels; ++i ) {
|
if ( img.HasMask() ) {
|
||||||
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
for ( int y = 0; y < bmp.GetHeight(); ++y ) {
|
||||||
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
for ( int x = 0 ; x < bmp.GetWidth(); ++x ) {
|
||||||
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
rgba[curRGBALoc++] =
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
img.HasAlpha() ? img.GetAlpha()[curAlphaLoc++] : wxALPHA_OPAQUE ;
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.IsTransparent(x,y)
|
||||||
|
? wxALPHA_TRANSPARENT : wxALPHA_OPAQUE ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( img.HasAlpha() ) {
|
||||||
|
for ( int i = 0; i < totalPixels; ++i ) {
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetAlpha()[curAlphaLoc++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for ( int i = 0; i < totalPixels; ++i ) {
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = img.GetData()[curDataLoc++];
|
||||||
|
rgba[curRGBALoc++] = wxALPHA_OPAQUE ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now follow the same procedure used for handling the
|
// Now follow the same procedure used for handling the
|
||||||
|
Reference in New Issue
Block a user