From 4332df2bda8d8f3942d81db3051f780d2f1bf02a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Oct 2019 22:31:04 -0700 Subject: GLK: LEVEL9: Allow for future graphic scaling --- engines/glk/glk_api.cpp | 18 +++++++++++------- engines/glk/level9/os_glk.cpp | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/glk/glk_api.cpp b/engines/glk/glk_api.cpp index 6d34e3a6e1..ba05988e86 100644 --- a/engines/glk/glk_api.cpp +++ b/engines/glk/glk_api.cpp @@ -930,15 +930,19 @@ bool GlkAPI::glk_image_draw_scaled(winid_t win, const Graphics::Surface &image, if (!win) { warning("image_draw_scaled: invalid ref"); } else if (g_conf->_graphics) { - GraphicsWindow *gfxWin = dynamic_cast(win); + if (image.w == width && image.h == height) { + return glk_image_draw(win, image, transColor, xp, yp); - Graphics::ManagedSurface s(width, height); - s.clear(transColor); - s.transBlitFrom(image, Common::Rect(0, 0, image.w, image.h), - Common::Rect(0, 0, width, height), transColor); + } else { + GraphicsWindow *gfxWin = dynamic_cast(win); - if (gfxWin) - gfxWin->drawPicture(s, transColor, xp, yp, s.w, s.h); + Graphics::ManagedSurface s(width, height, image.format); + s.transBlitFrom(image, Common::Rect(0, 0, image.w, image.h), + Common::Rect(0, 0, width, height)); + + if (gfxWin) + gfxWin->drawPicture(s, transColor, xp, yp, s.w, s.h); + } } return true; diff --git a/engines/glk/level9/os_glk.cpp b/engines/glk/level9/os_glk.cpp index b2ac4ac727..586b80840c 100644 --- a/engines/glk/level9/os_glk.cpp +++ b/engines/glk/level9/os_glk.cpp @@ -2000,7 +2000,8 @@ static void gln_graphics_paint_everything(winid_t glk_window, Colour palette[], } } - g_vm->glk_image_draw(glk_window, s, (uint)-1, x_offset, y_offset); + g_vm->glk_image_draw_scaled(glk_window, s, (uint)-1, x_offset, y_offset, + width * GLN_GRAPHICS_PIXEL, height * GLN_GRAPHICS_PIXEL); } /* -- cgit v1.2.3