avoid calls to fixAspectRatio() if current dimensions == dimension being set

This commit is contained in:
Dane Springmeyer 2012-11-11 21:48:51 -08:00
parent eebc8cc73e
commit 1ae4a03f68

View file

@ -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;