diff options
author | Tobia Tesan | 2013-07-16 22:08:40 +0200 |
---|---|---|
committer | Tobia Tesan | 2013-08-01 02:10:42 +0200 |
commit | 381df0c64ac88a704f931b0011d7f3f730c5caba (patch) | |
tree | 8c5ac4168c5912acc1cd56daa4cb05d2b5cf0a65 /engines/wintermute | |
parent | 567cd1eb123357fe474066fd73328bb2aeab42ca (diff) | |
download | scummvm-rg350-381df0c64ac88a704f931b0011d7f3f730c5caba.tar.gz scummvm-rg350-381df0c64ac88a704f931b0011d7f3f730c5caba.tar.bz2 scummvm-rg350-381df0c64ac88a704f931b0011d7f3f730c5caba.zip |
WINTERMUTE: Various explicit casts
* for floor/ceil output in transform_tools.cpp
* for projX/Y in transparent_surface.cpp
* in transpaprent_surface.cpp
Diffstat (limited to 'engines/wintermute')
-rw-r--r-- | engines/wintermute/graphics/transform_tools.cpp | 12 | ||||
-rw-r--r-- | engines/wintermute/graphics/transparent_surface.cpp | 16 |
2 files changed, 14 insertions, 14 deletions
diff --git a/engines/wintermute/graphics/transform_tools.cpp b/engines/wintermute/graphics/transform_tools.cpp index 73f48402f4..ff90707615 100644 --- a/engines/wintermute/graphics/transform_tools.cpp +++ b/engines/wintermute/graphics/transform_tools.cpp @@ -60,13 +60,13 @@ namespace Wintermute { float right = MAX(nw1.x, MAX(ne1.x, MAX(sw1.x, se1.x))); Rect32 res; - newHotspot->y = -floor(top); - newHotspot->x = -floor(left); + newHotspot->y = (uint32)(-floor(top)); + newHotspot->x = (uint32)(-floor(left)); - res.top = floor(top) + transform._hotspot.y; - res.bottom = ceil(bottom) + transform._hotspot.y; - res.left = floor(left) + transform._hotspot.x; - res.right = ceil(right) + transform._hotspot.x; + res.top = (int32)(floor(top)) + transform._hotspot.y; + res.bottom = (int32)(ceil(bottom)) + transform._hotspot.y; + res.left = (int32)(floor(left)) + transform._hotspot.x; + res.right = (int32)(ceil(right)) + transform._hotspot.x; return res; } diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 7aa25d1502..49ac2bdc5a 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -45,7 +45,7 @@ void TransparentSurface::copyPixelNearestNeighbor(float projX, float projY, int if (projX >= srcW || projX < 0 || projY >= srcH || projY < 0) { color = 0; } else { - color = READ_UINT32((const byte *)src->getBasePtr(projX, projY)); + color = READ_UINT32((const byte *)src->getBasePtr((int)projX, (int)projY)); } WRITE_UINT32((byte *)dst->getBasePtr(dstX, dstY), color); @@ -71,25 +71,25 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i if (x1 >= srcW || x1 < 0 || y1 >= srcH || y1 < 0) { Q11 = 0; } else { - Q11 = READ_UINT32((const byte *)src->getBasePtr(x1 + srcRect.left, y1 + srcRect.top)); + Q11 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left),(int)(y1 + srcRect.top))); } if (x1 >= srcW || x1 < 0 || y2 >= srcH || y2 < 0) { Q12 = 0; } else { - Q12 = READ_UINT32((const byte *)src->getBasePtr(x1 + srcRect.left, y2 + srcRect.top)); + Q12 = READ_UINT32((const byte *)src->getBasePtr((int)(x1 + srcRect.left), (int)(y2 + srcRect.top))); } if (x2 >= srcW || x2 < 0 || y1 >= srcH || y1 < 0) { Q21 = 0; } else { - Q21 = READ_UINT32((const byte *)src->getBasePtr(x2 + srcRect.left, y1 + srcRect.top)); + Q21 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y1 + srcRect.top))); } if (x2 >= srcW || x2 < 0 || y2 >= srcH || y2 < 0) { Q22 = 0; } else { - Q22 = READ_UINT32((const byte *)src->getBasePtr(x2 + srcRect.left, y2 + srcRect.top)); + Q22 = READ_UINT32((const byte *)src->getBasePtr((int)(x2 + srcRect.left), (int)(y2 + srcRect.top))); } byte *Q11s = (byte *)&Q11; @@ -124,7 +124,7 @@ void TransparentSurface::copyPixelBilinear(float projX, float projY, int dstX, i } for (int c = 0; c < 4; c++) { - dest[c] = ( + dest[c] = (byte)( ((float)Q11s[c]) * q11x * q11y + ((float)Q21s[c]) * q21x * q21y + ((float)Q12s[c]) * q12x * q12y + @@ -580,8 +580,8 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight) int 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; + projX = (int)(x / (float)dstW * srcW); + projY = (int)(y / (float)dstH * srcH); copyPixelNearestNeighbor(projX, projY, x, y, srcRect, dstRect, this, target); } } |