mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Fix crash using negative numbers in Deskpeckle filter
This commit is contained in:
parent
3af0983022
commit
aa93666481
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -60,8 +60,14 @@ public:
|
||||
private:
|
||||
void onSizeChange()
|
||||
{
|
||||
m_filter.setSize(m_widthEntry->textInt(),
|
||||
m_heightEntry->textInt());
|
||||
gfx::Size newSize(m_widthEntry->textInt(),
|
||||
m_heightEntry->textInt());
|
||||
|
||||
// Avoid negative numbers
|
||||
newSize.w = MAX(1, newSize.w);
|
||||
newSize.h = MAX(1, newSize.h);
|
||||
|
||||
m_filter.setSize(newSize.w, newSize.h);
|
||||
restartPreview();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -90,8 +90,8 @@ namespace {
|
||||
|
||||
MedianFilter::MedianFilter()
|
||||
: m_tiledMode(TiledMode::NONE)
|
||||
, m_width(0)
|
||||
, m_height(0)
|
||||
, m_width(1)
|
||||
, m_height(1)
|
||||
, m_ncolors(0)
|
||||
, m_channel(4)
|
||||
{
|
||||
@ -104,8 +104,11 @@ void MedianFilter::setTiledMode(TiledMode tiled)
|
||||
|
||||
void MedianFilter::setSize(int width, int height)
|
||||
{
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
ASSERT(width >= 1);
|
||||
ASSERT(height >= 1);
|
||||
|
||||
m_width = MAX(1, width);
|
||||
m_height = MAX(1, height);
|
||||
m_ncolors = width*height;
|
||||
|
||||
for (int c = 0; c < 4; ++c)
|
||||
|
Loading…
x
Reference in New Issue
Block a user