From: Robert Roebling Date: Tue, 29 Aug 2000 08:55:40 +0000 (+0000) Subject: Merged sizer fix from stable branch X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/aa21b5090ad75a806fe20b6371933302f67d821e Merged sizer fix from stable branch Added support for transparent wxImage::Paste() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/image.cpp b/src/common/image.cpp index d8117cb9da..903defa811 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -409,9 +409,36 @@ void wxImage::Paste( const wxImage &image, int x, int y ) source_data += source_step; target_data += target_step; } + return; } - else + + if (!HasMask() && image.HasMask()) { + unsigned char r = image.GetMaskRed(); + unsigned char g = image.GetMaskGreen(); + unsigned char b = image.GetMaskBlue(); + + width *= 3; + unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth(); + int source_step = image.GetWidth()*3; + + unsigned char* target_data = GetData() + (x+xx)*3 + (y+yy)*3*M_IMGDATA->m_width; + int target_step = M_IMGDATA->m_width*3; + + for (int j = 0; j < height; j++) + { + for (int i = 0; i < width; i+=3) + { + if ((source_data[i] != r) && + (source_data[i+1] != g) && + (source_data[i+2] != b)) + { + memcpy( target_data+i, source_data+i, 3 ); + } + } + source_data += source_step; + target_data += target_step; + } } } diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 0802fea039..a412637448 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -897,28 +897,22 @@ wxSize wxBoxSizer::CalcMin() { wxSizerItem *item = (wxSizerItem*) node->Data(); - int weight = 1; - if (item->GetOption()) - weight = item->GetOption(); - + m_stretchable += item->GetOption(); + wxSize size( item->CalcMin() ); if (m_orient == wxHORIZONTAL) { - m_minWidth += (size.x * weight); + m_minWidth += size.x; m_minHeight = wxMax( m_minHeight, size.y ); } else { - m_minHeight += (size.y * weight); + m_minHeight += size.y; m_minWidth = wxMax( m_minWidth, size.x ); } - if (item->GetOption()) - { - m_stretchable += weight; - } - else + if (item->GetOption() == 0) { if (m_orient == wxVERTICAL) { @@ -926,7 +920,7 @@ wxSize wxBoxSizer::CalcMin() m_fixedWidth = wxMax( m_fixedWidth, size.x ); } else - { + { m_fixedWidth += size.x; m_fixedHeight = wxMax( m_fixedHeight, size.y ); }