From 1ae4a03f68e5f2025c6048645fa71f8e5c712460 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 11 Nov 2012 21:48:51 -0800 Subject: [PATCH] avoid calls to fixAspectRatio() if current dimensions == dimension being set --- src/map.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index e1ffc2550..0ce43a573 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -238,7 +238,9 @@ unsigned Map::height() const void Map::set_width(unsigned width) { - if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE) + if (width != width_ && + width >= MIN_MAPSIZE && + width <= MAX_MAPSIZE) { width_=width; fixAspectRatio(); @@ -247,7 +249,9 @@ void Map::set_width(unsigned width) void Map::set_height(unsigned height) { - if (height >= MIN_MAPSIZE && height <= MAX_MAPSIZE) + if (height != height_ && + height >= MIN_MAPSIZE && + height <= MAX_MAPSIZE) { height_=height; fixAspectRatio(); @@ -256,8 +260,12 @@ void Map::set_height(unsigned height) void Map::resize(unsigned width,unsigned height) { - if (width >= MIN_MAPSIZE && width <= MAX_MAPSIZE && - height >= MIN_MAPSIZE && height <= MAX_MAPSIZE) + if (width != width_ && + height != height_ && + width >= MIN_MAPSIZE && + width <= MAX_MAPSIZE && + height >= MIN_MAPSIZE && + height <= MAX_MAPSIZE) { width_=width; height_=height;