No changes, just simplify the mask checks in wxImage::Paste().

Replace the test of the form "(!a && b) || (a && b)" with a simple test for
"b" and then also replace the test for "b || (c && !b)" with just "b || c".
The end result is much easier to read and understand.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67614 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-04-26 22:57:08 +00:00
parent be0d0fedf9
commit de83bbe34f

View File

@@ -1428,12 +1428,15 @@ void wxImage::Paste( const wxImage &image, int x, int y )
if (width < 1) return; if (width < 1) return;
if (height < 1) return; if (height < 1) return;
if ((!HasMask() && !image.HasMask()) || // If we can, copy the data using memcpy() as this is the fastest way. But
(HasMask() && !image.HasMask()) || // for this the image being pasted must have "compatible" mask with this
((HasMask() && image.HasMask() && // 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()) && (GetMaskRed()==image.GetMaskRed()) &&
(GetMaskGreen()==image.GetMaskGreen()) && (GetMaskGreen()==image.GetMaskGreen()) &&
(GetMaskBlue()==image.GetMaskBlue())))) (GetMaskBlue()==image.GetMaskBlue()))) )
{ {
const unsigned char* source_data = image.GetData() + 3*(xx + yy*image.GetWidth()); const unsigned char* source_data = image.GetData() + 3*(xx + yy*image.GetWidth());
int source_step = image.GetWidth()*3; int source_step = image.GetWidth()*3;