avoid calls to fixAspectRatio() if current dimensions == dimension being set
This commit is contained in:
parent
eebc8cc73e
commit
1ae4a03f68
1 changed files with 12 additions and 4 deletions
16
src/map.cpp
16
src/map.cpp
|
@ -238,7 +238,9 @@ unsigned Map::height() const
|
||||||
|
|
||||||
void Map::set_width(unsigned width)
|
void Map::set_width(unsigned width)
|
||||||
{
|
{
|
||||||
if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE)
|
if (width != width_ &&
|
||||||
|
width >= MIN_MAPSIZE &&
|
||||||
|
width <= MAX_MAPSIZE)
|
||||||
{
|
{
|
||||||
width_=width;
|
width_=width;
|
||||||
fixAspectRatio();
|
fixAspectRatio();
|
||||||
|
@ -247,7 +249,9 @@ void Map::set_width(unsigned width)
|
||||||
|
|
||||||
void Map::set_height(unsigned height)
|
void Map::set_height(unsigned height)
|
||||||
{
|
{
|
||||||
if (height >= MIN_MAPSIZE && height <= MAX_MAPSIZE)
|
if (height != height_ &&
|
||||||
|
height >= MIN_MAPSIZE &&
|
||||||
|
height <= MAX_MAPSIZE)
|
||||||
{
|
{
|
||||||
height_=height;
|
height_=height;
|
||||||
fixAspectRatio();
|
fixAspectRatio();
|
||||||
|
@ -256,8 +260,12 @@ void Map::set_height(unsigned height)
|
||||||
|
|
||||||
void Map::resize(unsigned width,unsigned height)
|
void Map::resize(unsigned width,unsigned height)
|
||||||
{
|
{
|
||||||
if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE &&
|
if (width != width_ &&
|
||||||
height >= MIN_MAPSIZE && height <= MAX_MAPSIZE)
|
height != height_ &&
|
||||||
|
width >= MIN_MAPSIZE &&
|
||||||
|
width <= MAX_MAPSIZE &&
|
||||||
|
height >= MIN_MAPSIZE &&
|
||||||
|
height <= MAX_MAPSIZE)
|
||||||
{
|
{
|
||||||
width_=width;
|
width_=width;
|
||||||
height_=height;
|
height_=height;
|
||||||
|
|
Loading…
Reference in a new issue