mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-12 11:43:00 +00:00
TEENAGENT: Cleanup Surface class.
This removes the underscores in various variables as per project coding standard.
This commit is contained in:
parent
e33f2779c6
commit
5d1143a9e0
@ -65,52 +65,52 @@ void Surface::load(Common::SeekableReadStream &stream, Type type) {
|
|||||||
stream.read(pixels, w_ * h_);
|
stream.read(pixels, w_ * h_);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect src_rect, uint zoom) const {
|
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror, Common::Rect srcRect, uint zoom) const {
|
||||||
if (src_rect.isEmpty()) {
|
if (srcRect.isEmpty()) {
|
||||||
src_rect = Common::Rect(0, 0, w, h);
|
srcRect = Common::Rect(0, 0, w, h);
|
||||||
}
|
}
|
||||||
Common::Rect dst_rect(x + dx, y + dy, x + dx + zoom * src_rect.width() / 256, y + dy + zoom * src_rect.height() / 256);
|
Common::Rect dstRect(x + dx, y + dy, x + dx + zoom * srcRect.width() / 256, y + dy + zoom * srcRect.height() / 256);
|
||||||
if (dst_rect.left < 0) {
|
if (dstRect.left < 0) {
|
||||||
src_rect.left = -dst_rect.left;
|
srcRect.left = -dstRect.left;
|
||||||
dst_rect.left = 0;
|
dstRect.left = 0;
|
||||||
}
|
}
|
||||||
if (dst_rect.right > surface->w) {
|
if (dstRect.right > surface->w) {
|
||||||
src_rect.right -= dst_rect.right - surface->w;
|
srcRect.right -= dstRect.right - surface->w;
|
||||||
dst_rect.right = surface->w;
|
dstRect.right = surface->w;
|
||||||
}
|
}
|
||||||
if (dst_rect.top < 0) {
|
if (dstRect.top < 0) {
|
||||||
src_rect.top -= dst_rect.top;
|
srcRect.top -= dstRect.top;
|
||||||
dst_rect.top = 0;
|
dstRect.top = 0;
|
||||||
}
|
}
|
||||||
if (dst_rect.bottom > surface->h) {
|
if (dstRect.bottom > surface->h) {
|
||||||
src_rect.bottom -= dst_rect.bottom - surface->h;
|
srcRect.bottom -= dstRect.bottom - surface->h;
|
||||||
dst_rect.bottom = surface->h;
|
dstRect.bottom = surface->h;
|
||||||
}
|
}
|
||||||
if (src_rect.isEmpty() || dst_rect.isEmpty())
|
if (srcRect.isEmpty() || dstRect.isEmpty())
|
||||||
return Common::Rect();
|
return Common::Rect();
|
||||||
|
|
||||||
if (zoom == 256) {
|
if (zoom == 256) {
|
||||||
const byte *src = (const byte *)getBasePtr(0, src_rect.top);
|
const byte *src = (const byte *)getBasePtr(0, srcRect.top);
|
||||||
byte *dst_base = (byte *)surface->getBasePtr(dst_rect.left, dst_rect.top);
|
byte *dstBase = (byte *)surface->getBasePtr(dstRect.left, dstRect.top);
|
||||||
|
|
||||||
for (int i = src_rect.top; i < src_rect.bottom; ++i) {
|
for (int i = srcRect.top; i < srcRect.bottom; ++i) {
|
||||||
byte *dst = dst_base;
|
byte *dst = dstBase;
|
||||||
for (int j = src_rect.left; j < src_rect.right; ++j) {
|
for (int j = srcRect.left; j < srcRect.right; ++j) {
|
||||||
byte p = src[(mirror ? w - j - 1 : j)];
|
byte p = src[(mirror ? w - j - 1 : j)];
|
||||||
if (p != 0xff)
|
if (p != 0xff)
|
||||||
*dst++ = p;
|
*dst++ = p;
|
||||||
else
|
else
|
||||||
++dst;
|
++dst;
|
||||||
}
|
}
|
||||||
dst_base += surface->pitch;
|
dstBase += surface->pitch;
|
||||||
src += pitch;
|
src += pitch;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
byte *dst = (byte *)surface->getBasePtr(dst_rect.left, dst_rect.top);
|
byte *dst = (byte *)surface->getBasePtr(dstRect.left, dstRect.top);
|
||||||
for (int i = 0; i < dst_rect.height(); ++i) {
|
for (int i = 0; i < dstRect.height(); ++i) {
|
||||||
for (int j = 0; j < dst_rect.width(); ++j) {
|
for (int j = 0; j < dstRect.width(); ++j) {
|
||||||
int px = j * 256 / zoom;
|
int px = j * 256 / zoom;
|
||||||
const byte *src = (const byte *)getBasePtr(src_rect.left + (mirror ? w - px - 1 : px), src_rect.top + i * 256 / zoom);
|
const byte *src = (const byte *)getBasePtr(srcRect.left + (mirror ? w - px - 1 : px), srcRect.top + i * 256 / zoom);
|
||||||
byte p = *src;
|
byte p = *src;
|
||||||
if (p != 0xff)
|
if (p != 0xff)
|
||||||
dst[j] = p;
|
dst[j] = p;
|
||||||
@ -118,7 +118,7 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi
|
|||||||
dst += surface->pitch;
|
dst += surface->pitch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dst_rect;
|
return dstRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace TeenAgent
|
} // End of namespace TeenAgent
|
||||||
|
@ -33,16 +33,17 @@ namespace TeenAgent {
|
|||||||
|
|
||||||
class Surface : public Graphics::Surface {
|
class Surface : public Graphics::Surface {
|
||||||
public:
|
public:
|
||||||
enum Type {kTypeOns, kTypeLan};
|
|
||||||
|
|
||||||
uint16 x, y;
|
|
||||||
|
|
||||||
Surface();
|
Surface();
|
||||||
~Surface();
|
~Surface();
|
||||||
|
|
||||||
|
enum Type {kTypeOns, kTypeLan};
|
||||||
|
|
||||||
void load(Common::SeekableReadStream &, Type type);
|
void load(Common::SeekableReadStream &, Type type);
|
||||||
Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect src_rect = Common::Rect(), uint zoom = 256) const;
|
Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false, Common::Rect srcRect = Common::Rect(), uint zoom = 256) const;
|
||||||
|
|
||||||
bool empty() const { return pixels == NULL; }
|
bool empty() const { return pixels == NULL; }
|
||||||
|
|
||||||
|
uint16 x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace TeenAgent
|
} // End of namespace TeenAgent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user