[#1577388] - fix for scaling in wxImage.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -505,7 +505,7 @@ wxImage wxImage::Scale( int width, int height, int quality ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the original image has a mask, apply the mask to the new image
|
// If the original image has a mask, apply the mask to the new image
|
||||||
if (M_IMGDATA->m_hasMask)
|
if (M_IMGDATA->m_hasMask)
|
||||||
{
|
{
|
||||||
image.SetMaskColour( M_IMGDATA->m_maskRed,
|
image.SetMaskColour( M_IMGDATA->m_maskRed,
|
||||||
M_IMGDATA->m_maskGreen,
|
M_IMGDATA->m_maskGreen,
|
||||||
@@ -571,7 +571,7 @@ wxImage wxImage::ResampleBox(int width, int height) const
|
|||||||
averaged_pixels = 0;
|
averaged_pixels = 0;
|
||||||
sum_r = sum_g = sum_b = sum_a = 0.0;
|
sum_r = sum_g = sum_b = sum_a = 0.0;
|
||||||
|
|
||||||
for ( int j = src_y - scale_factor_y_2 + 1;
|
for ( int j = int(src_y - scale_factor_y/2.0 + 1);
|
||||||
j <= int(src_y + scale_factor_y_2);
|
j <= int(src_y + scale_factor_y_2);
|
||||||
j++ )
|
j++ )
|
||||||
{
|
{
|
||||||
@@ -579,7 +579,7 @@ wxImage wxImage::ResampleBox(int width, int height) const
|
|||||||
if ( j < 0 || j > M_IMGDATA->m_height )
|
if ( j < 0 || j > M_IMGDATA->m_height )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for ( int i = src_x - scale_factor_x_2 + 1;
|
for ( int i = int(src_x - scale_factor_x/2.0 + 1);
|
||||||
i <= src_x + scale_factor_x_2;
|
i <= src_x + scale_factor_x_2;
|
||||||
i++ )
|
i++ )
|
||||||
{
|
{
|
||||||
@@ -848,7 +848,7 @@ wxImage wxImage::BlurHorizontal(int blurRadius)
|
|||||||
sum_a += src_alpha[pixel_idx];
|
sum_a += src_alpha[pixel_idx];
|
||||||
|
|
||||||
// Save off the averaged data
|
// Save off the averaged data
|
||||||
dst = dst_data + x*3 + y*M_IMGDATA->m_width;
|
dst = dst_data + x*3 + y*M_IMGDATA->m_width*3;
|
||||||
dst[0] = (unsigned char)(sum_r / blurArea);
|
dst[0] = (unsigned char)(sum_r / blurArea);
|
||||||
dst[1] = (unsigned char)(sum_g / blurArea);
|
dst[1] = (unsigned char)(sum_g / blurArea);
|
||||||
dst[2] = (unsigned char)(sum_b / blurArea);
|
dst[2] = (unsigned char)(sum_b / blurArea);
|
||||||
|
Reference in New Issue
Block a user