X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be0d0fedf936869e554b1335ac423a71c9750fe9..c81394808bf7efd84e4294e44a9a9a7b7f6dd8a9:/src/common/image.cpp?ds=inline diff --git a/src/common/image.cpp b/src/common/image.cpp index 4e4860d9c2..de87a34257 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1428,12 +1428,15 @@ void wxImage::Paste( const wxImage &image, int x, int y ) if (width < 1) return; if (height < 1) return; - if ((!HasMask() && !image.HasMask()) || - (HasMask() && !image.HasMask()) || - ((HasMask() && image.HasMask() && + // If we can, copy the data using memcpy() as this is the fastest way. But + // for this the image being pasted must have "compatible" mask with this + // one meaning that either it must not have one at all or it must use the + // same masked colour. + if ( !image.HasMask() || + ((HasMask() && (GetMaskRed()==image.GetMaskRed()) && (GetMaskGreen()==image.GetMaskGreen()) && - (GetMaskBlue()==image.GetMaskBlue())))) + (GetMaskBlue()==image.GetMaskBlue()))) ) { const unsigned char* source_data = image.GetData() + 3*(xx + yy*image.GetWidth()); int source_step = image.GetWidth()*3;