aboutsummaryrefslogtreecommitdiff
path: root/gui/newgui.cpp
diff options
context:
space:
mode:
authorMax Horn2005-04-16 11:40:15 +0000
committerMax Horn2005-04-16 11:40:15 +0000
commit7aebedcc148cb4ccb9a74eb19d9cfc25f0d85455 (patch)
treec9cbf0a151d2ec720430ee467490a5183c241ce0 /gui/newgui.cpp
parente9be61a465874219638b204e24f74e9ffa2e8744 (diff)
downloadscummvm-rg350-7aebedcc148cb4ccb9a74eb19d9cfc25f0d85455.tar.gz
scummvm-rg350-7aebedcc148cb4ccb9a74eb19d9cfc25f0d85455.tar.bz2
scummvm-rg350-7aebedcc148cb4ccb9a74eb19d9cfc25f0d85455.zip
Patch #1183808 (GUI: Less CPU-intensive credits scroll), with some tweaks by me
svn-id: r17620
Diffstat (limited to 'gui/newgui.cpp')
-rw-r--r--gui/newgui.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 232b4f8344..59f7149123 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -301,6 +301,54 @@ void NewGui::vLine(int x, int y, int y2, OverlayColor color) {
_screen.vLine(x * _scaleFactor, y * _scaleFactor, y2 * _scaleFactor, color);
}
+void NewGui::copyToSurface(Graphics::Surface *s, int x, int y, int w, int h) {
+ Common::Rect rect(x * _scaleFactor, y * _scaleFactor, (x + w) * _scaleFactor, (y + h) * _scaleFactor);
+ rect.clip(_screen.w, _screen.h);
+
+ if (!rect.isValidRect())
+ return;
+
+ s->w = rect.width();
+ s->h = rect.height();
+ s->bytesPerPixel = sizeof(OverlayColor);
+ s->pitch = s->w * s->bytesPerPixel;
+ s->pixels = (OverlayColor *)malloc(s->pitch * s->h);
+
+ w = s->w;
+ h = s->h;
+
+ OverlayColor *dst = (OverlayColor *)s->pixels;
+ OverlayColor *src = getBasePtr(rect.left, rect.top);
+
+ while (h--) {
+ memcpy(dst, src, s->pitch);
+ src += _screenPitch;
+ dst += s->w;
+ }
+}
+
+void NewGui::drawSurface(const Graphics::Surface &s, int x, int y) {
+ Common::Rect rect(x * _scaleFactor, y * _scaleFactor, x * _scaleFactor + s.w, y * _scaleFactor + s.h);
+ rect.clip(_screen.w, _screen.h);
+
+ if (!rect.isValidRect())
+ return;
+
+ assert(s.bytesPerPixel == sizeof(OverlayColor));
+
+ OverlayColor *src = (OverlayColor *)s.pixels;
+ OverlayColor *dst = getBasePtr(rect.left, rect.top);
+
+ int w = rect.width();
+ int h = rect.height();
+
+ while (h--) {
+ memcpy(dst, src, s.pitch);
+ src += w;
+ dst += _screenPitch;
+ }
+}
+
void NewGui::blendRect(int x, int y, int w, int h, OverlayColor color, int level) {
#ifdef NEWGUI_256
fillRect(x, y, w, h, color);