Avoid division-by-zero in wxImage::Paste()
See #23791. (cherry picked from commit 496a9a40a1853376d877a017a2b6b79b6d6b5f71)
This commit is contained in:
parent
2d3f193827
commit
60fe5c83a6
@ -269,6 +269,7 @@ All (GUI):
|
||||
- Keep wxProgressDialog size when updating the message (Oleg Samarin, #23727).
|
||||
- Fix crash when deleting selected item in wxGenericListCtrl (#23729).
|
||||
- Use DIPs for toolbar image sizes in wxPropertyGrid.
|
||||
- Fix undefined behaviour in wxImage::Paste() (aurel32, #23791).
|
||||
|
||||
wxGTK:
|
||||
|
||||
|
@ -1740,6 +1740,14 @@ wxImage::Paste(const wxImage & image, int x, int y,
|
||||
float light_left = (alpha_target_data[i] / 255.0f) * (1.0f - source_alpha);
|
||||
float result_alpha = source_alpha + light_left;
|
||||
alpha_target_data[i] = (unsigned char)((result_alpha * 255) + 0.5f);
|
||||
if (result_alpha <= 0)
|
||||
{
|
||||
int c = 3 * i;
|
||||
target_data[c++] = 0;
|
||||
target_data[c++] = 0;
|
||||
target_data[c] = 0;
|
||||
continue;
|
||||
}
|
||||
for (int c = 3 * i; c < 3 * (i + 1); c++)
|
||||
{
|
||||
target_data[c] =
|
||||
|
Loading…
Reference in New Issue
Block a user