From 4bd84b7311da285f369605bce9d47b9e17bae530 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 16 Mar 2009 00:07:12 +0000 Subject: Replaced "xl" with "width" and "y1" with "height" in places where rectangles are used svn-id: r39435 --- engines/sci/engine/kgraphics.cpp | 46 ++++---- engines/sci/gfx/font.cpp | 4 +- engines/sci/gfx/gfx_driver.cpp | 38 +++--- engines/sci/gfx/gfx_pixmap_scale.cpp | 58 +++++----- engines/sci/gfx/gfx_resource.cpp | 26 ++--- engines/sci/gfx/gfx_support.cpp | 40 +++---- engines/sci/gfx/gfx_system.h | 28 ++--- engines/sci/gfx/gfx_tools.cpp | 50 ++++---- engines/sci/gfx/gfx_tools.h | 2 +- engines/sci/gfx/gfx_widgets.cpp | 68 +++++------ engines/sci/gfx/menubar.cpp | 2 +- engines/sci/gfx/operations.cpp | 218 +++++++++++++++++------------------ engines/sci/gfx/resmgr.cpp | 10 +- engines/sci/gfx/resource/res_pic.cpp | 70 +++++------ engines/sci/gfx/sci_widgets.cpp | 118 +++++++++---------- 15 files changed, 389 insertions(+), 389 deletions(-) diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 604160f3d1..90deb1a3a2 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -385,10 +385,10 @@ reg_t kMoveCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { newpos.x = SKPV(0) + s->port->zone.x; newpos.y = SKPV(1) + s->port->zone.y; - if (newpos.x > s->port->zone.x + s->port->zone.xl) - newpos.x = s->port->zone.x + s->port->zone.xl; - if (newpos.y > s->port->zone.y + s->port->zone.yl) - newpos.y = s->port->zone.y + s->port->zone.yl; + if (newpos.x > s->port->zone.x + s->port->zone.width) + newpos.x = s->port->zone.x + s->port->zone.width; + if (newpos.y > s->port->zone.y + s->port->zone.height) + newpos.y = s->port->zone.y + s->port->zone.height; if (newpos.x < 0) newpos.x = 0; if (newpos.y < 0) newpos.y = 0; @@ -497,8 +497,8 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) { area = gfx_rect(SKPV(2), SKPV(1) , SKPV(4), SKPV(3)); - area.xl = area.xl - area.x; // Since the actual coordinates are absolute - area.yl = area.yl - area.y; + area.width = area.width - area.x; // Since the actual coordinates are absolute + area.height = area.height - area.y; switch (SKPV(0)) { @@ -525,8 +525,8 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) { area.x += s->port->zone.x + port_origin_x; area.y += s->port->zone.y + port_origin_y; - area.xl += -port_origin_x; - area.yl += -port_origin_y; + area.width += -port_origin_x; + area.height += -port_origin_y; return(graph_save_box(s, area)); break; @@ -880,12 +880,12 @@ reg_t kIsItSkip(EngineState *s, int funct_nr, int argc, reg_t *argv) { } pxm = res->loops[loop].cels[cel]; - if (x > pxm->index_xl) - x = pxm->index_xl - 1; - if (y > pxm->index_yl) - y = pxm->index_yl - 1; + if (x > pxm->index_width) + x = pxm->index_width - 1; + if (y > pxm->index_height) + y = pxm->index_height - 1; - return make_reg(0, pxm->index_data[y * pxm->index_xl + x] == pxm->color_key); + return make_reg(0, pxm->index_data[y * pxm->index_width + x] == pxm->color_key); } reg_t kCelHigh(EngineState *s, int funct_nr, int argc, reg_t *argv) { @@ -3188,11 +3188,11 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { case K_DISPLAY_WIDTH: - area.xl = UKPV(argpt++); - if (area.xl == 0) - area.xl = MAX_TEXT_WIDTH_MAGIC_VALUE; + area.width = UKPV(argpt++); + if (area.width == 0) + area.width = MAX_TEXT_WIDTH_MAGIC_VALUE; - SCIkdebug(SCIkGRAPHICS, "Display: set_width(%d)\n", area.xl); + SCIkdebug(SCIkGRAPHICS, "Display: set_width(%d)\n", area.width); break; case K_DISPLAY_SAVE_UNDER: @@ -3224,14 +3224,14 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->version >= SCI_VERSION_FTU_DISPLAY_COORDS_FUZZY) { if (halign == ALIGN_LEFT) - GFX_ASSERT(gfxop_get_text_params(s->gfx_state, font_nr, text, area.xl, &area.xl, &area.yl, 0, NULL, NULL, NULL)); + GFX_ASSERT(gfxop_get_text_params(s->gfx_state, font_nr, text, area.width, &area.width, &area.height, 0, NULL, NULL, NULL)); // Make the text fit on the screen - if (area.x + area.xl > 320) - area.x += 320 - area.x - area.xl; // Plus negative number = subtraction + if (area.x + area.width > 320) + area.x += 320 - area.x - area.width; // Plus negative number = subtraction - if (area.y + area.yl > 200) { - area.y += 200 - area.y - area.yl; // Plus negative number = subtraction + if (area.y + area.height > 200) { + area.y += 200 - area.y - area.height; // Plus negative number = subtraction } } @@ -3257,7 +3257,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = graph_save_box(s, save_area); text_handle->serial++; // This is evil! - SCIkdebug(SCIkGRAPHICS, "Saving (%d, %d) size (%d, %d) as "PREG"\n", save_area.x, save_area.y, save_area.xl, save_area.yl, s->r_acc); + SCIkdebug(SCIkGRAPHICS, "Saving (%d, %d) size (%d, %d) as "PREG"\n", save_area.x, save_area.y, save_area.width, save_area.height, s->r_acc); } SCIkdebug(SCIkGRAPHICS, "Display: Commiting text '%s'\n", text); diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp index 8a71435052..becc354296 100644 --- a/engines/sci/gfx/font.cpp +++ b/engines/sci/gfx/font.cpp @@ -248,13 +248,13 @@ gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int cha offset = pxm->index_data; - memset(pxm->index_data, back, pxm->index_xl * pxm->index_yl); + memset(pxm->index_data, back, pxm->index_width * pxm->index_height); for (i = 0; i < characters; i++) { unsigned char ch = text[i]; width = font->widths[ch]; render_char(offset, font->data + (ch * font->char_size), width, - pxm->index_xl, pxm->index_yl, font->row_size, fore_0, fore_1, back); + pxm->index_width, pxm->index_height, font->row_size, fore_0, fore_1, back); offset += width; } diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index dd92fda9f5..e8d2366a59 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -156,8 +156,8 @@ static int scummvm_draw_line(gfx_driver_t *drv, Common::Point start, Common::Poi static int scummvm_draw_filled_rect(gfx_driver_t *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2, gfx_rectangle_fill_t shade_mode) { if (color1.mask & GFX_MASK_VISUAL) { - for (int i = rect.y; i < rect.y + rect.yl; i++) { - memset(S->visual[0] + i * S->xsize + rect.x, color1.visual.parent_index, rect.xl); + for (int i = rect.y; i < rect.y + rect.height; i++) { + memset(S->visual[0] + i * S->xsize + rect.x, color1.visual.parent_index, rect.width); } } @@ -173,13 +173,13 @@ static int scummvm_draw_pixmap(gfx_driver_t *drv, gfx_pixmap_t *pxm, int priorit rect_t src, rect_t dest, gfx_buffer_t buffer) { int bufnr = (buffer == GFX_BUFFER_STATIC) ? 1 : 0; - if (dest.xl != src.xl || dest.yl != src.yl) { - printf("Attempt to scale pixmap (%dx%d)->(%dx%d): Not supported\n", src.xl, src.yl, dest.xl, dest.yl); + if (dest.width != src.width || dest.height != src.height) { + printf("Attempt to scale pixmap (%dx%d)->(%dx%d): Not supported\n", src.width, src.height, dest.width, dest.height); return GFX_ERROR; } gfx_crossblit_pixmap(drv->mode, pxm, priority, src, dest, S->visual[bufnr], S->xsize, - S->priority[bufnr]->index_data, S->priority[bufnr]->index_xl, 1, 0); + S->priority[bufnr]->index_data, S->priority[bufnr]->index_width, 1, 0); return GFX_OK; } @@ -198,10 +198,10 @@ static int scummvm_grab_pixmap(gfx_driver_t *drv, rect_t src, gfx_pixmap_t *pxm, switch (map) { case GFX_MASK_VISUAL: - pxm->xl = src.xl; - pxm->yl = src.yl; - for (int i = 0; i < src.yl; i++) { - memcpy(pxm->data + i * src.xl, S->visual[0] + (i + src.y) * S->xsize + src.x, src.xl); + pxm->width = src.width; + pxm->height = src.height; + for (int i = 0; i < src.height; i++) { + memcpy(pxm->data + i * src.width, S->visual[0] + (i + src.y) * S->xsize + src.x, src.width); } break; @@ -224,24 +224,24 @@ static int scummvm_update(gfx_driver_t *drv, rect_t src, Common::Point dest, gfx /* if (src.x != dest.x || src.y != dest.y) { - printf("Updating %d (%d,%d)(%dx%d) to (%d,%d) on %d\n", buffer, src.x, src.y, src.xl, src.yl, dest.x, dest.y, data_dest); + printf("Updating %d (%d,%d)(%dx%d) to (%d,%d) on %d\n", buffer, src.x, src.y, src.width, src.height, dest.x, dest.y, data_dest); } else { - printf("Updating %d (%d,%d)(%dx%d) to %d\n", buffer, src.x, src.y, src.xl, src.yl, data_dest); + printf("Updating %d (%d,%d)(%dx%d) to %d\n", buffer, src.x, src.y, src.width, src.height, data_dest); } */ switch (buffer) { case GFX_BUFFER_BACK: - for (int i = 0; i < src.yl; i++) { + for (int i = 0; i < src.height; i++) { memcpy(S->visual[0] + (dest.y + i) * S->xsize + dest.x, - S->visual[1] + (src.y + i) * S->xsize + src.x, src.xl); + S->visual[1] + (src.y + i) * S->xsize + src.x, src.width); } if ((src.x == dest.x) && (src.y == dest.y)) gfx_copy_pixmap_box_i(S->priority[0], S->priority[1], src); break; case GFX_BUFFER_FRONT: - g_system->copyRectToScreen(S->visual[0] + src.x + src.y * S->xsize, S->xsize, dest.x, dest.y, src.xl, src.yl); + g_system->copyRectToScreen(S->visual[0] + src.x + src.y * S->xsize, S->xsize, dest.x, dest.y, src.width, src.height); g_system->updateScreen(); break; default: @@ -264,16 +264,16 @@ static int scummvm_set_static_buffer(gfx_driver_t *drv, gfx_pixmap_t *pic, gfx_p // Scale cursor and map its colors to the global palette static uint8 *create_cursor(gfx_driver_t *drv, gfx_pixmap_t *pointer, int mode) { - int linewidth = pointer->xl; - int lines = pointer->yl; + int linewidth = pointer->width; + int lines = pointer->height; uint8 *data = new uint8[linewidth*lines]; uint8 *linebase = data, *pos; uint8 *src = pointer->index_data; - for (int yc = 0; yc < pointer->index_yl; yc++) { + for (int yc = 0; yc < pointer->index_height; yc++) { pos = linebase; - for (int xc = 0; xc < pointer->index_xl; xc++) { + for (int xc = 0; xc < pointer->index_width; xc++) { uint8 color = *src; if (color != 255) color = pointer->palette->getColor(color).parent_index; @@ -296,7 +296,7 @@ static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer) { } else { delete[] S->pointer_data; S->pointer_data = create_cursor(drv, pointer, 1); - g_system->setMouseCursor(S->pointer_data, pointer->xl, pointer->yl, pointer->xoffset, pointer->yoffset); + g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, pointer->xoffset, pointer->yoffset); g_system->showMouse(true); } diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index 0cecc1ce8c..687f7b6e56 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -43,7 +43,7 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { int xfact = (scale) ? mode->xfact : 1; int yfact = (scale) ? mode->yfact : 1; int widthc, heightc; // Width duplication counter - int line_width = xfact * pxm->index_xl; + int line_width = xfact * pxm->index_width; int bytespp = mode->bytespp; int x, y; int i; @@ -63,7 +63,7 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { assert(bytespp == COPY_BYTES); if (separate_alpha_map && !alpha_dest) - alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact); + alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_width * xfact * pxm->index_height * yfact); // Calculate all colors for (i = 0; i < pxm->colors_nr(); i++) { @@ -85,11 +85,11 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { result_colors[pxm->color_key] = alpha_color; src = pxm->index_data; // Workaround for gcc 4.2.3 bug on EMT64 - for (y = 0; y < pxm->index_yl; y++) { + for (y = 0; y < pxm->index_height; y++) { byte *prev_dest = dest; byte *prev_alpha_dest = alpha_dest; - for (x = 0; x < pxm->index_xl; x++) { + for (x = 0; x < pxm->index_width; x++) { int isalpha; SIZETYPE col = result_colors[isalpha = *src++] << (EXTRA_BYTE_OFFSET * 8); isalpha = (isalpha == pxm->color_key) && using_alpha; @@ -176,12 +176,12 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { WRITE_XPART(X_CALC_INTENSITY_CENTER, 0); \ } \ /*-- right half --*/ \ - MAKE_PIXEL((x + 1 == pxm->index_xl), othercolumn, ctexel, src[+1]); \ + MAKE_PIXEL((x + 1 == pxm->index_width), othercolumn, ctexel, src[+1]); \ WRITE_XPART(X_CALC_INTENSITY_NORMAL, 1); \ if (DO_Y_STEP) \ line_valuator -= line_step; \ - sublinepos += pxm->xl * bytespp; \ - alpha_sublinepos += pxm->xl; \ + sublinepos += pxm->width * bytespp; \ + alpha_sublinepos += pxm->width; \ } \ if (DO_Y_STEP) \ line_step = -line_step @@ -224,13 +224,13 @@ void FUNCNAME_LINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { shifts[3] = mode->alpha_shift; if (separate_alpha_map && !alpha_dest) - alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact); + alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_width * xfact * pxm->index_height * yfact); - for (y = 0; y < pxm->index_yl; y++) { + for (y = 0; y < pxm->index_height; y++) { byte *linepos = dest; byte *alpha_linepos = alpha_dest; - for (x = 0; x < pxm->index_xl; x++) { + for (x = 0; x < pxm->index_width; x++) { int otherline[4]; // the above line or the line below int ctexel[4]; // Current texel int subx, suby; @@ -258,7 +258,7 @@ void FUNCNAME_LINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { MAKE_PIXEL(0, ctexel, zero, *src); //-- Upper half -- - MAKE_PIXEL((y == 0), otherline, ctexel, src[-pxm->index_xl]); + MAKE_PIXEL((y == 0), otherline, ctexel, src[-pxm->index_width]); WRITE_YPART(1, Y_CALC_INTENSITY_NORMAL); if (yfact & 1) { @@ -267,7 +267,7 @@ void FUNCNAME_LINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { //-- Lower half -- line_valuator -= line_step; - MAKE_PIXEL((y + 1 == pxm->index_yl), otherline, ctexel, src[pxm->index_xl]); + MAKE_PIXEL((y + 1 == pxm->index_height), otherline, ctexel, src[pxm->index_width]); WRITE_YPART(1, Y_CALC_INTENSITY_NORMAL); src++; @@ -275,8 +275,8 @@ void FUNCNAME_LINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { alpha_linepos += xfact; } - dest += pxm->xl * yfact * bytespp; - alpha_dest += pxm->xl * yfact; + dest += pxm->width * yfact * bytespp; + alpha_dest += pxm->width * yfact; } } @@ -372,15 +372,15 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { shifts[2] = mode->blue_shift; shifts[3] = mode->alpha_shift; - if (!(pxm->index_xl && pxm->index_yl)) + if (!(pxm->index_width && pxm->index_height)) return; if (separate_alpha_map && !alpha_dest) - alpha_dest = pxm->alpha_map = (byte*)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact); + alpha_dest = pxm->alpha_map = (byte*)sci_malloc(pxm->index_width * xfact * pxm->index_height * yfact); - src -= pxm->index_xl + 1; + src -= pxm->index_width + 1; - for (y = 0; y <= pxm->index_yl; y++) { + for (y = 0; y <= pxm->index_height; y++) { byte *y_dest_backup = dest; byte *y_alpha_dest_backup = alpha_dest; int y_valuator = (y > 0) ? 0 : 128; @@ -389,7 +389,7 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { if (y == 0) yc_count = yfact >> 1; - else if (y == pxm->index_yl) + else if (y == pxm->index_height) yc_count = (yfact + 1) >> 1; else yc_count = yfact; @@ -397,7 +397,7 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { if (yfact & 1) y_valuator += line_step >> 1; - for (x = 0; x <= pxm->index_xl; x++) { + for (x = 0; x <= pxm->index_width; x++) { byte *x_dest_backup = dest; byte *x_alpha_dest_backup = alpha_dest; int x_valuator = (x > 0) ? 0 : 128; @@ -408,7 +408,7 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { if (x == 0) xc_count = xfact >> 1; - else if (x == pxm->index_xl) + else if (x == pxm->index_width) xc_count = (xfact + 1) >> 1; else xc_count = xfact; @@ -417,9 +417,9 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { x_valuator += column_step >> 1; MAKE_PIXEL_TRILINEAR((y && x), pixels[0], *src); - MAKE_PIXEL_TRILINEAR((y && (x < pxm->index_xl)), pixels[1], src[1]); - MAKE_PIXEL_TRILINEAR(((y < pxm->index_yl) && x), pixels[2], src[pxm->index_xl]); - MAKE_PIXEL_TRILINEAR(((y < pxm->index_yl) && (x < pxm->index_xl)), pixels[3], src[pxm->index_xl + 1]); + MAKE_PIXEL_TRILINEAR((y && (x < pxm->index_width)), pixels[1], src[1]); + MAKE_PIXEL_TRILINEAR(((y < pxm->index_width) && x), pixels[2], src[pxm->index_width]); + MAKE_PIXEL_TRILINEAR(((y < pxm->index_width) && (x < pxm->index_width)), pixels[3], src[pxm->index_width + 1]); // Optimize Me @@ -460,18 +460,18 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { gfx_apply_delta(leftcolor, leftdelta, line_step); gfx_apply_delta(rightcolor, rightdelta, line_step); - dest = yc_dest_backup + pxm->index_xl * xfact * COPY_BYTES; - alpha_dest = yc_alpha_dest_backup + pxm->index_xl * xfact; + dest = yc_dest_backup + pxm->index_width * xfact * COPY_BYTES; + alpha_dest = yc_alpha_dest_backup + pxm->index_width * xfact; } dest = x_dest_backup + xc_count * COPY_BYTES; alpha_dest = x_alpha_dest_backup + xc_count; - if (x < pxm->index_xl) + if (x < pxm->index_width) src++; } - dest = y_dest_backup + pxm->index_xl * xfact * yc_count * COPY_BYTES; - alpha_dest = y_alpha_dest_backup + pxm->index_xl * xfact * yc_count; + dest = y_dest_backup + pxm->index_width * xfact * yc_count * COPY_BYTES; + alpha_dest = y_alpha_dest_backup + pxm->index_width * xfact * yc_count; } } diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp index 9097424aff..b2e2eb4320 100644 --- a/engines/sci/gfx/gfx_resource.cpp +++ b/engines/sci/gfx/gfx_resource.cpp @@ -183,15 +183,15 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { break; case 2: - pixmap_endianness_reverse_2(data, pixmap->xl * pixmap->yl); + pixmap_endianness_reverse_2(data, pixmap->width * pixmap->height); break; case 3: - pixmap_endianness_reverse_3_simple(data, pixmap->xl * pixmap->yl); + pixmap_endianness_reverse_3_simple(data, pixmap->width * pixmap->height); break; case 4: - pixmap_endianness_reverse_4(data, pixmap->xl * pixmap->yl); + pixmap_endianness_reverse_4(data, pixmap->width * pixmap->height); break; default: @@ -275,11 +275,11 @@ static void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, in } if (pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX) { - pxm->xl = pxm->index_xl; - pxm->yl = pxm->index_yl; + pxm->width = pxm->index_width; + pxm->height = pxm->index_height; } else { - pxm->xl = pxm->index_xl * mode->xfact; - pxm->yl = pxm->index_yl * mode->yfact; + pxm->width = pxm->index_width * mode->xfact; + pxm->height = pxm->index_height * mode->yfact; } } @@ -289,8 +289,8 @@ static void _gfx_xlate_pixmap_linear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int sc return; } - pxm->xl = pxm->index_xl * mode->xfact; - pxm->yl = pxm->index_yl * mode->yfact; + pxm->width = pxm->index_width * mode->xfact; + pxm->height = pxm->index_height * mode->yfact; switch (mode->bytespp) { @@ -323,8 +323,8 @@ static void _gfx_xlate_pixmap_trilinear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int return; } - pxm->xl = pxm->index_xl * mode->xfact; - pxm->yl = pxm->index_yl * mode->yfact; + pxm->width = pxm->index_width * mode->xfact; + pxm->height = pxm->index_height * mode->yfact; switch (mode->bytespp) { case 1: @@ -359,13 +359,13 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t fi if (!pxm->data) { - pxm->data = (byte*)sci_malloc(mode->xfact * mode->yfact * pxm->index_xl * pxm->index_yl * mode->bytespp + 1); + pxm->data = (byte*)sci_malloc(mode->xfact * mode->yfact * pxm->index_width * pxm->index_height * mode->bytespp + 1); // +1: Eases coying on BE machines in 24 bpp packed mode // Assume that memory, if allocated already, will be sufficient // Allocate alpha map if (!mode->alpha_mask && pxm->colors_nr() < GFX_PIC_COLORS) - pxm->alpha_map = (byte*)sci_malloc(mode->xfact * mode->yfact * pxm->index_xl * pxm->index_yl + 1); + pxm->alpha_map = (byte*)sci_malloc(mode->xfact * mode->yfact * pxm->index_width * pxm->index_height + 1); } else was_allocated = 1; diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp index 1cc4a4983e..555bfaa268 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -64,26 +64,26 @@ static void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, } void gfx_draw_line_pixmap_i(gfx_pixmap_t *pxm, Common::Point start, Common::Point end, int color) { - gfx_draw_line_buffer(pxm->index_data, pxm->index_xl, 1, start, end, color); + gfx_draw_line_buffer(pxm->index_data, pxm->index_width, 1, start, end, color); } void gfx_draw_box_buffer(byte *buffer, int linewidth, rect_t zone, int color) { byte *dest = buffer + zone.x + (linewidth * zone.y); int i; - if (zone.xl <= 0 || zone.yl <= 0) + if (zone.width <= 0 || zone.height <= 0) return; - for (i = 0; i < zone.yl; i++) { - memset(dest, color, zone.xl); + for (i = 0; i < zone.height; i++) { + memset(dest, color, zone.width); dest += linewidth; } } void gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) { - gfx_clip_box_basic(&box, pxm->index_xl - 1, pxm->index_yl - 1); + gfx_clip_box_basic(&box, pxm->index_width - 1, pxm->index_height - 1); - gfx_draw_box_buffer(pxm->index_data, pxm->index_xl, box, color); + gfx_draw_box_buffer(pxm->index_data, pxm->index_width, box, color); } static void (*crossblit_fns[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL, @@ -135,17 +135,17 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect unsigned int alpha_mask, alpha_min; int bpp = mode->bytespp; int bytes_per_alpha_pixel = pxm->alpha_map ? 1 : bpp; - int bytes_per_alpha_line = bytes_per_alpha_pixel * pxm->xl; - int xl = pxm->xl, yl = pxm->yl; + int bytes_per_alpha_line = bytes_per_alpha_pixel * pxm->width; + int xl = pxm->width, yl = pxm->height; int xoffset = (dest_coords.x < 0) ? - dest_coords.x : 0; int yoffset = (dest_coords.y < 0) ? - dest_coords.y : 0; int revalpha = mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA; - if (src_coords.x + src_coords.xl > xl) - src_coords.xl = xl - src_coords.x; + if (src_coords.x + src_coords.width > xl) + src_coords.width = xl - src_coords.x; - if (src_coords.y + src_coords.yl > yl) - src_coords.yl = yl - src_coords.y; + if (src_coords.y + src_coords.height > yl) + src_coords.height = yl - src_coords.y; // --???-- if (src_coords.y > yl) @@ -190,15 +190,15 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect if (yoffset += src_coords.y) { dest_coords.y = 0; - src += yoffset * bpp * pxm->xl; + src += yoffset * bpp * pxm->width; alpha += yoffset * bytes_per_alpha_line; } // Adjust length for clip box - if (xl > src_coords.xl) - xl = src_coords.xl; - if (yl > src_coords.yl) - yl = src_coords.yl; + if (xl > src_coords.width) + xl = src_coords.width; + if (yl > src_coords.height) + yl = src_coords.height; // now calculate alpha if (pxm->alpha_map) @@ -236,12 +236,12 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect alpha_min = 255 - alpha_min; // Since we use it for the reverse effect if (!alpha_mask) - _gfx_crossblit_simple(dest, src, dest_line_width, pxm->xl * bpp, xl, yl, bpp); + _gfx_crossblit_simple(dest, src, dest_line_width, pxm->width * bpp, xl, yl, bpp); else if (priority == GFX_NO_PRIORITY) { if (bpp > 0 && bpp < 5) - ((revalpha) ? crossblit_fns_RA : crossblit_fns)[bpp](dest, src, dest_line_width, pxm->xl * bpp, + ((revalpha) ? crossblit_fns_RA : crossblit_fns)[bpp](dest, src, dest_line_width, pxm->width * bpp, xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, 0, 0, 0, 0); else { @@ -250,7 +250,7 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect } } else { // priority if (bpp > 0 && bpp < 5) - ((revalpha) ? crossblit_fns_P_RA : crossblit_fns_P)[bpp](dest, src, dest_line_width, pxm->xl * bpp, + ((revalpha) ? crossblit_fns_P_RA : crossblit_fns_P)[bpp](dest, src, dest_line_width, pxm->width * bpp, xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min, priority_pos, priority_line_width, priority_skip, priority); else { diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 49371fdf54..13ffc7342f 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -110,27 +110,27 @@ struct gfx_color_t { /** Rectangle description */ struct rect_t { int x, y; - int xl, yl; /* width, height: (x,y,xl,yl)=(5,5,1,1) occupies 1 pixel */ + int width, height; /* width, height: (x,y,width,height)=(5,5,1,1) occupies 1 pixel */ }; /* Generates a rect_t from index data ** Parameters: (int x int) x,y: Upper left point of the rectangle -** (int x int) xl, yl: Horizontal and vertical extension of the rectangle +** (int x int) width, height: Horizontal and vertical extension of the rectangle ** Returns : (rect_t) A rectangle matching the supplied parameters */ -static inline rect_t gfx_rect(int x, int y, int xl, int yl) { +static inline rect_t gfx_rect(int x, int y, int width, int height) { rect_t rect; rect.x = x; rect.y = y; - rect.xl = xl; - rect.yl = yl; + rect.width = width; + rect.height = height; return rect; } -#define GFX_PRINT_RECT(rect) (rect).x, (rect).y, (rect).xl, (rect).yl +#define GFX_PRINT_RECT(rect) (rect).x, (rect).y, (rect).width, (rect).height #define OVERLAP(a, b, z, zl) (a.z >= b.z && a.z < (b.z + b.zl)) @@ -139,7 +139,7 @@ static inline rect_t gfx_rect(int x, int y, int xl, int yl) { ** Returns : (int) 1 if they overlap, 0 otherwise */ static inline int gfx_rects_overlap(rect_t a, rect_t b) { - return (OVERLAP(a, b, x, xl) || OVERLAP(b, a, x, xl)) && (OVERLAP(a, b, y, yl) || OVERLAP(b, a, y, yl)); + return (OVERLAP(a, b, x, width) || OVERLAP(b, a, x, width)) && (OVERLAP(a, b, y, height) || OVERLAP(b, a, y, height)); } #undef OVERLAP @@ -158,7 +158,7 @@ else SUBMERGE_PARTIAL(b, a, z, zl) -#define RECT(a) a.x, a.y, a.xl, a.yl +#define RECT(a) a.x, a.y, a.width, a.height /* Merges two rects ** Parameters: (rect_t x rect_t) a,b: The two rects to merge @@ -166,8 +166,8 @@ else SUBMERGE_PARTIAL(b, a, z, zl) */ static inline rect_t gfx_rects_merge(rect_t a, rect_t b) { rect_t retval; - MERGE_PARTIAL(x, xl); - MERGE_PARTIAL(y, yl); + MERGE_PARTIAL(x, width); + MERGE_PARTIAL(y, height); return retval; } #undef MERGE_PARTIAL @@ -179,7 +179,7 @@ static inline rect_t gfx_rects_merge(rect_t a, rect_t b) { ** Returns : non-zero iff for each pixel p in a the following holds: p is in b. */ static inline int gfx_rect_subset(rect_t a, rect_t b) { - return ((a.x >= b.x) && (a.y >= b.y) && ((a.x + a.xl) <= (b.x + b.xl)) && ((a.y + a.yl) <= (b.y + b.yl))); + return ((a.x >= b.x) && (a.y >= b.y) && ((a.x + a.width) <= (b.x + b.width)) && ((a.y + a.height) <= (b.y + b.height))); } @@ -188,7 +188,7 @@ static inline int gfx_rect_subset(rect_t a, rect_t b) { ** Returns : (int) gfx_rect_subset(a,b) AND gfx_rect_subset(b,a) */ static inline int gfx_rect_equals(rect_t a, rect_t b) { - return (a.x == b.x && a.xl == b.xl && a.y == b.y && a.yl == b.yl); + return (a.x == b.x && a.width == b.width && a.y == b.y && a.height == b.height); } @@ -241,13 +241,13 @@ struct gfx_pixmap_t { /* gfx_pixmap_t: Pixel map */ int xoffset, yoffset; /* x and y coordinates of the 'hot spot' (unscaled) */ /*** Index data ***/ - int index_xl, index_yl; /* width and height of the indexed original image */ + int index_width, index_height; /* width and height of the indexed original image */ byte *index_data; /* Color-index data, or NULL if read from an ** external source */ /*** Drawable data ***/ - int xl, yl; /* width and height of the actual image */ + int width, height; /* width and height of the actual image */ int data_size; /* Amount of allocated memory */ byte *data; /* Drawable data, or NULL if not converted. */ diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index 1962f032ed..e650aee111 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -37,11 +37,11 @@ void gfx_clip_box_basic(rect_t *box, int maxx, int maxy) { if (box->y < 0) box->y = 0; - if (box->x + box->xl > maxx) - box->xl = maxx - box->x + 1; + if (box->x + box->width > maxx) + box->width = maxx - box->x + 1; - if (box->y + box->yl > maxy) - box->yl = maxy - box->y + 1; + if (box->y + box->height > maxy) + box->height = maxy - box->y + 1; } gfx_mode_t *gfx_new_mode(int xfact, int yfact, const Graphics::PixelFormat &format, Palette *palette, int flags) { @@ -87,22 +87,22 @@ void gfx_copy_pixmap_box_i(gfx_pixmap_t *dest, gfx_pixmap_t *src, rect_t box) { int width, height; int offset; - if ((dest->index_xl != src->index_xl) || (dest->index_yl != src->index_yl)) + if ((dest->index_width != src->index_width) || (dest->index_height != src->index_height)) return; - gfx_clip_box_basic(&box, dest->index_xl, dest->index_yl); + gfx_clip_box_basic(&box, dest->index_width, dest->index_height); - if (box.xl <= 0 || box.yl <= 0) + if (box.width <= 0 || box.height <= 0) return; - height = box.yl; - width = box.xl; + height = box.height; + width = box.width; - offset = box.x + (box.y * dest->index_xl); + offset = box.x + (box.y * dest->index_width); while (height--) { memcpy(dest->index_data + offset, src->index_data + offset, width); - offset += dest->index_xl; + offset += dest->index_width; } } @@ -116,8 +116,8 @@ gfx_pixmap_t *gfx_clone_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) { memcpy(clone->data, pxm->data, clone->data_size); if (clone->alpha_map) { - clone->alpha_map = (byte *) sci_malloc(clone->xl * clone->yl); - memcpy(clone->alpha_map, pxm->alpha_map, clone->xl * clone->yl); + clone->alpha_map = (byte *) sci_malloc(clone->width * clone->height); + memcpy(clone->alpha_map, pxm->alpha_map, clone->width * clone->height); } return clone; @@ -130,8 +130,8 @@ gfx_pixmap_t *gfx_new_pixmap(int xl, int yl, int resid, int loop, int cel) { pxm->data = NULL; pxm->palette = NULL; - pxm->index_xl = xl; - pxm->index_yl = yl; + pxm->index_width = xl; + pxm->index_height = yl; pxm->ID = resid; pxm->loop = loop; @@ -168,7 +168,7 @@ gfx_pixmap_t *gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) { return pixmap; } - size = pixmap->index_xl * pixmap->index_yl; + size = pixmap->index_width * pixmap->index_height; if (!size) size = 1; @@ -199,14 +199,14 @@ gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { } if (pixmap->flags & GFX_PIXMAP_FLAG_SCALED_INDEX) { - pixmap->xl = pixmap->index_xl; - pixmap->yl = pixmap->index_yl; + pixmap->width = pixmap->index_width; + pixmap->height = pixmap->index_height; } else { - pixmap->xl = pixmap->index_xl * mode->xfact; - pixmap->yl = pixmap->index_yl * mode->yfact; + pixmap->width = pixmap->index_width * mode->xfact; + pixmap->height = pixmap->index_height * mode->yfact; } - size = pixmap->xl * pixmap->yl * mode->bytespp; + size = pixmap->width * pixmap->height * mode->bytespp; if (!size) size = 1; @@ -251,8 +251,8 @@ gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode return pixmap; } - xl = pixmap->index_xl; - yl = pixmap->index_yl; + xl = pixmap->index_width; + yl = pixmap->index_height; linewidth = xfact * xl; initial_new_data = new_data = (byte *)sci_malloc(linewidth * yfact * yl); @@ -281,8 +281,8 @@ gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode pixmap->flags |= GFX_PIXMAP_FLAG_SCALED_INDEX; - pixmap->index_xl = linewidth; - pixmap->index_yl *= yfact; + pixmap->index_width = linewidth; + pixmap->index_height *= yfact; return pixmap; } diff --git a/engines/sci/gfx/gfx_tools.h b/engines/sci/gfx/gfx_tools.h index 451dfefc98..3e192a1deb 100644 --- a/engines/sci/gfx/gfx_tools.h +++ b/engines/sci/gfx/gfx_tools.h @@ -80,7 +80,7 @@ gfx_pixmap_t *gfx_new_pixmap(int xl, int yl, int resid, int loop, int cel); ** (int) cel: For cels: The pixmap's cel number ** Returns : (gfx_pixmap_t *) The newly allocated pixmap ** The following fiels are initialized: -** ID, loop, cel, index_xl, index_yl, xl, yl, data <- NULL, +** ID, loop, cel, index_width, index_height, xl, yl, data <- NULL, ** alpha_map <- NULL, internal.handle <- 0, internal.info <- NULL, colors <- NULL, ** index_scaled <- 0 */ diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp index e4dfa4ae11..81126019bd 100644 --- a/engines/sci/gfx/gfx_widgets.cpp +++ b/engines/sci/gfx/gfx_widgets.cpp @@ -112,7 +112,7 @@ static void _gfxw_print_widget(gfxw_widget_t *widget, int indentation) { sciprintf(" "); } - sciprintf("[(%d,%d)(%dx%d)]", widget->bounds.x, widget->bounds.y, widget->bounds.xl, widget->bounds.yl); + sciprintf("[(%d,%d)(%dx%d)]", widget->bounds.x, widget->bounds.y, widget->bounds.width, widget->bounds.height); for (i = 0; i < strlen(flags_list); i++) if (widget->flags & (1 << i)) @@ -374,14 +374,14 @@ static int _gfxwop_basic_superarea_of(gfxw_widget_t *widget, gfxw_widget_t *othe //*** Boxes *** static rect_t _move_rect(rect_t rect, Common::Point point) { - return gfx_rect(rect.x + point.x, rect.y + point.y, rect.xl, rect.yl); + return gfx_rect(rect.x + point.x, rect.y + point.y, rect.width, rect.height); } static void _split_rect(rect_t rect, Common::Point *p1, Common::Point *p2) { p1->x = rect.x; p1->y = rect.y; - p2->x = rect.x + rect.xl; - p2->y = rect.y + rect.yl; + p2->x = rect.x + rect.width; + p2->y = rect.y + rect.height; } static Common::Point _move_point(rect_t rect, Common::Point point) { @@ -511,7 +511,7 @@ static int _gfxwop_rect_draw(gfxw_widget_t *widget, Common::Point pos) { DRAW_ASSERT(widget, GFXW_RECT); GFX_ASSERT(gfxop_draw_rectangle(rect->visual->gfx_state, gfx_rect(rect->bounds.x + pos.x, rect->bounds.y + pos.y, - rect->bounds.xl - 1, rect->bounds.yl - 1), rect->color, rect->line_mode, rect->line_style)); + rect->bounds.width - 1, rect->bounds.height - 1), rect->color, rect->line_mode, rect->line_style)); return 0; } @@ -529,8 +529,8 @@ void _gfxw_set_ops_RECT(gfxw_widget_t *prim) { gfxw_primitive_t *gfxw_new_rect(rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) { gfxw_primitive_t *prim = _gfxw_new_primitive(rect, color, line_mode, line_style, GFXW_RECT); - prim->bounds.xl++; - prim->bounds.yl++; // Since it is actually one pixel bigger in each direction + prim->bounds.width++; + prim->bounds.height++; // Since it is actually one pixel bigger in each direction _gfxw_set_ops_RECT(GFXW(prim)); @@ -544,12 +544,12 @@ static int _gfxwop_line_draw(gfxw_widget_t *widget, Common::Point pos) { rect_t linepos = widget->bounds; Common::Point p1, p2; - linepos.xl--; - linepos.yl--; + linepos.width--; + linepos.height--; if (widget->type == GFXW_INVERSE_LINE) { - linepos.x += linepos.xl; - linepos.xl = -linepos.xl; + linepos.x += linepos.width; + linepos.width = -linepos.width; } else { DRAW_ASSERT(widget, GFXW_LINE); } @@ -581,21 +581,21 @@ gfxw_primitive_t *gfxw_new_line(Common::Point start, Common::Point end, gfx_colo byte inverse = 0; - if (line.xl < 0) { - line.x += line.xl; - line.y += line.yl; - line.xl = -line.xl; - line.yl = -line.yl; + if (line.width < 0) { + line.x += line.width; + line.y += line.height; + line.width = -line.width; + line.height = -line.height; } - if (line.yl < 0) { + if (line.height < 0) { inverse = 1; - line.x += line.xl; - line.xl = -line.xl; + line.x += line.width; + line.width = -line.width; } - line.xl++; - line.yl++; + line.width++; + line.height++; prim = _gfxw_new_primitive(line, color, line_mode, line_style, inverse ? GFXW_INVERSE_LINE : GFXW_LINE); @@ -733,7 +733,7 @@ static int _gfxwop_dyn_view_draw(gfxw_widget_t *widget, Common::Point pos) { red.visual.g = red.visual.b = 0; red.mask = GFX_MASK_VISUAL; GFX_ASSERT(gfxop_draw_rectangle(view->visual->gfx_state, - gfx_rect(view->bounds.x + pos.x, view->bounds.y + pos.y, view->bounds.xl - 1, view->bounds.yl - 1), red, 0, 0)); + gfx_rect(view->bounds.x + pos.x, view->bounds.y + pos.y, view->bounds.width - 1, view->bounds.height - 1), red, 0, 0)); */ return 0; @@ -925,7 +925,7 @@ static int _gfxwop_text_alloc_and_draw(gfxw_widget_t *widget, Common::Point pos) gfxw_text_t *text = (gfxw_text_t *)widget; DRAW_ASSERT(widget, GFXW_TEXT); - text->text_handle = gfxop_new_text(widget->visual->gfx_state, text->font_nr, text->text, text->bounds.xl, + text->text_handle = gfxop_new_text(widget->visual->gfx_state, text->font_nr, text->text, text->bounds.width, text->halign, text->valign, text->color1, text->color2, text->bgcolor, text->text_flags); text->draw = _gfxwop_text_draw; @@ -1005,18 +1005,18 @@ gfxw_text_t *gfxw_new_text(gfx_state_t *state, rect_t area, int font, const char strcpy(widget->text, text); - gfxop_get_text_params(state, font, text, area.xl, &(widget->width), &(widget->height), text_flags, + gfxop_get_text_params(state, font, text, area.width, &(widget->width), &(widget->height), text_flags, &(widget->lines_nr), &(widget->lineheight), &(widget->lastline_width)); /* FIXME: Window is too big - area.x += _calc_needmove(halign, area.xl, widget->width); - area.y += _calc_needmove(valign, area.yl, widget->height); + area.x += _calc_needmove(halign, area.width, widget->width); + area.y += _calc_needmove(valign, area.height, widget->height); */ if (halign == ALIGN_LEFT) - area.xl = widget->width; + area.width = widget->width; if (valign == ALIGN_TOP) - area.yl = widget->height; + area.height = widget->height; widget->bounds = area; @@ -1083,7 +1083,7 @@ static int _w_gfxwop_container_print(gfxw_widget_t *widget, int indentation) { } sciprintf(" viszone=((%d,%d),(%dx%d))\n", container->zone.x, container->zone.y, - container->zone.xl, container->zone.yl); + container->zone.width, container->zone.height); indent(indentation); sciprintf("--dirty:\n"); @@ -1091,7 +1091,7 @@ static int _w_gfxwop_container_print(gfxw_widget_t *widget, int indentation) { dirty = container->dirty; while (dirty) { indent(indentation + 1); - sciprintf("dirty(%d,%d, (%dx%d))\n", dirty->rect.x, dirty->rect.y, dirty->rect.xl, dirty->rect.yl); + sciprintf("dirty(%d,%d, (%dx%d))\n", dirty->rect.x, dirty->rect.y, dirty->rect.width, dirty->rect.height); dirty = dirty->next; } @@ -1552,7 +1552,7 @@ static int _gfxwop_visual_draw(gfxw_widget_t *widget, Common::Point pos) { if (err) { GFXERROR("Error while clearing dirty rect (%d,%d,(%dx%d))\n", dirty->rect.x, - dirty->rect.y, dirty->rect.xl, dirty->rect.yl); + dirty->rect.y, dirty->rect.width, dirty->rect.height); if (err == GFX_FATAL) return err; } @@ -1768,8 +1768,8 @@ static int _gfxwop_port_add_dirty(gfxw_container_t *widget, rect_t dirty, int pr _gfxwop_container_add_dirty(widget, dirty, propagate); DDIRTY(stderr, "Added dirty to ID %d\n", widget->ID); - DDIRTY(stderr, "dirty= (%d,%d,%d,%d) bounds (%d,%d,%d,%d)\n", dirty.x, dirty.x, dirty.xl, dirty.yl, - widget->bounds.x, widget->bounds.y, widget->bounds.xl, widget->bounds.yl); + DDIRTY(stderr, "dirty= (%d,%d,%d,%d) bounds (%d,%d,%d,%d)\n", dirty.x, dirty.x, dirty.width, dirty.height, + widget->bounds.x, widget->bounds.y, widget->bounds.width, widget->bounds.height); #if 0 // FIXME: This is a worthwhile optimization if (self->port_bg) { @@ -1957,7 +1957,7 @@ gfxw_snapshot_t *gfxw_make_snapshot(gfxw_visual_t *visual, rect_t area) { // Work around subset semantics in gfx_rect_subset. // This fixes the help icon in LSL5. */ - if (retval->area.xl == 320) retval->area.xl = 321; + if (retval->area.width == 320) retval->area.width = 321; return retval; } diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 83067eeac7..479e530548 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -443,7 +443,7 @@ int menubar_map_pointer(EngineState *s, int *menu_nr, int *item_nr, gfxw_port_t if (menu->items_nr <= row) return 1; - if ((s->gfx_state->pointer_pos.x < port->bounds.x) || (s->gfx_state->pointer_pos.x > port->bounds.x + port->bounds.xl)) + if ((s->gfx_state->pointer_pos.x < port->bounds.x) || (s->gfx_state->pointer_pos.x > port->bounds.x + port->bounds.width)) return 1; if (menubar_item_valid(s, *menu_nr, row)) diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index ea043b27b5..ae385cd483 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -85,8 +85,8 @@ static void _gfxop_scale_rect(rect_t *rect, gfx_mode_t *mode) { rect->x *= xfact; rect->y *= yfact; - rect->xl *= xfact; - rect->yl *= yfact; + rect->width *= xfact; + rect->height *= yfact; } static void _gfxop_scale_point(Common::Point *point, gfx_mode_t *mode) { @@ -100,35 +100,35 @@ static void _gfxop_scale_point(Common::Point *point, gfx_mode_t *mode) { int _gfxop_clip(rect_t *rect, rect_t clipzone) { // Returns 1 if nothing is left */ #if 0 - printf("Clipping (%d, %d) size (%d, %d) by (%d,%d)(%d,%d)\n", rect->x, rect->y, rect->xl, rect->yl, - clipzone.x, clipzone.y, clipzone.xl, clipzone.yl); + printf("Clipping (%d, %d) size (%d, %d) by (%d,%d)(%d,%d)\n", rect->x, rect->y, rect->width, rect->height, + clipzone.x, clipzone.y, clipzone.width, clipzone.height); #endif if (rect->x < clipzone.x) { - rect->xl -= (clipzone.x - rect->x); + rect->width -= (clipzone.x - rect->x); rect->x = clipzone.x; } if (rect->y < clipzone.y) { - rect->yl -= (clipzone.y - rect->y); + rect->height -= (clipzone.y - rect->y); rect->y = clipzone.y; } - if (rect->x + rect->xl > clipzone.x + clipzone.xl) - rect->xl = (clipzone.x + clipzone.xl) - rect->x; + if (rect->x + rect->width > clipzone.x + clipzone.width) + rect->width = (clipzone.x + clipzone.width) - rect->x; - if (rect->y + rect->yl > clipzone.y + clipzone.yl) - rect->yl = (clipzone.y + clipzone.yl) - rect->y; + if (rect->y + rect->height > clipzone.y + clipzone.height) + rect->height = (clipzone.y + clipzone.height) - rect->y; - if (rect->xl < 0) - rect->xl = 0; - if (rect->yl < 0) - rect->yl = 0; + if (rect->width < 0) + rect->width = 0; + if (rect->height < 0) + rect->height = 0; #if 0 - printf(" => (%d, %d) size (%d, %d)\n", rect->x, rect->y, rect->xl, rect->yl); + printf(" => (%d, %d) size (%d, %d)\n", rect->x, rect->y, rect->width, rect->height); #endif - return (rect->xl <= 0 || rect->yl <= 0); + return (rect->width <= 0 || rect->height <= 0); } static int _gfxop_grab_pixmap(gfx_state_t *state, gfx_pixmap_t **pxmp, int x, int y, @@ -146,14 +146,14 @@ static int _gfxop_grab_pixmap(gfx_state_t *state, gfx_pixmap_t **pxmp, int x, in if (!*pxmp) *pxmp = gfx_new_pixmap(unscaled_xl, unscaled_yl, GFX_RESID_NONE, 0, 0); else - if (xl * yl > (*pxmp)->xl * (*pxmp)->yl) { + if (xl * yl > (*pxmp)->width * (*pxmp)->height) { gfx_pixmap_free_data(*pxmp); (*pxmp)->data = NULL; } if (!(*pxmp)->data) { - (*pxmp)->index_xl = unscaled_xl + 1; - (*pxmp)->index_yl = unscaled_yl + 1; + (*pxmp)->index_width = unscaled_xl + 1; + (*pxmp)->index_height = unscaled_yl + 1; gfx_pixmap_alloc_data(*pxmp, state->driver->mode); } return state->driver->grab_pixmap(state->driver, *zone, *pxmp, priority ? GFX_MASK_PRIORITY : GFX_MASK_VISUAL); @@ -161,7 +161,7 @@ static int _gfxop_grab_pixmap(gfx_state_t *state, gfx_pixmap_t **pxmp, int x, in #define DRAW_LOOP(condition) \ { \ - rect_t drawrect = gfx_rect(pos.x, pos.y, pxm->index_xl, pxm->index_yl); \ + rect_t drawrect = gfx_rect(pos.x, pos.y, pxm->index_width, pxm->index_height); \ int offset, base_offset; \ int read_offset, base_read_offset; \ int x,y; \ @@ -175,10 +175,10 @@ static int _gfxop_grab_pixmap(gfx_state_t *state, gfx_pixmap_t **pxmp, int x, in return; \ \ offset = base_offset = drawrect.x + drawrect.y * 320; \ - read_offset = base_read_offset = (drawrect.x - pos.x) + ((drawrect.y - pos.y) * pxm->index_xl); \ + read_offset = base_read_offset = (drawrect.x - pos.x) + ((drawrect.y - pos.y) * pxm->index_width); \ \ - for (y = 0; y < drawrect.yl; y++) { \ - for (x = 0; x < drawrect.xl; x++) \ + for (y = 0; y < drawrect.height; y++) { \ + for (x = 0; x < drawrect.width; x++) \ if (pxm->index_data[read_offset++] != pxm->color_key) { \ if (condition) \ map->index_data[offset++] = color; \ @@ -188,7 +188,7 @@ static int _gfxop_grab_pixmap(gfx_state_t *state, gfx_pixmap_t **pxmp, int x, in ++offset; \ \ offset = base_offset += 320; \ - read_offset = base_read_offset += pxm->index_xl; \ + read_offset = base_read_offset += pxm->index_width; \ } \ } @@ -225,7 +225,7 @@ static int _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) { static int _gfxop_draw_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm, int priority, int control, rect_t src, rect_t dest, rect_t clip, int static_buf, gfx_pixmap_t *control_map, gfx_pixmap_t *priority_map) { int error; - rect_t clipped_dest = gfx_rect(dest.x, dest.y, dest.xl, dest.yl); + rect_t clipped_dest = gfx_rect(dest.x, dest.y, dest.width, dest.height); if (control >= 0 || priority >= 0) { Common::Point original_pos = Common::Point(dest.x / driver->mode->xfact, dest.y / driver->mode->yfact); @@ -244,15 +244,15 @@ static int _gfxop_draw_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm, int prior src.x += clipped_dest.x - dest.x; src.y += clipped_dest.y - dest.y; - src.xl = clipped_dest.xl; - src.yl = clipped_dest.yl; + src.width = clipped_dest.width; + src.height = clipped_dest.height; error = _gfxop_install_pixmap(driver, pxm); if (error) return error; DDIRTY(stderr, "\\-> Drawing to actual %d %d %d %d\n", clipped_dest.x / driver->mode->xfact, - clipped_dest.y / driver->mode->yfact, clipped_dest.xl / driver->mode->xfact, clipped_dest.yl / driver->mode->yfact); + clipped_dest.y / driver->mode->yfact, clipped_dest.width / driver->mode->xfact, clipped_dest.height / driver->mode->yfact); error = driver->draw_pixmap(driver, pxm, priority, src, clipped_dest, static_buf ? GFX_BUFFER_STATIC : GFX_BUFFER_BACK); @@ -299,7 +299,7 @@ static int _gfxop_update_box(gfx_state_t *state, rect_t box) { _gfxop_scale_rect(&box, state->driver->mode); if ((retval = _gfxop_buffer_propagate_box(state, box, GFX_BUFFER_FRONT))) { - GFXERROR("Error occured while propagating box (%d,%d,%d,%d) to front buffer\n", box.x, box.y, box.xl, box.yl); + GFXERROR("Error occured while propagating box (%d,%d,%d,%d) to front buffer\n", box.x, box.y, box.width, box.height); return retval; } return GFX_OK; @@ -316,14 +316,14 @@ static gfx_dirty_rect_t *_rect_create(rect_t box) { } gfx_dirty_rect_t *gfxdr_add_dirty(gfx_dirty_rect_t *base, rect_t box, int strategy) { - if (box.xl < 0) { - box.x += box.xl; - box.xl = - box.xl; + if (box.width < 0) { + box.x += box.width; + box.width = - box.width; } - if (box.yl < 0) { - box.y += box.yl; - box.yl = - box.yl; + if (box.height < 0) { + box.y += box.height; + box.height = - box.height; } #ifdef GFXOP_DEBUG_DIRTY fprintf(stderr, "Adding new dirty (%d %d %d %d)\n", @@ -375,15 +375,15 @@ static void _gfxop_add_dirty(gfx_state_t *state, rect_t box) { static void _gfxop_add_dirty_x(gfx_state_t *state, rect_t box) { // Extends the box size by one before adding (used for lines) - if (box.xl < 0) - box.xl--; + if (box.width < 0) + box.width--; else - box.xl++; + box.width++; - if (box.yl < 0) - box.yl--; + if (box.height < 0) + box.height--; else - box.yl++; + box.height++; _gfxop_add_dirty(state, box); } @@ -513,20 +513,20 @@ int gfxop_exit(gfx_state_t *state) { static int _gfxop_scan_one_bitmask(gfx_pixmap_t *pixmap, rect_t zone) { int retval = 0; - int pixmap_xscale = pixmap->index_xl / 320; - int pixmap_yscale = pixmap->index_yl / 200; - int line_width = pixmap_yscale * pixmap->index_xl; + int pixmap_xscale = pixmap->index_width / 320; + int pixmap_yscale = pixmap->index_height / 200; + int line_width = pixmap_yscale * pixmap->index_width; int startindex = (line_width * zone.y) + (zone.x * pixmap_xscale); startindex += pixmap_xscale >> 1; // Center on X - startindex += (pixmap_yscale >> 1) * pixmap->index_xl; // Center on Y + startindex += (pixmap_yscale >> 1) * pixmap->index_width; // Center on Y - if (_gfxop_clip(&zone, gfx_rect(0, 0, pixmap->index_xl, pixmap->index_yl))) + if (_gfxop_clip(&zone, gfx_rect(0, 0, pixmap->index_width, pixmap->index_height))) return 0; - while (zone.yl--) { + while (zone.height--) { int i; - for (i = 0; i < (zone.xl * pixmap_xscale); i += pixmap_xscale) + for (i = 0; i < (zone.width * pixmap_xscale); i += pixmap_xscale) retval |= (1 << ((pixmap->index_data[startindex + i]) & 0xf)); startindex += line_width; @@ -541,8 +541,8 @@ int gfxop_scan_bitmask(gfx_state_t *state, rect_t area, gfx_map_mask_t map) { _gfxop_clip(&area, gfx_rect(0, 10, 320, 200)); - if (area.xl <= 0 - || area.yl <= 0) + if (area.width <= 0 + || area.height <= 0) return 0; if (map & GFX_MASK_VISUAL) @@ -571,27 +571,27 @@ int gfxop_set_clip_zone(gfx_state_t *state, rect_t zone) { yfact = state->driver->mode->yfact; if (zone.x < MIN_X) { - zone.xl -= (zone.x - MIN_X); + zone.width -= (zone.x - MIN_X); zone.x = MIN_X; } if (zone.y < MIN_Y) { - zone.yl -= (zone.y - MIN_Y); + zone.height -= (zone.y - MIN_Y); zone.y = MIN_Y; } - if (zone.x + zone.xl > MAX_X) - zone.xl = MAX_X + 1 - zone.x; + if (zone.x + zone.width > MAX_X) + zone.width = MAX_X + 1 - zone.x; - if (zone.y + zone.yl > MAX_Y) - zone.yl = MAX_Y + 1 - zone.y; + if (zone.y + zone.height > MAX_Y) + zone.height = MAX_Y + 1 - zone.y; memcpy(&(state->clip_zone_unscaled), &zone, sizeof(rect_t)); state->clip_zone.x = state->clip_zone_unscaled.x * xfact; state->clip_zone.y = state->clip_zone_unscaled.y * yfact; - state->clip_zone.xl = state->clip_zone_unscaled.xl * xfact; - state->clip_zone.yl = state->clip_zone_unscaled.yl * yfact; + state->clip_zone.width = state->clip_zone_unscaled.width * xfact; + state->clip_zone.height = state->clip_zone_unscaled.height * yfact; return GFX_OK; } @@ -687,42 +687,42 @@ static void clip_line_partial(float *start, float *end, float delta_val, float p static int line_clip(rect_t *line, rect_t clip, int xfact, int yfact) { // returns 1 if nothing is left, or 0 if part of the line is in the clip window // Compensate for line thickness (should match precisely) - clip.xl -= xfact; - clip.yl -= yfact; + clip.width -= xfact; + clip.height -= yfact; - if (!line->xl) { // vbar - if (line->x < clip.x || line->x >= (clip.x + clip.xl)) + if (!line->width) { // vbar + if (line->x < clip.x || line->x >= (clip.x + clip.width)) return 1; - return line_check_bar(&(line->y), &(line->yl), clip.y, clip.yl); + return line_check_bar(&(line->y), &(line->height), clip.y, clip.height); } else { - if (!line->yl) {// hbar - if (line->y < clip.y || line->y >= (clip.y + clip.yl)) + if (!line->height) {// hbar + if (line->y < clip.y || line->y >= (clip.y + clip.height)) return 1; - return line_check_bar(&(line->x), &(line->xl), clip.x, clip.xl); + return line_check_bar(&(line->x), &(line->width), clip.x, clip.width); } else { // "normal" line float start = 0.0, end = 1.0; - float xv = (float)line->xl; - float yv = (float)line->yl; + float xv = (float)line->width; + float yv = (float)line->height; - if (line->xl < 0) - clip_line_partial(&start, &end, (float)(1.0 / xv), (float)line->x, (float)(clip.x + clip.xl), (float)clip.x); + if (line->width < 0) + clip_line_partial(&start, &end, (float)(1.0 / xv), (float)line->x, (float)(clip.x + clip.width), (float)clip.x); else - clip_line_partial(&start, &end, (float)(1.0 / xv), (float)line->x, (float)clip.x, (float)(clip.x + clip.xl)); + clip_line_partial(&start, &end, (float)(1.0 / xv), (float)line->x, (float)clip.x, (float)(clip.x + clip.width)); - if (line->yl < 0) - clip_line_partial(&start, &end, (float)(1.0 / yv), (float)line->y, (float)(clip.y + clip.yl), (float)clip.y); + if (line->height < 0) + clip_line_partial(&start, &end, (float)(1.0 / yv), (float)line->y, (float)(clip.y + clip.height), (float)clip.y); else - clip_line_partial(&start, &end, (float)(1.0 / yv), (float)line->y, (float)clip.y, (float)(clip.y + clip.yl)); + clip_line_partial(&start, &end, (float)(1.0 / yv), (float)line->y, (float)clip.y, (float)(clip.y + clip.height)); line->x += (int)(xv * start); line->y += (int)(yv * start); - line->xl = (int)(xv * (end - start)); - line->yl = (int)(yv * (end - start)); + line->width = (int)(xv * (end - start)); + line->height = (int)(yv * (end - start)); return (start > 1.0 || end < 0.0); } @@ -738,8 +738,8 @@ static int point_clip(Common::Point *start, Common::Point *end, rect_t clip, int start->x = line.x; start->y = line.y; - end->x = line.x + line.xl; - end->y = line.y + line.yl; + end->x = line.x + line.width; + end->y = line.y + line.height; return retval; } @@ -841,8 +841,8 @@ static int _gfxop_draw_line_clipped(gfx_state_t *state, Common::Point start, Com if (start.x < state->clip_zone.x || start.y < state->clip_zone.y - || end.x >= (state->clip_zone.x + state->clip_zone.xl) - || end.y >= (state->clip_zone.y + state->clip_zone.yl)) + || end.x >= (state->clip_zone.x + state->clip_zone.width) + || end.y >= (state->clip_zone.y + state->clip_zone.height)) if (point_clip(&start, &end, state->clip_zone, state->driver->mode->xfact - 1, state->driver->mode->yfact - 1)) return GFX_OK; // Clipped off @@ -907,23 +907,23 @@ int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx if (line_mode == GFX_LINE_MODE_FINE) { xunit = yunit = 1; - xl = 1 + (rect.xl - 1) * xfact; - yl = 1 + (rect.yl - 1) * yfact; + xl = 1 + (rect.width - 1) * xfact; + yl = 1 + (rect.height - 1) * yfact; x = rect.x * xfact + (xfact - 1); y = rect.y * yfact + (yfact - 1); } else { xunit = xfact; yunit = yfact; - xl = rect.xl * xfact; - yl = rect.yl * yfact; + xl = rect.width * xfact; + yl = rect.height * yfact; x = rect.x * xfact; y = rect.y * yfact; } upper_left_u = Common::Point(rect.x, rect.y); - upper_right_u = Common::Point(rect.x + rect.xl, rect.y); - lower_left_u = Common::Point(rect.x, rect.y + rect.yl); - lower_right_u = Common::Point(rect.x + rect.xl, rect.y + rect.yl); + upper_right_u = Common::Point(rect.x + rect.width, rect.y); + lower_left_u = Common::Point(rect.x, rect.y + rect.height); + lower_right_u = Common::Point(rect.x + rect.width, rect.y + rect.height); upper_left = Common::Point(x, y); upper_right = Common::Point(x + xl, y); @@ -942,7 +942,7 @@ int gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx #undef PARTIAL_LINE if (retval) { - GFXERROR("Failed to draw rectangle (%d,%d)+(%d,%d)\n", rect.x, rect.y, rect.xl, rect.yl); + GFXERROR("Failed to draw rectangle (%d,%d)+(%d,%d)\n", rect.x, rect.y, rect.width, rect.height); return retval; } @@ -981,8 +981,8 @@ int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color if (!(color1.mask & (GFX_MASK_VISUAL | GFX_MASK_PRIORITY))) return GFX_OK; - if (box.xl <= 1 || box.yl <= 1) { - GFXDEBUG("Attempt to draw box with size %dx%d\n", box.xl, box.yl); + if (box.width <= 1 || box.height <= 1) { + GFXDEBUG("Attempt to draw box with size %dx%d\n", box.width, box.height); return GFX_OK; } @@ -1000,16 +1000,16 @@ int gfxop_draw_box(gfx_state_t *state, rect_t box, gfx_color_t color1, gfx_color reverse = 1; case GFX_BOX_SHADE_RIGHT: driver_shade_type = GFX_SHADE_HORIZONTALLY; - mod_offset = (float)(((new_box.x - box.x) * 1.0) / (box.xl * 1.0)); - mod_breadth = (float)((new_box.xl * 1.0) / (box.xl * 1.0)); + mod_offset = (float)(((new_box.x - box.x) * 1.0) / (box.width * 1.0)); + mod_breadth = (float)((new_box.width * 1.0) / (box.width * 1.0)); break; case GFX_BOX_SHADE_UP: reverse = 1; case GFX_BOX_SHADE_DOWN: driver_shade_type = GFX_SHADE_VERTICALLY; - mod_offset = (float)(((new_box.y - box.y) * 1.0) / (box.yl * 1.0)); - mod_breadth = (float)((new_box.yl * 1.0) / (box.yl * 1.0)); + mod_offset = (float)(((new_box.y - box.y) * 1.0) / (box.height * 1.0)); + mod_breadth = (float)((new_box.height * 1.0) / (box.height * 1.0)); break; default: @@ -1074,7 +1074,7 @@ static int _gfxop_buffer_propagate_box(gfx_state_t *state, rect_t box, gfx_buffe return GFX_OK; if ((error = state->driver->update(state->driver, box, Common::Point(box.x, box.y), buffer))) { - GFXERROR("Error occured while updating region (%d,%d,%d,%d) in buffer %d\n", box.x, box.y, box.xl, box.yl, buffer); + GFXERROR("Error occured while updating region (%d,%d,%d,%d) in buffer %d\n", box.x, box.y, box.width, box.height, buffer); return error; } @@ -1764,8 +1764,8 @@ int gfxop_get_cel_parameters(gfx_state_t *state, int nr, int loop, int cel, int } pxm = view->loops[loop].cels[cel]; - *width = pxm->index_xl; - *height = pxm->index_yl; + *width = pxm->index_width; + *height = pxm->index_height; offset->x = pxm->xoffset; offset->y = pxm->yoffset; @@ -1793,10 +1793,10 @@ static int _gfxop_draw_cel_buffer(gfx_state_t *state, int nr, int loop, int cel, pos.y *= state->driver->mode->yfact; if (!static_buf) - _gfxop_add_dirty(state, gfx_rect(old_x, old_y, pxm->index_xl, pxm->index_yl)); + _gfxop_add_dirty(state, gfx_rect(old_x, old_y, pxm->index_width, pxm->index_height)); - return _gfxop_draw_pixmap(state->driver, pxm, priority, control, gfx_rect(0, 0, pxm->xl, pxm->yl), - gfx_rect(pos.x, pos.y, pxm->xl, pxm->yl), state->clip_zone, static_buf , state->control_map, + return _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); } @@ -2061,11 +2061,11 @@ int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone) break; case ALIGN_CENTER: - pos.y += (zone.yl - (line_height * handle->lines_nr)) >> 1; + pos.y += (zone.height - (line_height * handle->lines_nr)) >> 1; break; case ALIGN_BOTTOM: - pos.y += (zone.yl - (line_height * handle->lines_nr)); + pos.y += (zone.height - (line_height * handle->lines_nr)); break; default: @@ -2094,11 +2094,11 @@ int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone) break; case ALIGN_CENTER: - pos.x += (zone.xl - pxm->xl) >> 1; + pos.x += (zone.width - pxm->width) >> 1; break; case ALIGN_RIGHT: - pos.x += (zone.xl - pxm->xl); + pos.x += (zone.width - pxm->width); break; default: @@ -2106,12 +2106,12 @@ int gfxop_draw_text(gfx_state_t *state, gfx_text_handle_t *handle, rect_t zone) return GFX_FATAL; // Internal error... } - pos.xl = pxm->xl; - pos.yl = pxm->yl; + 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->xl, pxm->yl), pos, state->clip_zone, 0, state->control_map, state->priority_map); + gfx_rect(0, 0, pxm->width, pxm->height), pos, state->clip_zone, 0, state->control_map, state->priority_map); pos.y += line_height; } @@ -2126,7 +2126,7 @@ gfx_pixmap_t *gfxop_grab_pixmap(gfx_state_t *state, rect_t area) { _gfxop_full_pointer_refresh(state); _gfxop_scale_rect(&area, state->driver->mode); - if (_gfxop_grab_pixmap(state, &pixmap, area.x, area.y, area.xl, area.yl, 0, &resultzone)) + if (_gfxop_grab_pixmap(state, &pixmap, area.x, area.y, area.width, area.height, 0, &resultzone)) return NULL; // area CUT the visual screen had a null or negative size return pixmap; @@ -2143,7 +2143,7 @@ int gfxop_draw_pixmap(gfx_state_t *state, gfx_pixmap_t *pxm, rect_t zone, Common _gfxop_full_pointer_refresh(state); - target = gfx_rect(pos.x, pos.y, zone.xl, zone.yl); + target = gfx_rect(pos.x, pos.y, zone.width, zone.height); _gfxop_add_dirty(state, target); diff --git a/engines/sci/gfx/resmgr.cpp b/engines/sci/gfx/resmgr.cpp index 82af489874..a42ff298c7 100644 --- a/engines/sci/gfx/resmgr.cpp +++ b/engines/sci/gfx/resmgr.cpp @@ -370,8 +370,8 @@ static int get_pic_id(gfx_resource_t *res) { static void _gfxr_unscale_pixmap_index_data(gfx_pixmap_t *pxm, gfx_mode_t *mode) { int xmod = mode->xfact; // Step size horizontally - int ymod = pxm->index_xl * mode->yfact; // Vertical step size - int maxpos = pxm->index_xl * pxm->index_yl; + int ymod = pxm->index_width * mode->yfact; // Vertical step size + int maxpos = pxm->index_width * pxm->index_height; int pos; byte *dest = pxm->index_data; @@ -381,14 +381,14 @@ static void _gfxr_unscale_pixmap_index_data(gfx_pixmap_t *pxm, gfx_mode_t *mode) for (pos = 0; pos < maxpos; pos += ymod) { int c; - for (c = 0; c < pxm->index_xl; c += xmod) + for (c = 0; c < pxm->index_width; c += xmod) *dest++ = pxm->index_data[pos + c]; // No overwrite since line and offset readers move much faster (proof by in-duction, trivial // and left to the reader) } - pxm->index_xl /= mode->xfact; - pxm->index_yl /= mode->yfact; + pxm->index_width /= mode->xfact; + pxm->index_height /= mode->yfact; pxm->flags &= ~GFX_PIXMAP_FLAG_SCALED_INDEX; } diff --git a/engines/sci/gfx/resource/res_pic.cpp b/engines/sci/gfx/resource/res_pic.cpp index f7c2a359ad..622d65bb56 100644 --- a/engines/sci/gfx/resource/res_pic.cpp +++ b/engines/sci/gfx/resource/res_pic.cpp @@ -181,7 +181,7 @@ gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, int sci1) { pic->priority_map->palette = gfx_sci0_image_pal[sci0_palette]->getref(); pic->control_map->palette = gfx_sci0_image_pal[sci0_palette]->getref(); - pic->undithered_buffer_size = pic->visual_map->index_xl * pic->visual_map->index_yl; + pic->undithered_buffer_size = pic->visual_map->index_width * pic->visual_map->index_height; pic->undithered_buffer = NULL; pic->priorityTable = NULL; @@ -233,8 +233,8 @@ static void _gfxr_auxbuf_line_draw(gfxr_pic_t *pic, rect_t line, int color, int unsigned char *buffer = pic->aux_map; int linewidth = 320; - dx = line.xl; - dy = line.yl; + dx = line.width; + dy = line.height; finalx = x + dx; finaly = y + dy; @@ -279,8 +279,8 @@ static void _gfxr_auxbuf_line_clear(gfxr_pic_t *pic, rect_t line, int color, int unsigned char *buffer = pic->aux_map; int linewidth = 320; - dx = line.xl; - dy = line.yl; + dx = line.width; + dy = line.height; finalx = x + dx; finaly = y + dy; @@ -391,7 +391,7 @@ static void _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *ma int done = 0; int found_interval = 0; - intervals[ivi][intervals_nr].xl = xl; + intervals[ivi][intervals_nr].width = xl; intervals[ivi][intervals_nr].tag = 0; intervals[ivi][intervals_nr++].xr = xr; @@ -402,11 +402,11 @@ static void _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *ma i = old_intervals_start_offset; while (!done && i < old_intervals_nr) { - if (intervals[!ivi][i].xl > xr + 1) + if (intervals[!ivi][i].width > xr + 1) done = 1; else if (intervals[!ivi][i].xr < xl - 1) { - int o_xl = intervals[!ivi][i].xl; + int o_xl = intervals[!ivi][i].width; int o_xr = intervals[!ivi][i].xr; if (o_xr == o_xl && !intervals[!ivi][i].tag) { // thin bar memcpy(intervals[ivi] + intervals_nr, intervals[ivi] + intervals_nr - 1, sizeof(struct interval_struct)); @@ -419,13 +419,13 @@ static void _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *ma old_intervals_start_offset = i; } else { int k = i; - int old_xl = intervals[!ivi][i].xl; + int old_xl = intervals[!ivi][i].width; int dwidth_l = abs(old_xl - xl); int old_xr, dwidth_r; int write_left_width, write_right_width; intervals[!ivi][i].tag = 1; - while (k + 1 < old_intervals_nr && intervals[!ivi][k+1].xl <= xr) { + while (k + 1 < old_intervals_nr && intervals[!ivi][k+1].width <= xr) { ++k; intervals[!ivi][i].tag = 1; } @@ -472,7 +472,7 @@ static void _gfxr_auxbuf_spread(gfxr_pic_t *pic, int *min_x, int *min_y, int *ma if (!fillmagc && intervals_nr) { fprintf(stderr, "AI L#%03d:", y); for (int j = 0; j < intervals_nr; j++) - fprintf(stderr, "%c[%03d,%03d]", intervals[ivi][j].tag ? ' ' : '-', intervals[ivi][j].xl, intervals[ivi][j].xr); + fprintf(stderr, "%c[%03d,%03d]", intervals[ivi][j].tag ? ' ' : '-', intervals[ivi][j].width, intervals[ivi][j].xr); fprintf(stderr, "\n"); } #endif @@ -861,8 +861,8 @@ static void _gfxr_draw_pattern(gfxr_pic_t *pic, int x, int y, int color, int pri // Rectangle boundaries.x = scaled_x - xsize; boundaries.y = scaled_y - ysize; - boundaries.xl = ((xsize + 1) << 1) + 1; - boundaries.yl = (ysize << 1) + 1; + boundaries.width = ((xsize + 1) << 1) + 1; + boundaries.height = (ysize << 1) + 1; if (pattern_code & PATTERN_FLAG_USE_PATTERN) { _gfxr_plot_aux_pattern(pic, x, y, pattern_size, 0, pattern_nr, drawenable, color, priority, @@ -919,7 +919,7 @@ static void _gfxr_draw_subline(gfxr_pic_t *pic, int x, int y, int ex, int ey, in end.x = ex; end.y = ey; - if (ex >= pic->visual_map->index_xl || ey >= pic->visual_map->index_yl || x < 0 || y < 0) { + if (ex >= pic->visual_map->index_width || ey >= pic->visual_map->index_height || x < 0 || y < 0) { fprintf(stderr, "While drawing pic0: INVALID LINE %d,%d,%d,%d\n", start.x, start.y, end.x, end.y); return; @@ -944,8 +944,8 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c line.x = x; line.y = y; - line.xl = ex - x; - line.yl = ey - y; + line.width = ex - x; + line.height = ey - y; if (x > 319 || y > 199 || x < 0 || y < 0 || ex > 319 || ey > 199 || ex < 0 || ey < 0) { GFXWARN("While building pic: Attempt to draw line (%d,%d) to (%d,%d): cmd was %d\n", x, y, ex, ey, cmd); @@ -957,7 +957,7 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c if (drawenable & GFX_MASK_CONTROL) { p0printf(" ctl:%x", control); - gfx_draw_line_pixmap_i(pic->control_map, Common::Point(x, y), Common::Point(x + line.xl, y + line.yl), control); + gfx_draw_line_pixmap_i(pic->control_map, Common::Point(x, y), Common::Point(x + line.width, y + line.height), control); } // Calculate everything that is changed to SOLID @@ -999,8 +999,8 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c rect_t drawrect; drawrect.x = x; drawrect.y = y; - drawrect.xl = scale_x; - drawrect.yl = scale_y; + drawrect.width = scale_x; + drawrect.height = scale_y; if (drawenable & GFX_MASK_VISUAL) gfx_draw_box_pixmap_i(pic->visual_map, drawrect, color); @@ -1665,7 +1665,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, pos += bytesize; if (nodraw) continue; - p0printf("(%d, %d)-(%d, %d)\n", posx, posy, posx + view->index_xl, posy + view->index_yl); + p0printf("(%d, %d)-(%d, %d)\n", posx, posy, posx + view->index_width, posy + view->index_height); // we can only safely replace the palette if it's static // *if it's not for some reason, we should die @@ -1689,24 +1689,24 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, // Hack to prevent overflowing the visual map buffer. // Yes, this does happen otherwise. - if (view->index_yl + sci_titlebar_size > 200) + if (view->index_height + sci_titlebar_size > 200) sci_titlebar_size = 0; // Set up mode structure for resizing the view Graphics::PixelFormat format = { 1, 0, 0, 0, 0, 0, 0, 0, 0 }; // 1byte/p, which handles masks and the rest for us - gfx_mode_t *mode = gfx_new_mode(pic->visual_map->index_xl / 320, - pic->visual_map->index_yl / 200, format, view->palette, 0); + gfx_mode_t *mode = gfx_new_mode(pic->visual_map->index_width / 320, + pic->visual_map->index_height / 200, format, view->palette, 0); gfx_xlate_pixmap(view, mode, GFX_XLATE_FILTER_NONE); gfx_free_mode(mode); if (flags & DRAWPIC01_FLAG_OVERLAID_PIC) view_transparentize(view, pic->visual_map, posx, sci_titlebar_size + posy, - view->index_xl, view->index_yl); + view->index_width, view->index_height); _gfx_crossblit_simple(pic->visual_map->index_data + (sci_titlebar_size * 320) + posy * 320 + posx, - view->index_data, pic->visual_map->index_xl, view->index_xl, - view->index_xl, view->index_yl, 1); + view->index_data, pic->visual_map->index_width, view->index_width, + view->index_width, view->index_height, 1); gfx_free_pixmap(NULL, view); } @@ -1795,24 +1795,24 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int flags, int default_palette, int size, // Set up mode structure for resizing the view Graphics::PixelFormat format = { 1, 0, 0, 0, 0, 0, 0, 0, 0 }; // 1 byte/p, which handles masks and the rest for us - gfx_mode_t *mode = gfx_new_mode(pic->visual_map->index_xl / 320, pic->visual_map->index_yl / 200, format, view->palette, 0); + gfx_mode_t *mode = gfx_new_mode(pic->visual_map->index_width / 320, pic->visual_map->index_height / 200, format, view->palette, 0); gfx_xlate_pixmap(view, mode, GFX_XLATE_FILTER_NONE); gfx_free_mode(mode); if (flags & DRAWPIC01_FLAG_OVERLAID_PIC) - view_transparentize(view, pic->visual_map, 0, 0, view->index_xl, view->index_yl); + view_transparentize(view, pic->visual_map, 0, 0, view->index_width, view->index_height); // Hack to prevent overflowing the visual map buffer. // Yes, this does happen otherwise. - if (view->index_yl + sci_titlebar_size > 200) + if (view->index_height + sci_titlebar_size > 200) sci_titlebar_size = 0; - _gfx_crossblit_simple(pic->visual_map->index_data + sci_titlebar_size*view->index_xl, + _gfx_crossblit_simple(pic->visual_map->index_data + sci_titlebar_size*view->index_width, view->index_data, - pic->visual_map->index_xl, view->index_xl, - view->index_xl, - view->index_yl, + pic->visual_map->index_width, view->index_width, + view->index_width, + view->index_height, 1); } else { GFXWARN("No view was contained in SCI1.1 pic resource"); @@ -1822,8 +1822,8 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int flags, int default_palette, int size, } void gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) { - int xl = pic->visual_map->index_xl; - int yl = pic->visual_map->index_yl; + int xl = pic->visual_map->index_width; + int yl = pic->visual_map->index_height; int xfrob_max = (pattern == GFXR_DITHER_PATTERN_1) ? 1 : pic->mode->xfact; int yfrob_max = (pattern == GFXR_DITHER_PATTERN_1) ? 1 : pic->mode->yfact; int xfrobc = 0, yfrobc = 0; diff --git a/engines/sci/gfx/sci_widgets.cpp b/engines/sci/gfx/sci_widgets.cpp index e7aca9a321..2db9e16e3f 100644 --- a/engines/sci/gfx/sci_widgets.cpp +++ b/engines/sci/gfx/sci_widgets.cpp @@ -53,7 +53,7 @@ static gfxw_list_t *make_titlebar_list(EngineState *s, rect_t bounds, gfxw_port_ list = gfxw_new_list(status_bar->bounds, 0); - bgbox = gfxw_new_box(s->gfx_state, gfx_rect(0, 0, status_bar->bounds.xl, status_bar->bounds.yl - 1), + bgbox = gfxw_new_box(s->gfx_state, gfx_rect(0, 0, status_bar->bounds.width, status_bar->bounds.height - 1), color, color, GFX_BOX_SHADE_FLAT); list->add((gfxw_container_t *) list, (gfxw_widget_t *) bgbox); @@ -65,7 +65,7 @@ static gfxw_list_t *finish_titlebar_list(EngineState *s, gfxw_list_t *list, gfxw gfx_color_t black = s->ega_colors[0]; gfxw_primitive_t *line; - line = gfxw_new_line(Common::Point(0, status_bar->bounds.yl - 1), Common::Point(status_bar->bounds.xl, status_bar->bounds.yl - 1), + line = gfxw_new_line(Common::Point(0, status_bar->bounds.height - 1), Common::Point(status_bar->bounds.width, status_bar->bounds.height - 1), black, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL); list->add((gfxw_container_t *)list, (gfxw_widget_t *)line); @@ -94,7 +94,7 @@ void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, in clear_titlebar(status_bar); if (text) { - gfxw_text_t *textw = gfxw_new_text(state, gfx_rect(0, 0, status_bar->bounds.xl, status_bar->bounds.yl), + gfxw_text_t *textw = gfxw_new_text(state, gfx_rect(0, 0, status_bar->bounds.width, status_bar->bounds.height), status_bar->font_nr, text, ALIGN_LEFT, ALIGN_CENTER, fg, fg, bg, GFXR_FONT_FLAG_NO_NEWLINES); @@ -103,7 +103,7 @@ void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, in list->add((gfxw_container_t *)list, (gfxw_widget_t *)textw); } else { - gfxw_box_t *bgbox = gfxw_new_box(state, gfx_rect(0, 0, status_bar->bounds.xl, status_bar->bounds.yl - 1), + gfxw_box_t *bgbox = gfxw_new_box(state, gfx_rect(0, 0, status_bar->bounds.width, status_bar->bounds.height - 1), black, black, GFX_BOX_SHADE_FLAT); list = gfxw_new_list(status_bar->bounds, 0); @@ -120,13 +120,13 @@ void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, in static void sciw_make_window_fit(rect_t *rect, gfxw_port_t *parent) { // This window is meant to cover the whole screen, so we allow it to go through. - if (rect->xl == 319 && rect->yl == 189) return; + if (rect->width == 319 && rect->height == 189) return; - if (rect->x + rect->xl > parent->bounds.x + parent->bounds.xl) - rect->x -= (rect->x + rect->xl) - (parent->bounds.x + parent->bounds.xl) + 2; + if (rect->x + rect->width > parent->bounds.x + parent->bounds.width) + rect->x -= (rect->x + rect->width) - (parent->bounds.x + parent->bounds.width) + 2; - if (rect->y + rect->yl > parent->bounds.y + parent->bounds.yl) - rect->y -= (rect->y + rect->yl) - (parent->bounds.y + parent->bounds.yl) + 2; + if (rect->y + rect->height > parent->bounds.y + parent->bounds.height) + rect->y -= (rect->y + rect->height) - (parent->bounds.y + parent->bounds.height) + 2; } gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor, @@ -142,7 +142,7 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t // int xextra = !(flags & WINDOW_FLAG_NOFRAME) ? 1 : 0; // int yextra = !(flags & WINDOW_FLAG_NOFRAME) ? 2 : 0; - if (area.xl == 319 && area.yl == 189) { + if (area.width == 319 && area.height == 189) { flags |= WINDOW_FLAG_NOFRAME; // The below line makes the points bar in QfG2 work, but breaks // the one in QfG1. Hm. @@ -151,12 +151,12 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t } /* - if (area.y + area.yl > visual->bounds.y + visual->bounds.yl) { - area.y -= (area.y + area.yl) - (visual->bounds.y + visual->bounds.yl) + yextra; + if (area.y + area.height > visual->bounds.y + visual->bounds.height) { + area.y -= (area.y + area.height) - (visual->bounds.y + visual->bounds.height) + yextra; } - if (area.x + area.xl > visual->bounds.x + visual->bounds.xl) { - area.x -= (area.x + area.xl) - (visual->bounds.x + visual->bounds.xl) + xextra; + if (area.x + area.width > visual->bounds.x + visual->bounds.width) { + area.x -= (area.x + area.width) - (visual->bounds.x + visual->bounds.width) + xextra; } */ @@ -164,7 +164,7 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t area. y += 10; if (!(flags & (WINDOW_FLAG_TITLE | WINDOW_FLAG_NOFRAME))) - area.yl -= 1; // Normal windows are drawn one pixel too small. + area.height -= 1; // Normal windows are drawn one pixel too small. sciw_make_window_fit(&area, s->wm_port); win = gfxw_new_port(visual, s->wm_port, area, color, bgcolor); @@ -182,26 +182,26 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t return win; // Fully transparent window if (flags & WINDOW_FLAG_TITLE) - frame = gfx_rect(area.x - 1, area.y - 10, area.xl + 2, area.yl + 11); + frame = gfx_rect(area.x - 1, area.y - 10, area.width + 2, area.height + 11); else - frame = gfx_rect(area.x - 1, area.y - 1, area.xl + 2, area.yl + 2); + frame = gfx_rect(area.x - 1, area.y - 1, area.width + 2, area.height + 2); // Set visible window boundaries - win->bounds = gfx_rect(frame.x, frame.y, frame.xl + shadow_offset, frame.yl + shadow_offset); + win->bounds = gfx_rect(frame.x, frame.y, frame.width + shadow_offset, frame.height + shadow_offset); - decorations = gfxw_new_list(gfx_rect(frame.x, frame.y, frame.xl + 1 + shadow_offset, frame.yl + 1 + shadow_offset), 0); + decorations = gfxw_new_list(gfx_rect(frame.x, frame.y, frame.width + 1 + shadow_offset, frame.height + 1 + shadow_offset), 0); if (!(flags & WINDOW_FLAG_TRANSPARENT)) { // Draw window background win->port_bg = (gfxw_widget_t *)gfxw_new_box(state, gfx_rect(1, (flags & WINDOW_FLAG_TITLE) ? 10 : 1, - area.xl, area.yl), bgcolor, bgcolor, GFX_BOX_SHADE_FLAT); + area.width, area.height), bgcolor, bgcolor, GFX_BOX_SHADE_FLAT); decorations->add((gfxw_container_t *) decorations, win->port_bg); win->flags |= GFXW_FLAG_OPAQUE; } if (flags & WINDOW_FLAG_TITLE) { // Add window title - rect_t title_rect = gfx_rect(1, 1, area.xl, 8); + rect_t title_rect = gfx_rect(1, 1, area.width, 8); decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *) gfxw_new_box(state, title_rect, title_bgcolor, title_bgcolor, GFX_BOX_SHADE_FLAT)); @@ -221,12 +221,12 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t } decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *) - gfxw_new_box(state, gfx_rect(shadow_offset + 1, frame.yl - 1, - frame.xl - 4, shadow_offset), black, black, GFX_BOX_SHADE_FLAT)); + gfxw_new_box(state, gfx_rect(shadow_offset + 1, frame.height - 1, + frame.width - 4, shadow_offset), black, black, GFX_BOX_SHADE_FLAT)); decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *) - gfxw_new_box(state, gfx_rect(frame.xl - 1, shadow_offset + 1, - shadow_offset, frame.yl - 2), black, black, GFX_BOX_SHADE_FLAT)); + gfxw_new_box(state, gfx_rect(frame.width - 1, shadow_offset + 1, + shadow_offset, frame.height - 2), black, black, GFX_BOX_SHADE_FLAT)); } // Draw frame @@ -239,14 +239,14 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t if (!(flags & WINDOW_FLAG_NO_DROP_SHADOW)) { decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *) - gfxw_new_rect(gfx_rect(0, 0, frame.xl - 1, frame.yl - 1), black, GFX_LINE_MODE_FINE, GFX_LINE_STYLE_NORMAL)); + gfxw_new_rect(gfx_rect(0, 0, frame.width - 1, frame.height - 1), black, GFX_LINE_MODE_FINE, GFX_LINE_STYLE_NORMAL)); if (flags & WINDOW_FLAG_TITLE) decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *)gfxw_new_line(Common::Point(1, 9), - Common::Point(frame.xl - 2, 9), black, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)); + Common::Point(frame.width - 2, 9), black, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)); } else { decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *) - gfxw_new_rect(gfx_rect(0, 0, frame.xl, frame.yl), black, GFX_LINE_MODE_FINE, GFX_LINE_STYLE_NORMAL)); + gfxw_new_rect(gfx_rect(0, 0, frame.width, frame.height), black, GFX_LINE_MODE_FINE, GFX_LINE_STYLE_NORMAL)); } } @@ -259,7 +259,7 @@ gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t //*** Controls *** static rect_t _move_and_extend_rect(rect_t rect, Common::Point point, int yplus) { - return gfx_rect(rect.x + point.x, rect.y + point.y, rect.xl + 1, rect.yl + yplus); + return gfx_rect(rect.x + point.x, rect.y + point.y, rect.width + 1, rect.height + yplus); } gfxw_list_t *_sciw_add_text_to_list(gfxw_list_t *list, gfxw_port_t *port, rect_t zone, char *text, @@ -280,8 +280,8 @@ gfxw_list_t *_sciw_add_text_to_list(gfxw_list_t *list, gfxw_port_t *port, rect_t list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, zone, font, text, align, ALIGN_TOP, *color1, *color2, *bgcolor, flags))); - zone.xl--; - zone.yl -= 2; + zone.width--; + zone.height -= 2; if (framed) { list->add(GFXWC(list), GFXW(gfxw_new_rect(zone, *color2, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_STIPPLED))); @@ -296,8 +296,8 @@ gfxw_list_t *sciw_new_button_control(gfxw_port_t *port, reg_t ID, rect_t zone, c zone.x--; zone.y--; - zone.xl++; - zone.yl++; + zone.width++; + zone.height++; list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0); @@ -307,11 +307,11 @@ gfxw_list_t *sciw_new_button_control(gfxw_port_t *port, reg_t ID, rect_t zone, c zone.y = 0; if (inverse) - list->add(GFXWC(list), GFXW(gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.xl + 1, zone.yl + 1), + list->add(GFXWC(list), GFXW(gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1), port->color, port->color, GFX_BOX_SHADE_FLAT))); if (!inverse) - list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.xl - 1, zone.yl), + list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height), text, font, ALIGN_CENTER, 0, inverse, GFXR_FONT_FLAG_EAT_TRAILING_LF, grayed_out); if (!inverse) @@ -319,12 +319,12 @@ gfxw_list_t *sciw_new_button_control(gfxw_port_t *port, reg_t ID, rect_t zone, c GFXW(gfxw_new_rect(zone, *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL))); if (inverse) - list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.xl - 1, zone.yl), + list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height), text, font, ALIGN_CENTER, 0, inverse, GFXR_FONT_FLAG_EAT_TRAILING_LF, grayed_out); if (selected) list->add(GFXWC(list), - GFXW(gfxw_new_rect(gfx_rect(zone.x + 1, zone.y + 1, zone.xl - 2, zone.yl - 2), + GFXW(gfxw_new_rect(gfx_rect(zone.x + 1, zone.y + 1, zone.width - 2, zone.height - 2), *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL))); return list; @@ -351,8 +351,8 @@ gfxw_list_t *sciw_new_edit_control(gfxw_port_t *port, reg_t ID, rect_t zone, cha zone.x--; zone.y--; - zone.xl++; - zone.yl++; + zone.width++; + zone.height++; list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0); gfxw_set_id(GFXW(list), ID.segment, ID.offset); @@ -450,13 +450,13 @@ gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int zone.x--; zone.y--; - zone.xl++; - zone.yl++; + zone.width++; + zone.height++; list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0); font_height = gfxop_get_font_height(port->visual->gfx_state, font_nr); - columns = (zone.yl - 20); + columns = (zone.height - 20); if (font_height <= 0) { GFXERROR("Attempt to create list control with invalid font %d\n", font_nr); @@ -480,13 +480,13 @@ gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int for (i = list_top; columns-- && i < entries_nr; i++) { if (i != selection) list->add(GFXWC(list), - GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.xl - 2, font_height), + GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height), font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP, port->color, port->color, port->bgcolor, GFXR_FONT_FLAG_NO_NEWLINES))); else { - list->add(GFXWC(list), GFXW(gfxw_new_box(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.xl - 1, font_height), + list->add(GFXWC(list), GFXW(gfxw_new_box(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 1, font_height), port->color, port->color, GFX_BOX_SHADE_FLAT))); - list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.xl - 2, font_height), + list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height), font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP, port->bgcolor, port->bgcolor, port->color, GFXR_FONT_FLAG_NO_NEWLINES))); } @@ -500,25 +500,25 @@ gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int zone.y = 0; // Add up arrow - list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(1, 0, zone.xl - 2, 8), + list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(1, 0, zone.width - 2, 8), port->font_nr, arr_up, ALIGN_CENTER, ALIGN_CENTER, port->color, port->color, port->bgcolor, 0))); // Add down arrow - list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(1, zone.yl - 9, zone.xl - 2, 8), + list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, gfx_rect(1, zone.height - 9, zone.width - 2, 8), port->font_nr, arr_down, ALIGN_CENTER, ALIGN_CENTER, port->color, port->color, port->bgcolor, 0))); if (list_top & 1) { // Hack to work around aggressive caching list->add(GFXWC(list), GFXW(gfxw_new_rect(zone, port->color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL))); - list->add(GFXWC(list), GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.xl, zone.yl - 20), + list->add(GFXWC(list), GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 20), port->color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL))); } else { list->add(GFXWC(list), - GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y, zone.xl, zone.yl - 10), + GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y, zone.width, zone.height - 10), port->color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL))); list->add(GFXWC(list), - GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.xl, zone.yl - 10), + GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 10), port->color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL))); } @@ -570,8 +570,8 @@ gfxw_port_t *sciw_new_menu(EngineState *s, gfxw_port_t *status_bar, menubar_t *m for (i = 0; i < selection; i++) area.x += menubar->menus[i].title_width; - area.xl = menu->width - 1; - area.yl = menu->items_nr * 10; + area.width = menu->width - 1; + area.height = menu->items_nr * 10; retval = sciw_new_window(s, area, status_bar->font_nr, status_bar->color, status_bar->bgcolor, 0, status_bar->color, status_bar->bgcolor, NULL, WINDOW_FLAG_NO_DROP_SHADOW | WINDOW_FLAG_TRANSPARENT); @@ -595,7 +595,7 @@ static gfx_color_t un_prioritize(gfx_color_t col) { gfxw_widget_t *_make_menu_entry(menu_item_t *item, int offset, int width, gfxw_port_t *port, gfx_color_t color, gfx_color_t bgcolor, int ID, int gray) { rect_t area = gfx_rect(MENU_BOX_LEFT_PADDING, 0, width - MENU_BOX_LEFT_PADDING, 10); - rect_t list_area = gfx_rect(port->zone.x, area.y + offset + port->zone.y, width, area.yl); + rect_t list_area = gfx_rect(port->zone.x, area.y + offset + port->zone.y, width, area.height); gfxw_list_t *list = (gfxw_list_t *) gfxw_set_id(GFXW(gfxw_new_list(list_area, 0)), ID, GFXW_NO_ID); gfx_color_t xcolor = { PaletteEntry(), 0, 0, 0, 0}; @@ -609,7 +609,7 @@ gfxw_widget_t *_make_menu_entry(menu_item_t *item, int offset, int width, gfxw_p color, xcolor, bgcolor, GFXR_FONT_FLAG_NO_NEWLINES))); if (item->keytext) { - area.xl -= MENU_BOX_RIGHT_PADDING; + area.width -= MENU_BOX_RIGHT_PADDING; list->add(GFXWC(list), GFXW(gfxw_new_text(port->visual->gfx_state, area, port->font_nr, item->keytext, ALIGN_RIGHT, ALIGN_CENTER, color, xcolor, bgcolor, GFXR_FONT_FLAG_NO_NEWLINES))); } @@ -619,7 +619,7 @@ gfxw_widget_t *_make_menu_entry(menu_item_t *item, int offset, int width, gfxw_p gfxw_widget_t *_make_menu_hbar(int offset, int width, gfxw_port_t *port, gfx_color_t color, gfx_color_t bgcolor, int ID) { rect_t area = gfx_rect(0, 0, width, 10); - rect_t list_area = gfx_rect(area.x + port->zone.x, area.y + offset + port->zone.y, area.xl, area.yl); + rect_t list_area = gfx_rect(area.x + port->zone.x, area.y + offset + port->zone.y, area.width, area.height); gfxw_list_t *list = (gfxw_list_t *) gfxw_set_id(GFXW(gfxw_new_list(list_area, 0)), ID, GFXW_NO_ID); color = un_prioritize(color); @@ -639,11 +639,11 @@ gfxw_port_t *sciw_unselect_item(EngineState *s, gfxw_port_t *menu_port, menu_t * return menu_port; if (item->type == MENU_TYPE_NORMAL) - menu_port->add(GFXWC(menu_port), GFXW(_make_menu_entry(item, selection * 10, menu_port->zone.xl + 1, + menu_port->add(GFXWC(menu_port), GFXW(_make_menu_entry(item, selection * 10, menu_port->zone.width + 1, menu_port, menu_port->color, menu_port->bgcolor, selection + MAGIC_ID_OFFSET, item->enabled))); else - menu_port->add(GFXWC(menu_port), GFXW(_make_menu_hbar(selection * 10, menu_port->zone.xl + 1, + menu_port->add(GFXWC(menu_port), GFXW(_make_menu_hbar(selection * 10, menu_port->zone.width + 1, menu_port, menu_port->color, menu_port->bgcolor, selection + MAGIC_ID_OFFSET))); return menu_port; @@ -656,11 +656,11 @@ gfxw_port_t *sciw_select_item(EngineState *s, gfxw_port_t *menu_port, menu_t *me return menu_port; if (item->type == MENU_TYPE_NORMAL) - menu_port->add(GFXWC(menu_port), GFXW(_make_menu_entry(item, selection * 10, menu_port->zone.xl + 1, + menu_port->add(GFXWC(menu_port), GFXW(_make_menu_entry(item, selection * 10, menu_port->zone.width + 1, menu_port, menu_port->bgcolor, menu_port->color, selection + MAGIC_ID_OFFSET, item->enabled))); else - menu_port->add(GFXWC(menu_port), GFXW(_make_menu_hbar(selection * 10, menu_port->zone.xl + 1, + menu_port->add(GFXWC(menu_port), GFXW(_make_menu_hbar(selection * 10, menu_port->zone.width + 1, menu_port, menu_port->bgcolor, menu_port->color, selection + MAGIC_ID_OFFSET))); return menu_port; -- cgit v1.2.3