From 9d19d77e9c7f10d79efb4f93a3154d4a06595830 Mon Sep 17 00:00:00 2001 From: Ian Macphail Date: Mon, 15 Apr 2013 10:43:40 +0100 Subject: [PATCH] Reduce stack load times due to image loading --- engine/src/image.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engine/src/image.cpp b/engine/src/image.cpp index 65db673010c..9421736ce2e 100644 --- a/engine/src/image.cpp +++ b/engine/src/image.cpp @@ -524,7 +524,11 @@ void MCImage::setrect(const MCRectangle &nrect) if (!(state & CS_SIZE) || !(state & CS_EDITED)) { - apply_transform(); + // IM-2013-04-15: [[ BZ 10827 ]] if the image has rotation then apply_transform() + // will reset the rect otherwise it will stay as set, in which case we can avoid + // the call to apply_transform() and any costly image loading that might cause + if (angle != 0) + apply_transform(); if ((rect.width != orect.width || rect.height != orect.height) && m_rep != nil) { layer_rectchanged(orect, true); @@ -2035,7 +2039,9 @@ void MCImage::setrep(MCImageRep *p_rep) } // IM-2013-03-11: [[ BZ 10723 ]] If we have a new image, ensure that the current frame falls within the new framecount - setframe(currentframe); + // IM-2013-04-15: [[ BZ 10827 ]] Skip this check if the currentframe is 0 (preventing unnecessary image loading) + if (currentframe != 0) + setframe(currentframe); notifyneeds(false); }