Support transparency and masks under macOS / Cairo
This commit is contained in:
@@ -1445,7 +1445,7 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
|
|||||||
isSrcBpp32
|
isSrcBpp32
|
||||||
#elif defined(__WXGTK3__)
|
#elif defined(__WXGTK3__)
|
||||||
isSrcBpp32 || bmp.GetMask() != NULL
|
isSrcBpp32 || bmp.GetMask() != NULL
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__) || defined(__WXOSX__)
|
||||||
(isSrcBpp32 && bmp.HasAlpha()) || bmp.GetMask() != NULL
|
(isSrcBpp32 && bmp.HasAlpha()) || bmp.GetMask() != NULL
|
||||||
#else
|
#else
|
||||||
isSrcBpp32
|
isSrcBpp32
|
||||||
@@ -1538,7 +1538,7 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__) || defined(__WXGTK3__)
|
#if defined(__WXMSW__) || defined(__WXGTK3__) || defined(__WXOSX__)
|
||||||
// if there is a mask, set the alpha bytes in the target buffer to
|
// if there is a mask, set the alpha bytes in the target buffer to
|
||||||
// fully transparent or fully opaque
|
// fully transparent or fully opaque
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
@@ -1559,7 +1559,12 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
|
|||||||
wxUint32* const rowStartDst = data;
|
wxUint32* const rowStartDst = data;
|
||||||
for (int x=0; x < pixData.GetWidth(); x++)
|
for (int x=0; x < pixData.GetWidth(); x++)
|
||||||
{
|
{
|
||||||
|
// contrary to the others OSX has natively its masked out pixels as white
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
if (p.Red() == 0xFF && p.Green() == 0xFF && p.Blue() == 0xFF )
|
||||||
|
#else
|
||||||
if (p.Red()+p.Green()+p.Blue() == 0)
|
if (p.Red()+p.Green()+p.Blue() == 0)
|
||||||
|
#endif
|
||||||
*data = 0;
|
*data = 0;
|
||||||
else
|
else
|
||||||
*data = (wxALPHA_OPAQUE << 24) | (*data & 0x00FFFFFF);
|
*data = (wxALPHA_OPAQUE << 24) | (*data & 0x00FFFFFF);
|
||||||
|
Reference in New Issue
Block a user