copy both alpha and mask in Paste() (#9658)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54935 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1270,7 +1270,6 @@ void wxImage::Paste( const wxImage &image, int x, int y )
|
|||||||
(GetMaskGreen()==image.GetMaskGreen()) &&
|
(GetMaskGreen()==image.GetMaskGreen()) &&
|
||||||
(GetMaskBlue()==image.GetMaskBlue()))))
|
(GetMaskBlue()==image.GetMaskBlue()))))
|
||||||
{
|
{
|
||||||
width *= 3;
|
|
||||||
unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth();
|
unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth();
|
||||||
int source_step = image.GetWidth()*3;
|
int source_step = image.GetWidth()*3;
|
||||||
|
|
||||||
@@ -1278,11 +1277,10 @@ void wxImage::Paste( const wxImage &image, int x, int y )
|
|||||||
int target_step = M_IMGDATA->m_width*3;
|
int target_step = M_IMGDATA->m_width*3;
|
||||||
for (int j = 0; j < height; j++)
|
for (int j = 0; j < height; j++)
|
||||||
{
|
{
|
||||||
memcpy( target_data, source_data, width );
|
memcpy( target_data, source_data, width*3 );
|
||||||
source_data += source_step;
|
source_data += source_step;
|
||||||
target_data += target_step;
|
target_data += target_step;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy over the alpha channel from the original image
|
// Copy over the alpha channel from the original image
|
||||||
@@ -1311,7 +1309,6 @@ void wxImage::Paste( const wxImage &image, int x, int y )
|
|||||||
unsigned char g = image.GetMaskGreen();
|
unsigned char g = image.GetMaskGreen();
|
||||||
unsigned char b = image.GetMaskBlue();
|
unsigned char b = image.GetMaskBlue();
|
||||||
|
|
||||||
width *= 3;
|
|
||||||
unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth();
|
unsigned char* source_data = image.GetData() + xx*3 + yy*3*image.GetWidth();
|
||||||
int source_step = image.GetWidth()*3;
|
int source_step = image.GetWidth()*3;
|
||||||
|
|
||||||
@@ -1320,7 +1317,7 @@ void wxImage::Paste( const wxImage &image, int x, int y )
|
|||||||
|
|
||||||
for (int j = 0; j < height; j++)
|
for (int j = 0; j < height; j++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < width; i+=3)
|
for (int i = 0; i < width*3; i+=3)
|
||||||
{
|
{
|
||||||
if ((source_data[i] != r) ||
|
if ((source_data[i] != r) ||
|
||||||
(source_data[i+1] != g) ||
|
(source_data[i+1] != g) ||
|
||||||
|
Reference in New Issue
Block a user