aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/graphics/transparent_surface.cpp
diff options
context:
space:
mode:
authorTobia Tesan2013-07-10 11:42:16 +0200
committerTobia Tesan2013-08-01 00:04:21 +0200
commit9f97ad6a3e9e10fa7164a4e545c1705896f77925 (patch)
tree5e6990f84f185d2e635c81eb9c36eaa268c7da14 /engines/wintermute/graphics/transparent_surface.cpp
parentf014cccb94e0b3244a3e6dca91db7ca7552e6d79 (diff)
downloadscummvm-rg350-9f97ad6a3e9e10fa7164a4e545c1705896f77925.tar.gz
scummvm-rg350-9f97ad6a3e9e10fa7164a4e545c1705896f77925.tar.bz2
scummvm-rg350-9f97ad6a3e9e10fa7164a4e545c1705896f77925.zip
WINTERMUTE: s/*transform/const &transform/
Diffstat (limited to 'engines/wintermute/graphics/transparent_surface.cpp')
-rw-r--r--engines/wintermute/graphics/transparent_surface.cpp87
1 files changed, 43 insertions, 44 deletions
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index 07c2537d0f..0ec0b84f25 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -496,10 +496,9 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
return retSize;
}
-TransparentSurface *TransparentSurface::rotoscale(TransformStruct *transform) const {
+TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transform) const {
- assert (transform);
- assert (transform->_angle != 0); // This would not be ideal
+ assert (transform._angle != 0); // This would not be ideal
Point32 newHotspot;
Common::Rect srcRect(0, 0, (int16)w, (int16)h);
@@ -514,43 +513,43 @@ TransparentSurface *TransparentSurface::rotoscale(TransformStruct *transform) co
target->create((uint16)dstW, (uint16)dstH, this->format);
- uint32 invAngle = (360 - transform->_angle) % 360;
+ 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;
- 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;
+#if ENABLE_BILINEAR
+ 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 = ((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;
- copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target);
- }
+ copyPixelBilinear(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;
+ }
+#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 = ((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;
- copyPixelBilinear(targX, targY, x, y, srcRect, dstRect, this, target);
- }
+ copyPixelNearestNeighbor(targX, targY, x, y, srcRect, dstRect, this, target);
}
}
+#endif
return target;
}
@@ -570,27 +569,27 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
target->create((uint16)dstW, (uint16)dstH, this->format);
- 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;
- copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target);
- }
+#if ENABLE_BILINEAR
+ 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;
+ copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target);
}
- } 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;
- copyPixelBilinear(projX, projY, x, y, srcRect, dstRect, this, target);
- }
+ }
+#else
+ 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;
+ copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target);
}
}
+#endif
return target;
}