diff options
author | Tobia Tesan | 2013-06-27 17:25:46 +0200 |
---|---|---|
committer | Tobia Tesan | 2013-08-01 00:02:48 +0200 |
commit | e30ab15bb0f21a77f8e1752745cd6ec954661d83 (patch) | |
tree | e5e6efb28d75c7e69220f11a8720f008046b40e5 /engines/wintermute | |
parent | 321c7f071668025b1c9bb16e28a70c29843e45de (diff) | |
download | scummvm-rg350-e30ab15bb0f21a77f8e1752745cd6ec954661d83.tar.gz scummvm-rg350-e30ab15bb0f21a77f8e1752745cd6ec954661d83.tar.bz2 scummvm-rg350-e30ab15bb0f21a77f8e1752745cd6ec954661d83.zip |
WINTERMUTE: Move if() outside transform loop
Diffstat (limited to 'engines/wintermute')
-rw-r--r-- | engines/wintermute/graphics/transparent_surface.cpp | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 3f64305487..403ce8984e 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -513,25 +513,41 @@ TransparentSurface *TransparentSurface::rotate(TransformStruct transform) const uint32 invAngle = (360 - transform._angle) % 360; float invCos = cos(invAngle * M_PI / 180.0); float invSin = sin(invAngle * M_PI / 180.0); + float targX; + float targY; - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - int x1 = x - newHotspot.x; - int y1 = y - newHotspot.y; + if (FAST_TRANSFORM) { + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; - float targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; - float targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; - targX += transform._hotspot.x; - targY += transform._hotspot.y; + targX += transform._hotspot.x; + targY += transform._hotspot.y; - if (FAST_TRANSFORM) { nearestCopy(targX, targY, x, y, srcRect, dstRect, this, target); - } else { - bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); + } + } + } else { + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + int x1 = x - newHotspot.x; + int y1 = y - newHotspot.y; + + targX = ((x1 * invCos - y1 * invSin)) * 100.0 / transform._zoom.x + srcRect.left; + targY = ((x1 * invSin + y1 * invCos)) * 100.0 / transform._zoom.y + srcRect.top; + + targX += transform._hotspot.x; + targY += transform._hotspot.y; + + bilinearCopy(targX, targY, x, y, srcRect, dstRect, this, target); } } } + return target; } @@ -550,13 +566,23 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) target->create((uint16)dstW, (uint16)dstH, this->format); - for (int y = 0; y < dstH; y++) { - for (int x = 0; x < dstW; x++) { - float projX = x / (float)dstW * srcW; - float projY = y / (float)dstH * srcH; - if (FAST_TRANSFORM) { + if (FAST_TRANSFORM) { + int projX; + int projY; + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + projX = x / dstW * srcW; + projY = y / dstH * srcH; nearestCopy(projX, projY, x, y, srcRect, dstRect, this, target); - } else { + } + } + } else { + float projX; + float projY; + for (int y = 0; y < dstH; y++) { + for (int x = 0; x < dstW; x++) { + projX = x / (float)dstW * srcW; + projY = y / (float)dstH * srcH; bilinearCopy(projX, projY, x, y, srcRect, dstRect, this, target); } } |