aboutsummaryrefslogtreecommitdiff
path: root/engines/prince/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/prince/graphics.cpp')
-rw-r--r--engines/prince/graphics.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp
index 593390ea56..fe7ea0bc99 100644
--- a/engines/prince/graphics.cpp
+++ b/engines/prince/graphics.cpp
@@ -117,17 +117,23 @@ void GraphicsMan::drawTransparentWithBlend(Graphics::Surface *screen, int32 posX
}
void GraphicsMan::drawTransparent(Graphics::Surface *screen, DrawNode *drawNode) {
+ byte *src1 = (byte *)drawNode->s->getBasePtr(0, 0);
+ byte *dst1 = (byte *)screen->getBasePtr(drawNode->posX, drawNode->posY);
+
for (int y = 0; y < drawNode->s->h; y++) {
- for (int x = 0; x < drawNode->s->w; x++) {
- byte pixel = *((byte*)drawNode->s->getBasePtr(x, y));
- if (pixel != 255) {
- if (x + drawNode->posX < screen->w && x + drawNode->posX >= 0) {
- if (y + drawNode->posY < screen->h && y + drawNode->posY >= 0) {
- *((byte*)screen->getBasePtr(x + drawNode->posX, y + drawNode->posY)) = pixel;
- }
- }
+ byte *src2 = src1;
+ byte *dst2 = dst1;
+ for (int x = 0; x < drawNode->s->w; x++, src2++, dst2++) {
+ if (*src2 != 255) {
+ if (x + drawNode->posX < screen->w && x + drawNode->posX >= 0) {
+ if (y + drawNode->posY < screen->h && y + drawNode->posY >= 0) {
+ *dst2 = *src2;
+ }
+ }
}
}
+ src1 += drawNode->s->pitch;
+ dst1 += screen->pitch;
}
}