diff options
Diffstat (limited to 'engines/sword25/gfx/image/renderedimage.cpp')
| -rw-r--r-- | engines/sword25/gfx/image/renderedimage.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index 81a29c727f..346b46f3b4 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -251,14 +251,10 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe // Create an encapsulating surface for the data Graphics::Surface srcImage; // TODO: Is the data really in the screen format? - srcImage.format = g_system->getScreenFormat(); - srcImage.pitch = _width * 4; - srcImage.w = _width; - srcImage.h = _height; - srcImage.pixels = _data; + srcImage.init(_width, _height, _width * 4, _data, g_system->getScreenFormat()); if (pPartRect) { - srcImage.pixels = &_data[pPartRect->top * srcImage.pitch + pPartRect->left * 4]; + srcImage.setPixels(&_data[pPartRect->top * srcImage.pitch + pPartRect->left * 4]); srcImage.w = pPartRect->right - pPartRect->left; srcImage.h = pPartRect->bottom - pPartRect->top; @@ -287,14 +283,14 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe if ((width != srcImage.w) || (height != srcImage.h)) { // Scale the image img = imgScaled = scale(srcImage, width, height); - savedPixels = (byte *)img->pixels; + savedPixels = (byte *)img->getPixels(); } else { img = &srcImage; } for (RectangleList::iterator it = updateRects->begin(); it != updateRects->end(); ++it) { const Common::Rect &clipRect = *it; - + int skipLeft = 0, skipTop = 0; int drawX = posX, drawY = posY; int drawWidth = img->w; @@ -306,7 +302,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe drawWidth -= skipLeft; drawX = clipRect.left; } - + if (drawY < clipRect.top) { skipTop = clipRect.top - drawY; drawHeight -= skipTop; @@ -315,13 +311,13 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe if (drawX + drawWidth >= clipRect.right) drawWidth = clipRect.right - drawX; - + if (drawY + drawHeight >= clipRect.bottom) drawHeight = clipRect.bottom - drawY; - + if ((drawWidth > 0) && (drawHeight > 0)) { int xp = 0, yp = 0; - + int inStep = 4; int inoStep = img->pitch; if (flipping & Image::FLIP_V) { @@ -330,14 +326,14 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe } else { xp = skipLeft; } - + if (flipping & Image::FLIP_H) { inoStep = -inoStep; yp = img->h - 1 - skipTop; } else { yp = skipTop; } - + byte *ino = (byte *)img->getBasePtr(xp, yp); byte *outo = (byte *)_backSurface->getBasePtr(drawX, drawY); @@ -351,7 +347,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe ino += inoStep; } } else -#endif +#endif { byte *in, *out; for (int i = 0; i < drawHeight; i++) { @@ -361,7 +357,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe uint32 pix = *(uint32 *)in; int a = (pix >> 24) & 0xff; in += inStep; - + if (ca != 255) { a = a * ca >> 8; } @@ -371,11 +367,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe out += 4; continue; } - + int b = (pix >> 0) & 0xff; int g = (pix >> 8) & 0xff; int r = (pix >> 16) & 0xff; - + if (a == 255) { #if defined(SCUMM_LITTLE_ENDIAN) if (cb != 255) @@ -460,11 +456,11 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe } } - + } if (imgScaled) { - imgScaled->pixels = savedPixels; + imgScaled->setPixels(savedPixels); imgScaled->free(); delete imgScaled; } |
