[Scummvm-cvs-logs] SF.net SVN: scummvm:[52950] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Thu Sep 30 15:03:51 CEST 2010
Revision: 52950
http://scummvm.svn.sourceforge.net/scummvm/?rev=52950&view=rev
Author: drmccoy
Date: 2010-09-30 13:03:51 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
GOB: Transparency support for 16bit surfaces
Modified Paths:
--------------
scummvm/trunk/engines/gob/surface.cpp
scummvm/trunk/engines/gob/surface.h
Modified: scummvm/trunk/engines/gob/surface.cpp
===================================================================
--- scummvm/trunk/engines/gob/surface.cpp 2010-09-30 13:03:22 UTC (rev 52949)
+++ scummvm/trunk/engines/gob/surface.cpp 2010-09-30 13:03:51 UTC (rev 52950)
@@ -259,7 +259,7 @@
}
void Surface::blit(const Surface &from, int16 left, int16 top, int16 right, int16 bottom,
- int16 x, int16 y, int16 transp) {
+ int16 x, int16 y, int32 transp) {
// Color depths have to fit
assert(_bpp == from._bpp);
@@ -276,20 +276,24 @@
// Nothing to do
return;
- // Pointers to the blit destination and source start points
- byte *dst = getData(x , y);
- const byte *src = from.getData(left, top);
-
- if ((left == 0) && (_width == from._width) && (_width == width) && ((_bpp != 1) || (transp < 0))) {
+ if ((left == 0) && (_width == from._width) && (_width == width) && (transp == -1)) {
// If these conditions are met, we can directly use memcpy
+ // Pointers to the blit destination and source start points
+ byte *dst = getData(x , y);
+ const byte *src = from.getData(left, top);
+
memcpy(dst, src, width * height * _bpp);
return;
}
- if ((_bpp != 1) || (transp < 0)) {
+ if (transp == -1) {
// We don't have to look for transparency => we can use memcpy line-wise
+ // Pointers to the blit destination and source start points
+ byte *dst = getData(x , y);
+ const byte *src = from.getData(left, top);
+
while (height-- > 0) {
memcpy(dst, src, width * _bpp);
@@ -300,33 +304,35 @@
return;
}
- assert(_bpp == 1);
-
// Otherwise, we have to copy by pixel
+ // Pointers to the blit destination and source start points
+ Pixel dst = get(x , y);
+ ConstPixel src = from.get(left, top);
+
while (height-- > 0) {
- byte *dstRow = dst;
- const byte *srcRow = src;
+ Pixel dstRow = dst;
+ ConstPixel srcRow = src;
for (uint16 i = 0; i < width; i++, dstRow++, srcRow++)
- if (*srcRow != transp)
- *dstRow = *srcRow;
+ if (srcRow.get() != ((uint32) transp))
+ dstRow.set(srcRow.get());
dst += _width;
src += from._width;
}
}
-void Surface::blit(const Surface &from, int16 x, int16 y, int16 transp) {
+void Surface::blit(const Surface &from, int16 x, int16 y, int32 transp) {
blit(from, 0, 0, from._width - 1, from._height - 1, x, y, transp);
}
-void Surface::blit(const Surface &from, int16 transp) {
+void Surface::blit(const Surface &from, int32 transp) {
blit(from, 0, 0, from._width - 1, from._height - 1, 0, 0, transp);
}
void Surface::blitScaled(const Surface &from, int16 left, int16 top, int16 right, int16 bottom,
- int16 x, int16 y, Common::Rational scale, int16 transp) {
+ int16 x, int16 y, Common::Rational scale, int32 transp) {
if (scale == 1) {
// Yeah, "scaled"
@@ -390,11 +396,11 @@
}
-void Surface::blitScaled(const Surface &from, int16 x, int16 y, Common::Rational scale, int16 transp) {
+void Surface::blitScaled(const Surface &from, int16 x, int16 y, Common::Rational scale, int32 transp) {
blitScaled(from, 0, 0, from._width - 1, from._height - 1, x, y, scale, transp);
}
-void Surface::blitScaled(const Surface &from, Common::Rational scale, int16 transp) {
+void Surface::blitScaled(const Surface &from, Common::Rational scale, int32 transp) {
blitScaled(from, 0, 0, from._width - 1, from._height - 1, 0, 0, scale, transp);
}
Modified: scummvm/trunk/engines/gob/surface.h
===================================================================
--- scummvm/trunk/engines/gob/surface.h 2010-09-30 13:03:22 UTC (rev 52949)
+++ scummvm/trunk/engines/gob/surface.h 2010-09-30 13:03:51 UTC (rev 52950)
@@ -93,14 +93,14 @@
ConstPixel get(uint16 x = 0, uint16 y = 0) const;
void blit(const Surface &from, int16 left, int16 top, int16 right, int16 bottom,
- int16 x, int16 y, int16 transp = -1);
- void blit(const Surface &from, int16 x, int16 y, int16 transp = -1);
- void blit(const Surface &from, int16 transp = -1);
+ int16 x, int16 y, int32 transp = -1);
+ void blit(const Surface &from, int16 x, int16 y, int32 transp = -1);
+ void blit(const Surface &from, int32 transp = -1);
void blitScaled(const Surface &from, int16 left, int16 top, int16 right, int16 bottom,
- int16 x, int16 y, Common::Rational scale, int16 transp = -1);
- void blitScaled(const Surface &from, int16 x, int16 y, Common::Rational scale, int16 transp = -1);
- void blitScaled(const Surface &from, Common::Rational scale, int16 transp = -1);
+ int16 x, int16 y, Common::Rational scale, int32 transp = -1);
+ void blitScaled(const Surface &from, int16 x, int16 y, Common::Rational scale, int32 transp = -1);
+ void blitScaled(const Surface &from, Common::Rational scale, int32 transp = -1);
void fillRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color);
void fill(uint32 color);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list