aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx/operations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx/operations.cpp')
-rw-r--r--engines/sci/gfx/operations.cpp673
1 files changed, 341 insertions, 332 deletions
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index a89968598b..d50341887d 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -27,7 +27,9 @@
#include "sci/sci.h"
#include "sci/gfx/operations.h"
+#ifdef INCLUDE_OLDGFX
#include "sci/gui32/font.h"
+#endif
#include "sci/console.h"
#include "common/system.h"
@@ -35,6 +37,8 @@
namespace Sci {
+#ifdef INCLUDE_OLDGFX
+
#define PRECISE_PRIORITY_MAP // Duplicate all operations on the local priority map as appropriate
#undef GFXW_DEBUG_DIRTY
@@ -871,6 +875,341 @@ void gfxop_disable_dirty_frames(GfxState *state) {
state->disable_dirty = 1;
}
+// View operations
+
+void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
+ gfxr_view_t *view = NULL;
+ gfx_pixmap_t *pxm = NULL;
+
+ view = state->gfxResMan->getView(nr, &loop, &cel, 0);
+
+ if (!view)
+ error("[GFX] Attempt to get cel parameters for invalid view %d", nr);
+
+ pxm = view->loops[loop].cels[cel];
+ *width = pxm->index_width;
+ *height = pxm->index_height;
+ offset->x = pxm->xoffset;
+ offset->y = pxm->yoffset;
+}
+
+static void _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int static_buf, int palette) {
+ int priority = (color.mask & GFX_MASK_PRIORITY) ? color.priority : -1;
+ int control = (color.mask & GFX_MASK_CONTROL) ? color.control : -1;
+ gfxr_view_t *view = NULL;
+ gfx_pixmap_t *pxm = NULL;
+ int old_x, old_y;
+
+ view = state->gfxResMan->getView(nr, &loop, &cel, palette);
+
+ if (!view) {
+ warning("[GFX] Attempt to draw loop/cel %d/%d in invalid view %d\n", loop, cel, nr);
+ return;
+ }
+ pxm = view->loops[loop].cels[cel];
+
+ old_x = pos.x -= pxm->xoffset;
+ old_y = pos.y -= pxm->yoffset;
+
+ pos.x *= state->driver->getMode()->scaleFactor;
+ pos.y *= state->driver->getMode()->scaleFactor;
+
+ if (!static_buf)
+ _gfxop_add_dirty(state, gfx_rect(old_x, old_y, pxm->index_width, pxm->index_height));
+
+ _gfxop_draw_pixmap(state->driver, pxm, priority, control, gfx_rect(0, 0, pxm->width, pxm->height),
+ gfx_rect(pos.x, pos.y, pxm->width, pxm->height), state->clip_zone, static_buf , state->control_map,
+ static_buf ? state->static_priority_map : state->priority_map);
+}
+
+void gfxop_draw_cel(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
+ _gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 0, palette);
+}
+
+void gfxop_draw_cel_static(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
+ rect_t oldclip = state->clip_zone;
+
+ state->clip_zone = gfx_rect_fullscreen;
+ _gfxop_scale_rect(&(state->clip_zone), state->driver->getMode());
+ gfxop_draw_cel_static_clipped(state, nr, loop, cel, pos, color, palette);
+ // Except that the area it's clipped against is... unusual ;-)
+ state->clip_zone = oldclip;
+}
+
+void gfxop_draw_cel_static_clipped(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
+ _gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 1, palette);
+}
+
+// Pic operations
+
+static void _gfxop_set_pic(GfxState *state) {
+ gfx_copy_pixmap_box_i(state->control_map, state->pic->control_map, gfx_rect(0, 0, 320, 200));
+ gfx_copy_pixmap_box_i(state->priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
+ gfx_copy_pixmap_box_i(state->static_priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
+
+ // Reset global palette to this PIC's palette
+ // FIXME: The _gfxop_install_pixmap call below updates the OSystem palette.
+ // This is too soon, since it causes brief palette corruption until the
+ // screen is updated too. (Possibly related: EngineState::pic_not_valid .)
+ if (state->pic->visual_map->palette) {
+ state->pic->visual_map->palette->forceInto(SCREEN_PALETTE);
+ _gfxop_install_pixmap(state->driver, state->pic->visual_map);
+ }
+
+ state->driver->setStaticBuffer(state->pic->visual_map, state->pic->priority_map);
+}
+
+void gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) {
+ state->gfxResMan->tagResources();
+ state->tag_mode = 1;
+ state->palette_nr = default_palette;
+ state->pic = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, true);
+
+ if (state->driver->getMode()->scaleFactor == 1 && state->driver->getMode()->scaleFactor == 1) {
+ state->pic_unscaled = state->pic;
+ } else {
+ state->pic_unscaled = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, false);
+ }
+
+ if (!state->pic || !state->pic_unscaled) {
+ warning("Could not retrieve background pic %d", nr);
+ if (state->pic) {
+ warning(" -- Inconsistency: scaled pic _was_ retrieved!");
+ }
+
+ if (state->pic_unscaled) {
+ warning(" -- Inconsistency: unscaled pic _was_ retrieved!");
+ }
+
+ error("Error occured in gfxop_new_pic()");
+ state->pic = state->pic_unscaled = NULL;
+ }
+
+ state->pic_nr = nr;
+
+ _gfxop_set_pic(state);
+}
+
+void gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) {
+ if (!state->pic)
+ error("Attempt to add to pic with no pic active");
+
+ state->pic = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
+
+ if (!state->pic)
+ error("Could not add pic #%d to pic #%d", state->pic_nr, nr);
+
+ state->pic_unscaled = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
+
+ _gfxop_set_pic(state);
+}
+
+// Text operations
+
+void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
+ int *lines_nr, int *lineheight, int *lastline_width) {
+ Common::Array<TextFragment> fragments;
+ bool textsplits;
+ gfx_bitmap_font_t *font;
+
+ font = state->gfxResMan->getFont(font_nr);
+
+ if (!font)
+ error("Attempt to calculate text size with invalid font #%d", font_nr);
+
+ textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width, text_flags);
+
+ if (!textsplits)
+ error("Could not calculate text size");
+
+ if (lines_nr)
+ *lines_nr = fragments.size();
+}
+
+TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &text, int maxwidth, gfx_alignment_t halign,
+ gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bg_color, int flags) {
+ TextHandle *handle;
+ gfx_bitmap_font_t *font;
+
+ // mapping text colors to palette
+ gfxop_set_color(state, &color1, color1);
+ gfxop_set_color(state, &color2, color2);
+ gfxop_set_color(state, &bg_color, bg_color);
+
+ font = state->gfxResMan->getFont(font_nr);
+
+ if (!font) {
+ error("Attempt to draw text with invalid font #%d", font_nr);
+ return NULL;
+ }
+
+ handle = new TextHandle();
+
+ handle->_text = text;
+ handle->halign = halign;
+ handle->valign = valign;
+ handle->line_height = font->line_height;
+
+ bool result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
+ NULL, NULL, flags);
+
+ if (!result) {
+ error("Could not calculate text parameters in font #%d", font_nr);
+ delete handle;
+ return NULL;
+ }
+
+ if (flags & kFontNoNewlines) {
+ handle->lines.resize(1);
+ handle->lines[0].length = text.size();
+ }
+
+ handle->text_pixmaps.resize(handle->lines.size());
+
+ for (uint i = 0; i < handle->lines.size(); i++) {
+ int chars_nr = handle->lines[i].length;
+
+ handle->text_pixmaps[i] = gfxr_draw_font(font, handle->lines[i].offset, chars_nr,
+ (color1.mask & GFX_MASK_VISUAL) ? &color1.visual : NULL,
+ (color2.mask & GFX_MASK_VISUAL) ? &color2.visual : NULL,
+ (bg_color.mask & GFX_MASK_VISUAL) ? &bg_color.visual : NULL);
+
+ if (!handle->text_pixmaps[i]) {
+ error("Failed to draw text pixmap for line %d/%d", i, handle->lines.size());
+ delete handle;
+ return NULL;
+ }
+ }
+
+ handle->font = font;
+
+ handle->priority = (color1.mask & GFX_MASK_PRIORITY) ? color1.priority : -1;
+ handle->control = (color1.mask & GFX_MASK_CONTROL) ? color1.control : -1;
+
+ return handle;
+}
+
+TextHandle::TextHandle() {
+ line_height = 0;
+ font = 0;
+
+ width = height = 0;
+
+ priority = control = 0;
+ halign = valign = ALIGN_BOTTOM;
+}
+
+TextHandle::~TextHandle() {
+ for (uint j = 0; j < text_pixmaps.size(); j++)
+ if (text_pixmaps[j])
+ gfx_free_pixmap(text_pixmaps[j]);
+}
+
+void gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) {
+ int line_height;
+ rect_t pos;
+
+ if (!handle)
+ error("Attempt to draw text with NULL handle");
+
+ if (handle->lines.empty()) {
+ debugC(2, kDebugLevelGraphics, "Skipping draw_text operation because number of lines is zero\n");
+ return;
+ }
+
+ _gfxop_scale_rect(&zone, state->driver->getMode());
+
+ line_height = handle->line_height * state->driver->getMode()->scaleFactor;
+
+ pos.y = zone.y;
+
+ switch (handle->valign) {
+
+ case ALIGN_TOP:
+ break;
+
+ case ALIGN_CENTER:
+ pos.y += (zone.height - (line_height * handle->lines.size())) >> 1;
+ break;
+
+ case ALIGN_BOTTOM:
+ pos.y += (zone.height - (line_height * handle->lines.size()));
+ break;
+
+ default:
+ error("Invalid vertical alignment %d", handle->valign);
+ }
+
+ for (uint i = 0; i < handle->lines.size(); i++) {
+
+ gfx_pixmap_t *pxm = handle->text_pixmaps[i];
+
+ if (!pxm->data) {
+ gfx_xlate_pixmap(pxm, state->driver->getMode());
+ }
+ if (!pxm)
+ error("Could not find text pixmap %d/%d", i, handle->lines.size());
+
+ pos.x = zone.x;
+
+ switch (handle->halign) {
+
+ case ALIGN_LEFT:
+ break;
+
+ case ALIGN_CENTER:
+ pos.x += (zone.width - pxm->width) >> 1;
+ break;
+
+ case ALIGN_RIGHT:
+ pos.x += (zone.width - pxm->width);
+ break;
+
+ default:
+ error("Invalid vertical alignment %d", handle->valign);
+ }
+
+ pos.width = pxm->width;
+ pos.height = pxm->height;
+
+ _gfxop_add_dirty(state, pos);
+ _gfxop_draw_pixmap(state->driver, pxm, handle->priority, handle->control,
+ gfx_rect(0, 0, pxm->width, pxm->height), pos, state->clip_zone, 0, state->control_map, state->priority_map);
+
+ pos.y += line_height;
+ }
+}
+
+gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) {
+ gfx_pixmap_t *pixmap = NULL;
+ rect_t resultzone; // Ignored for this application
+
+ _gfxop_scale_rect(&area, state->driver->getMode());
+ _gfxop_grab_pixmap(state, &pixmap, area.x, area.y, area.width, area.height, 0, &resultzone);
+
+ return pixmap;
+}
+
+void gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos) {
+ rect_t target = gfx_rect(pos.x, pos.y, zone.width, zone.height);
+
+ if (!pxm)
+ error("Attempt to draw NULL pixmap");
+
+ _gfxop_add_dirty(state, target);
+
+ _gfxop_scale_rect(&zone, state->driver->getMode());
+ _gfxop_scale_rect(&target, state->driver->getMode());
+
+ return _gfxop_draw_pixmap(state->driver, pxm, -1, -1, zone, target, gfx_rect(0, 0, 320*state->driver->getMode()->scaleFactor,
+ 200*state->driver->getMode()->scaleFactor), 0, NULL, NULL);
+}
+
+
+
+#endif // INCLUDE_OLDGFX
+
+
// Pointer and IO ops
void gfxop_sleep(GfxState *state, uint32 msecs) {
@@ -1003,7 +1342,7 @@ static int _gfxop_numlockify(int c) {
}
}
-static sci_event_t scummvm_get_event(GfxDriver *drv) {
+static sci_event_t scummvm_get_event() {
static int _modifierStates = 0; // FIXME: Avoid non-const global vars
sci_event_t input = { SCI_EVT_NONE, 0, 0, 0 };
@@ -1216,7 +1555,7 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) {
// Get all queued events from graphics driver
do {
- event = scummvm_get_event(state->driver);
+ event = scummvm_get_event();
if (event.type != SCI_EVT_NONE)
state->_events.push_back(event);
} while (event.type != SCI_EVT_NONE);
@@ -1263,334 +1602,4 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask) {
return event;
}
-// View operations
-
-void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
- gfxr_view_t *view = NULL;
- gfx_pixmap_t *pxm = NULL;
-
- view = state->gfxResMan->getView(nr, &loop, &cel, 0);
-
- if (!view)
- error("[GFX] Attempt to get cel parameters for invalid view %d", nr);
-
- pxm = view->loops[loop].cels[cel];
- *width = pxm->index_width;
- *height = pxm->index_height;
- offset->x = pxm->xoffset;
- offset->y = pxm->yoffset;
-}
-
-static void _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int static_buf, int palette) {
- int priority = (color.mask & GFX_MASK_PRIORITY) ? color.priority : -1;
- int control = (color.mask & GFX_MASK_CONTROL) ? color.control : -1;
- gfxr_view_t *view = NULL;
- gfx_pixmap_t *pxm = NULL;
- int old_x, old_y;
-
- view = state->gfxResMan->getView(nr, &loop, &cel, palette);
-
- if (!view) {
- warning("[GFX] Attempt to draw loop/cel %d/%d in invalid view %d\n", loop, cel, nr);
- return;
- }
- pxm = view->loops[loop].cels[cel];
-
- old_x = pos.x -= pxm->xoffset;
- old_y = pos.y -= pxm->yoffset;
-
- pos.x *= state->driver->getMode()->scaleFactor;
- pos.y *= state->driver->getMode()->scaleFactor;
-
- if (!static_buf)
- _gfxop_add_dirty(state, gfx_rect(old_x, old_y, pxm->index_width, pxm->index_height));
-
- _gfxop_draw_pixmap(state->driver, pxm, priority, control, gfx_rect(0, 0, pxm->width, pxm->height),
- gfx_rect(pos.x, pos.y, pxm->width, pxm->height), state->clip_zone, static_buf , state->control_map,
- static_buf ? state->static_priority_map : state->priority_map);
-}
-
-void gfxop_draw_cel(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
- _gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 0, palette);
-}
-
-void gfxop_draw_cel_static(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
- rect_t oldclip = state->clip_zone;
-
- state->clip_zone = gfx_rect_fullscreen;
- _gfxop_scale_rect(&(state->clip_zone), state->driver->getMode());
- gfxop_draw_cel_static_clipped(state, nr, loop, cel, pos, color, palette);
- // Except that the area it's clipped against is... unusual ;-)
- state->clip_zone = oldclip;
-}
-
-void gfxop_draw_cel_static_clipped(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
- _gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 1, palette);
-}
-
-// Pic operations
-
-static void _gfxop_set_pic(GfxState *state) {
- gfx_copy_pixmap_box_i(state->control_map, state->pic->control_map, gfx_rect(0, 0, 320, 200));
- gfx_copy_pixmap_box_i(state->priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
- gfx_copy_pixmap_box_i(state->static_priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
-
- // Reset global palette to this PIC's palette
- // FIXME: The _gfxop_install_pixmap call below updates the OSystem palette.
- // This is too soon, since it causes brief palette corruption until the
- // screen is updated too. (Possibly related: EngineState::pic_not_valid .)
- if (state->pic->visual_map->palette) {
- state->pic->visual_map->palette->forceInto(SCREEN_PALETTE);
- _gfxop_install_pixmap(state->driver, state->pic->visual_map);
- }
-
- state->driver->setStaticBuffer(state->pic->visual_map, state->pic->priority_map);
-}
-
-void gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) {
- state->gfxResMan->tagResources();
- state->tag_mode = 1;
- state->palette_nr = default_palette;
- state->pic = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, true);
-
- if (state->driver->getMode()->scaleFactor == 1 && state->driver->getMode()->scaleFactor == 1) {
- state->pic_unscaled = state->pic;
- } else {
- state->pic_unscaled = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, false);
- }
-
- if (!state->pic || !state->pic_unscaled) {
- warning("Could not retrieve background pic %d", nr);
- if (state->pic) {
- warning(" -- Inconsistency: scaled pic _was_ retrieved!");
- }
-
- if (state->pic_unscaled) {
- warning(" -- Inconsistency: unscaled pic _was_ retrieved!");
- }
-
- error("Error occured in gfxop_new_pic()");
- state->pic = state->pic_unscaled = NULL;
- }
-
- state->pic_nr = nr;
-
- _gfxop_set_pic(state);
-}
-
-void gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) {
- if (!state->pic)
- error("Attempt to add to pic with no pic active");
-
- state->pic = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
-
- if (!state->pic)
- error("Could not add pic #%d to pic #%d", state->pic_nr, nr);
-
- state->pic_unscaled = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
-
- _gfxop_set_pic(state);
-}
-
-// Text operations
-
-void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
- int *lines_nr, int *lineheight, int *lastline_width) {
- Common::Array<TextFragment> fragments;
- bool textsplits;
- gfx_bitmap_font_t *font;
-
- font = state->gfxResMan->getFont(font_nr);
-
- if (!font)
- error("Attempt to calculate text size with invalid font #%d", font_nr);
-
- textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width, text_flags);
-
- if (!textsplits)
- error("Could not calculate text size");
-
- if (lines_nr)
- *lines_nr = fragments.size();
-}
-
-TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &text, int maxwidth, gfx_alignment_t halign,
- gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bg_color, int flags) {
- TextHandle *handle;
- gfx_bitmap_font_t *font;
-
- // mapping text colors to palette
- gfxop_set_color(state, &color1, color1);
- gfxop_set_color(state, &color2, color2);
- gfxop_set_color(state, &bg_color, bg_color);
-
- font = state->gfxResMan->getFont(font_nr);
-
- if (!font) {
- error("Attempt to draw text with invalid font #%d", font_nr);
- return NULL;
- }
-
- handle = new TextHandle();
-
- handle->_text = text;
- handle->halign = halign;
- handle->valign = valign;
- handle->line_height = font->line_height;
-
- bool result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
- NULL, NULL, flags);
-
- if (!result) {
- error("Could not calculate text parameters in font #%d", font_nr);
- delete handle;
- return NULL;
- }
-
- if (flags & kFontNoNewlines) {
- handle->lines.resize(1);
- handle->lines[0].length = text.size();
- }
-
- handle->text_pixmaps.resize(handle->lines.size());
-
- for (uint i = 0; i < handle->lines.size(); i++) {
- int chars_nr = handle->lines[i].length;
-
- handle->text_pixmaps[i] = gfxr_draw_font(font, handle->lines[i].offset, chars_nr,
- (color1.mask & GFX_MASK_VISUAL) ? &color1.visual : NULL,
- (color2.mask & GFX_MASK_VISUAL) ? &color2.visual : NULL,
- (bg_color.mask & GFX_MASK_VISUAL) ? &bg_color.visual : NULL);
-
- if (!handle->text_pixmaps[i]) {
- error("Failed to draw text pixmap for line %d/%d", i, handle->lines.size());
- delete handle;
- return NULL;
- }
- }
-
- handle->font = font;
-
- handle->priority = (color1.mask & GFX_MASK_PRIORITY) ? color1.priority : -1;
- handle->control = (color1.mask & GFX_MASK_CONTROL) ? color1.control : -1;
-
- return handle;
-}
-
-TextHandle::TextHandle() {
- line_height = 0;
- font = 0;
-
- width = height = 0;
-
- priority = control = 0;
- halign = valign = ALIGN_BOTTOM;
-}
-
-TextHandle::~TextHandle() {
- for (uint j = 0; j < text_pixmaps.size(); j++)
- if (text_pixmaps[j])
- gfx_free_pixmap(text_pixmaps[j]);
-}
-
-void gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) {
- int line_height;
- rect_t pos;
-
- if (!handle)
- error("Attempt to draw text with NULL handle");
-
- if (handle->lines.empty()) {
- debugC(2, kDebugLevelGraphics, "Skipping draw_text operation because number of lines is zero\n");
- return;
- }
-
- _gfxop_scale_rect(&zone, state->driver->getMode());
-
- line_height = handle->line_height * state->driver->getMode()->scaleFactor;
-
- pos.y = zone.y;
-
- switch (handle->valign) {
-
- case ALIGN_TOP:
- break;
-
- case ALIGN_CENTER:
- pos.y += (zone.height - (line_height * handle->lines.size())) >> 1;
- break;
-
- case ALIGN_BOTTOM:
- pos.y += (zone.height - (line_height * handle->lines.size()));
- break;
-
- default:
- error("Invalid vertical alignment %d", handle->valign);
- }
-
- for (uint i = 0; i < handle->lines.size(); i++) {
-
- gfx_pixmap_t *pxm = handle->text_pixmaps[i];
-
- if (!pxm->data) {
- gfx_xlate_pixmap(pxm, state->driver->getMode());
- }
- if (!pxm)
- error("Could not find text pixmap %d/%d", i, handle->lines.size());
-
- pos.x = zone.x;
-
- switch (handle->halign) {
-
- case ALIGN_LEFT:
- break;
-
- case ALIGN_CENTER:
- pos.x += (zone.width - pxm->width) >> 1;
- break;
-
- case ALIGN_RIGHT:
- pos.x += (zone.width - pxm->width);
- break;
-
- default:
- error("Invalid vertical alignment %d", handle->valign);
- }
-
- pos.width = pxm->width;
- pos.height = pxm->height;
-
- _gfxop_add_dirty(state, pos);
- _gfxop_draw_pixmap(state->driver, pxm, handle->priority, handle->control,
- gfx_rect(0, 0, pxm->width, pxm->height), pos, state->clip_zone, 0, state->control_map, state->priority_map);
-
- pos.y += line_height;
- }
-}
-
-gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) {
- gfx_pixmap_t *pixmap = NULL;
- rect_t resultzone; // Ignored for this application
-
- _gfxop_scale_rect(&area, state->driver->getMode());
- _gfxop_grab_pixmap(state, &pixmap, area.x, area.y, area.width, area.height, 0, &resultzone);
-
- return pixmap;
-}
-
-void gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos) {
- rect_t target = gfx_rect(pos.x, pos.y, zone.width, zone.height);
-
- if (!pxm)
- error("Attempt to draw NULL pixmap");
-
- _gfxop_add_dirty(state, target);
-
- _gfxop_scale_rect(&zone, state->driver->getMode());
- _gfxop_scale_rect(&target, state->driver->getMode());
-
- return _gfxop_draw_pixmap(state->driver, pxm, -1, -1, zone, target, gfx_rect(0, 0, 320*state->driver->getMode()->scaleFactor,
- 200*state->driver->getMode()->scaleFactor), 0, NULL, NULL);
-}
-
} // End of namespace Sci