diff --git a/docs/changes.txt b/docs/changes.txt index a96e0b3226..3e5d3fe8a5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -598,6 +598,7 @@ All (GUI): - Make wxFILTER_INCLUDE_LIST in wxTextValidator actually usable. - Make wxHTML more efficient when displaying large tables (Kinaou Hervé). - Prevent wxGrid rows/columns from becoming too small on double click. +- Fix wxGraphicsBitmap::ConvertToImage() when using Cairo. wxGTK: diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index c89d338f51..767bd09ec6 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1569,12 +1569,13 @@ wxImage wxCairoBitmapData::ConvertToImage() const { const wxUint32 argb = *src++; - *alpha++ = (argb & 0xff000000) >> 24; + const unsigned char a = argb >> 24; + *alpha++ = a; // Copy the RGB data undoing the pre-multiplication. - *dst++ = Unpremultiply(*alpha, (argb & 0x00ff0000) >> 16); - *dst++ = Unpremultiply(*alpha, (argb & 0x0000ff00) >> 8); - *dst++ = Unpremultiply(*alpha, (argb & 0x000000ff)); + *dst++ = Unpremultiply(a, argb >> 16); + *dst++ = Unpremultiply(a, argb >> 8); + *dst++ = Unpremultiply(a, argb); } src = rowStart + stride;