mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 09:10:29 +00:00
Lines are no longer treated as fake rectangles and are shown correctly again
svn-id: r44663
This commit is contained in:
parent
3e66ae85f6
commit
4c35022f6b
@ -406,22 +406,16 @@ void _k_redraw_box(EngineState *s, int x1, int y1, int x2, int y2) {
|
||||
}
|
||||
|
||||
reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||
int rectLeft = 0, rectTop = 0, rectRight = 0, rectBottom = 0;
|
||||
int x = 0, y = 0, x1 = 0, y1 = 0;
|
||||
uint16 flags;
|
||||
int16 priority, control, color, colorMask;
|
||||
|
||||
Common::Rect rect;
|
||||
if (argc>=5) {
|
||||
rectLeft = argv[2].toSint16(); rectTop = argv[1].toSint16();
|
||||
rectRight = argv[4].toSint16(); rectBottom = argv[3].toSint16();
|
||||
// Fixup data, so that a valid rectangle is formed
|
||||
if (rectLeft > rectRight) {
|
||||
rectRight = rectLeft; rectLeft = argv[4].toSint16();
|
||||
}
|
||||
if (rectTop > rectBottom) {
|
||||
rectBottom = rectTop; rectTop = argv[3].toSint16();
|
||||
}
|
||||
rect = Common::Rect (rectLeft, rectTop, rectRight, rectBottom);
|
||||
|
||||
if (argc >= 5) {
|
||||
x = argv[2].toSint16();
|
||||
y = argv[1].toSint16();
|
||||
x1 = argv[4].toSint16();
|
||||
y1 = argv[3].toSint16();
|
||||
}
|
||||
|
||||
// old code, may be removed later after class migration
|
||||
@ -443,10 +437,11 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||
color = argv[5].toSint16();
|
||||
|
||||
// FIXME: rect must be changed to 2 Common::Point
|
||||
s->gui->graphDrawLine(rect, color, priority, control);
|
||||
s->gui->graphDrawLine(Common::Point(x, y), Common::Point(x1, y1), color, priority, control);
|
||||
break;
|
||||
|
||||
case K_GRAPH_SAVE_BOX:
|
||||
rect = Common::Rect(x, y, x1, y1);
|
||||
flags = (argc > 5) ? argv[5].toUint16() : 0;
|
||||
return s->gui->graphSaveBox(rect, flags);
|
||||
break;
|
||||
@ -456,10 +451,12 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||
break;
|
||||
|
||||
case K_GRAPH_FILL_BOX_BACKGROUND:
|
||||
rect = Common::Rect(x, y, x1, y1);
|
||||
s->gui->graphFillBoxBackground(rect);
|
||||
break;
|
||||
|
||||
case K_GRAPH_FILL_BOX_FOREGROUND:
|
||||
rect = Common::Rect(x, y, x1, y1);
|
||||
s->gui->graphFillBoxForeground(rect);
|
||||
break;
|
||||
|
||||
@ -469,6 +466,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
|
||||
color = argv[6].toSint16();
|
||||
colorMask = argv[5].toUint16();
|
||||
|
||||
rect = Common::Rect(x, y, x1, y1);
|
||||
s->gui->graphFillBox(rect, colorMask, color, priority, control);
|
||||
break;
|
||||
|
||||
|
@ -304,8 +304,8 @@ void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int1
|
||||
_screen->copyToScreen();
|
||||
}
|
||||
|
||||
void SciGui::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) {
|
||||
_gfx->Draw_Line(rect.left, rect.top, rect.right, rect.bottom, color, priority, control);
|
||||
void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
|
||||
_gfx->Draw_Line(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
|
||||
_screen->copyToScreen();
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
virtual void graphFillBoxForeground(Common::Rect rect);
|
||||
virtual void graphFillBoxBackground(Common::Rect rect);
|
||||
virtual void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
|
||||
virtual void graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control);
|
||||
virtual void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
|
||||
virtual reg_t graphSaveBox(Common::Rect rect, uint16 flags);
|
||||
virtual void graphRestoreBox(reg_t handle);
|
||||
|
||||
|
@ -663,17 +663,13 @@ void SciGui32::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, in
|
||||
s->picture_port->add((GfxContainer *)s->picture_port, gfxw_new_box(s->gfx_state, area, fillColor, fillColor, GFX_BOX_SHADE_FLAT));
|
||||
}
|
||||
|
||||
void SciGui32::graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control) {
|
||||
void SciGui32::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
|
||||
gfx_color_t gfxcolor = graph_map_color(s, color, priority, control);
|
||||
|
||||
debugC(2, kDebugLevelGraphics, "draw_line((%d, %d), (%d, %d), col=%d, p=%d, c=%d, mask=%d)\n",
|
||||
rect.left, rect.top, rect.right, rect.bottom, color, priority, control, gfxcolor.mask);
|
||||
startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control, gfxcolor.mask);
|
||||
|
||||
// Note: it's quite possible that the coordinates of the line will *not* form a valid rectangle (e.g. it might
|
||||
// have negative width/height). The actual dirty rectangle is constructed in gfxdr_add_dirty().
|
||||
// FIXME/TODO: We need to change the semantics of this call, so that no fake rectangles are used. As it is, it's
|
||||
// not possible change rect_t to Common::Rect, as we assume that Common::Rect forms a *valid* rectangle.
|
||||
ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_line(Common::Point(rect.left, rect.top), Common::Point(rect.right, rect.bottom),
|
||||
ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_line(startPoint, endPoint,
|
||||
gfxcolor, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
|
||||
FULL_REDRAW();
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
void graphFillBoxForeground(Common::Rect rect);
|
||||
void graphFillBoxBackground(Common::Rect rect);
|
||||
void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
|
||||
void graphDrawLine(Common::Rect rect, int16 color, int16 priority, int16 control);
|
||||
void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
|
||||
reg_t graphSaveBox(Common::Rect rect, uint16 flags);
|
||||
void graphRestoreBox(reg_t handle);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user