aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-21 20:17:52 +0000
committerEugene Sandulenko2010-10-12 23:11:41 +0000
commitfccc44851f68f9153a17fdc886f8e532213a6d5a (patch)
tree61ec1ac8bf082c08bf0dae2037f33148d1ade9d2 /engines
parentde0b8addc49f80e4e25c7f76e4b4514f52bcc0a3 (diff)
downloadscummvm-rg350-fccc44851f68f9153a17fdc886f8e532213a6d5a.tar.gz
scummvm-rg350-fccc44851f68f9153a17fdc886f8e532213a6d5a.tar.bz2
scummvm-rg350-fccc44851f68f9153a17fdc886f8e532213a6d5a.zip
SWORD25: Attempt to implement alpha blending. Code disabled.
svn-id: r53272
Diffstat (limited to 'engines')
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp32
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.cpp14
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 = &rect;
+ 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());
}