diff options
-rw-r--r-- | engines/sword25/gfx/opengl/glimage.cpp | 32 | ||||
-rw-r--r-- | engines/sword25/gfx/opengl/openglgfx.cpp | 14 |
2 files changed, 23 insertions, 23 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index ab1e15c229..22e15a4a7f 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -209,33 +209,37 @@ bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, un byte *ino = &_data[y1 * m_Width * 4 + x1 * 4]; byte *outo = (byte *)_backSurface->getBasePtr(PosX, PosY); byte *in, *out; - bool alphawarn = false; for (int i = 0; i < h; i++) { out = outo; in = ino; for (int j = 0; j < w; j++) { - if (*in == 0) { + switch (*in) { + case 0: // Full transparency in += 4; out += 4; - continue; + break; + case 255: // Full opacity + default: + *out++ = *in++; + *out++ = *in++; + *out++ = *in++; + *out++ = *in++; + break; +#if 0 + default: // alpha blending + *out++ = 255; + int alpha = *in++; + for (int c = 0; c < 3; c++, out++, in++) { + *out = (byte)((int)(*out - *in) * alpha + *in); + } +#endif } - - if (*in != 255) - alphawarn = true; - - *out++ = *in++; // TODO: alpha blending - *out++ = *in++; - *out++ = *in++; - *out++ = *in++; } outo += _backSurface->pitch; ino += m_Width * 4; } - if (alphawarn) - warning("STUB: alpha image"); - g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(PosX, PosY), _backSurface->pitch, PosX, PosY, w, h); return true; diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp index bc3f87e556..00c64ecbd6 100644 --- a/engines/sword25/gfx/opengl/openglgfx.cpp +++ b/engines/sword25/gfx/opengl/openglgfx.cpp @@ -213,18 +213,14 @@ bool OpenGLGfx::GetVsync() const { // ----------------------------------------------------------------------------- bool OpenGLGfx::Fill(const Common::Rect *fillRectPtr, unsigned int color) { - Common::Rect rect; - - if (!fillRectPtr) { - rect.left = 0; - rect.top = 0; - rect.right = m_Width - 1; - rect.bottom = m_Height - 1; - fillRectPtr = ▭ + Common::Rect rect(m_Width - 1, m_Height - 1); + + if (fillRectPtr) { + rect = *fillRectPtr; } if (fillRectPtr->width() > 0 && fillRectPtr->height() > 0) { - _backSurface.fillRect(*fillRectPtr, color); + _backSurface.fillRect(rect, color); g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(fillRectPtr->left, fillRectPtr->top), _backSurface.pitch, fillRectPtr->left, fillRectPtr->top, fillRectPtr->width(), fillRectPtr->height()); } |