diff options
author | lukaslw | 2014-06-10 14:29:06 +0200 |
---|---|---|
committer | lukaslw | 2014-06-22 20:08:56 +0200 |
commit | 1c02028ddd647d829f61d95ec964d46d7a0d180f (patch) | |
tree | 28f25ccfad1e7acf1a504ddcd86744f779c7fea3 /engines/prince | |
parent | f4f09efa5fefb9c05edaf95b68938530f5b9f5d2 (diff) | |
download | scummvm-rg350-1c02028ddd647d829f61d95ec964d46d7a0d180f.tar.gz scummvm-rg350-1c02028ddd647d829f61d95ec964d46d7a0d180f.tar.bz2 scummvm-rg350-1c02028ddd647d829f61d95ec964d46d7a0d180f.zip |
PRINCE: draw(), drawTransparentDrawNode() update
Diffstat (limited to 'engines/prince')
-rw-r--r-- | engines/prince/graphics.cpp | 23 | ||||
-rw-r--r-- | engines/prince/graphics.h | 4 |
2 files changed, 18 insertions, 9 deletions
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index 54861dfba6..4f80c8cbe3 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -67,28 +67,37 @@ void GraphicsMan::change() { _changed = true; } -void GraphicsMan::draw(Graphics::Surface *screen, uint16 posX, uint16 posY, const Graphics::Surface *s) { +void GraphicsMan::draw(Graphics::Surface *screen, const Graphics::Surface *s) { uint16 w = MIN(screen->w, s->w); + byte *src = (byte *)s->getBasePtr(0, 0); + byte *dst = (byte *)screen->getBasePtr(0, 0); for (uint y = 0; y < s->h; y++) { if (y < screen->h) { - memcpy((byte*)screen->getBasePtr(0, y), (byte*)s->getBasePtr(0, y), w); + memcpy(dst, src, w); } + src += s->pitch; + dst += screen->pitch; } change(); } void GraphicsMan::drawTransparentSurface(Graphics::Surface *screen, int32 posX, int32 posY, const Graphics::Surface *s, int transColor) { + byte *src1 = (byte *)s->getBasePtr(0, 0); + byte *dst1 = (byte *)screen->getBasePtr(posX, posY); for (int y = 0; y < s->h; y++) { - for (int x = 0; x < s->w; x++) { - byte pixel = *((byte*)s->getBasePtr(x, y)); - if (pixel != transColor) { + byte *src2 = src1; + byte *dst2 = dst1; + for (int x = 0; x < s->w; x++, src2++, dst2++) { + if (*src2 != transColor) { if (x + posX < screen->w && x + posX >= 0) { if (y + posY < screen->h && y + posY >= 0) { - *((byte*)screen->getBasePtr(x + posX, y + posY)) = pixel; + *dst2 = *src2; } } } } + src1 += s->pitch; + dst1 += screen->pitch; } change(); } @@ -119,7 +128,7 @@ void GraphicsMan::drawTransparentWithBlend(Graphics::Surface *screen, int32 posX change(); } -void GraphicsMan::drawTransparent(Graphics::Surface *screen, DrawNode *drawNode) { +void GraphicsMan::drawTransparentDrawNode(Graphics::Surface *screen, DrawNode *drawNode) { byte *src1 = (byte *)drawNode->s->getBasePtr(0, 0); byte *dst1 = (byte *)screen->getBasePtr(drawNode->posX, drawNode->posY); diff --git a/engines/prince/graphics.h b/engines/prince/graphics.h index 0ebf3aa7ef..d2f112656e 100644 --- a/engines/prince/graphics.h +++ b/engines/prince/graphics.h @@ -44,11 +44,11 @@ public: void setPalette(const byte *palette); void makeShadowTable(int brightness, byte *shadowTable); - void draw(Graphics::Surface *screen, uint16 x, uint16 y, const Graphics::Surface *s); + void draw(Graphics::Surface *screen, const Graphics::Surface *s); void drawTransparentSurface(Graphics::Surface *screen, int32 posX, int32 poxY, const Graphics::Surface *s, int transColor); void drawTransparentWithBlend(Graphics::Surface *screen, int32 posX, int32 poxY, const Graphics::Surface *s, int transColor); - static void drawTransparent(Graphics::Surface *screen, DrawNode *drawNode); + static void drawTransparentDrawNode(Graphics::Surface *screen, DrawNode *drawNode); static void drawAsShadow(Graphics::Surface *screen, DrawNode *drawNode); static void drawMask(Graphics::Surface *screen, DrawNode *drawNode); |