Skip to content

Commit

Permalink
SHERLOCK: RT: Add dirty rect call to transBlitFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 20, 2015
1 parent 097b52b commit 81125fd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions engines/sherlock/surface.cpp
Expand Up @@ -112,16 +112,19 @@ void Surface::transBlitFrom(const Surface &src, const Common::Point &pt,

void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
if (scaleVal == 256) {
if (scaleVal == SCALE_THRESHOLD) {
transBlitFromUnscaled(src, pt, flipped, overrideColor);
return;
}

int scaleX = SCALE_THRESHOLD * SCALE_THRESHOLD / scaleVal;
int scaleY = scaleX;
int scaleXCtr = 0, scaleYCtr = 0;
int destX, destY;
int xCtr, yCtr;
int maxX = pt.x;

for (int yCtr = 0, destY = pt.y; yCtr < src.h && destY < this->h(); ++yCtr) {
for (yCtr = 0, destY = pt.y; yCtr < src.h && destY < this->h(); ++yCtr) {
// Handle skipping lines if Y scaling
scaleYCtr += scaleY;

Expand All @@ -134,7 +137,7 @@ void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &p
byte *pDest = (byte *)getBasePtr(pt.x, destY);
scaleXCtr = 0;

for (int xCtr = 0, destX = pt.x; xCtr < src.w && destX < this->w(); ++xCtr) {
for (xCtr = 0, destX = pt.x; xCtr < src.w && destX < this->w(); ++xCtr) {
// Handle horizontal scaling
scaleXCtr += scaleX;

Expand All @@ -149,13 +152,17 @@ void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &p
++destX;
}

maxX = MAX(maxX, destX);
pSrc = pSrc + (flipped ? -1 : 1);
}
}

++destY;
}
}

// Mark the affected area
addDirtyRect(Common::Rect(pt.x, pt.y, maxX, destY));
}

void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
Expand Down

0 comments on commit 81125fd

Please sign in to comment.