From cbe304c3aefd4b409fc01f4e7d393bf1878a0564 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 8 Sep 2010 11:32:05 +0000 Subject: SWORD25: Implement transparent bg color for images svn-id: r53336 --- engines/sword25/gfx/opengl/glimage.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'engines/sword25/gfx') diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp index 9feeb4e380..31a52fbed7 100644 --- a/engines/sword25/gfx/opengl/glimage.cpp +++ b/engines/sword25/gfx/opengl/glimage.cpp @@ -213,13 +213,21 @@ bool GLImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRect, ui img = &srcImage; } - if ((color & 0xff000000) != 0xff000000) { - warning("STUB: Image transparent bg color: %x", color); - } + int ca = (color >> 24) & 0xff; int cr = (color >> 16) & 0xff; int cg = (color >> 8) & 0xff; int cb = (color >> 0) & 0xff; + // Check if we need to draw anything at all + if (ca == 0) + return true; + + if (ca != 255) { + cr = cr * ca >> 8; + cg = cg * ca >> 8; + cb = cb * ca >> 8; + } + // Handle off-screen clipping if (posY < 0) { img->h -= -posY; -- cgit v1.2.3