- more accurate emulation of the text cursor if horizontal pel panning is active

This commit is contained in:
Volker Ruppert 2003-06-15 07:33:06 +00:00
parent dd46d0ec71
commit e258b32fc2

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: sdl.cc,v 1.38 2003-06-10 20:22:37 vruppert Exp $ // $Id: sdl.cc,v 1.39 2003-06-15 07:33:06 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -277,7 +277,7 @@ void bx_sdl_gui_c::text_update(
{ {
unsigned char *pfont_row, *old_line, *new_line; unsigned char *pfont_row, *old_line, *new_line;
unsigned long x,y; unsigned long x,y;
unsigned int curs, hchars; unsigned int curs, hchars, offset;
int rows,fontrows,fontpixels; int rows,fontrows,fontpixels;
int fgcolor_ndx; int fgcolor_ndx;
int bgcolor_ndx; int bgcolor_ndx;
@ -287,7 +287,7 @@ void bx_sdl_gui_c::text_update(
Uint32 disp; Uint32 disp;
Bit16u font_row, mask; Bit16u font_row, mask;
Bit8u cs_line, cfwidth, cfheight; Bit8u cs_line, cfwidth, cfheight;
bx_bool gfxcharw9, invert, forceUpdate; bx_bool cursor_visible, gfxcharw9, invert, forceUpdate;
UNUSED(nrows); UNUSED(nrows);
forceUpdate = 0; forceUpdate = 0;
@ -321,7 +321,9 @@ void bx_sdl_gui_c::text_update(
rows = text_rows; rows = text_rows;
if (v_panning) rows++; if (v_panning) rows++;
y = 0; y = 0;
curs = cursor_y * tm_info.line_offset + cursor_x * 2;
cursor_visible = (tm_info.cs_start < tm_info.cs_end);
do do
{ {
buf = buf_row; buf = buf_row;
@ -342,6 +344,7 @@ void bx_sdl_gui_c::text_update(
new_line = new_text; new_line = new_text;
old_line = old_text; old_line = old_text;
x = 0; x = 0;
offset = y * tm_info.line_offset;
do do
{ {
cfwidth = fontwidth; cfwidth = fontwidth;
@ -359,7 +362,7 @@ void bx_sdl_gui_c::text_update(
// check if char needs to be updated // check if char needs to be updated
if(forceUpdate || (old_text[0] != new_text[0]) if(forceUpdate || (old_text[0] != new_text[0])
|| (old_text[1] != new_text[1]) || (old_text[1] != new_text[1])
|| ((y == cursor_y) && (x == cursor_x)) ) || (offset == curs) )
{ {
// Get Foreground/Background pixel colors // Get Foreground/Background pixel colors
@ -367,7 +370,7 @@ void bx_sdl_gui_c::text_update(
bgcolor_ndx = DEV_vga_get_actl_pal_idx((new_text[1] >> 4) & 0x0F); bgcolor_ndx = DEV_vga_get_actl_pal_idx((new_text[1] >> 4) & 0x0F);
fgcolor = palette[fgcolor_ndx]; fgcolor = palette[fgcolor_ndx];
bgcolor = palette[bgcolor_ndx]; bgcolor = palette[bgcolor_ndx];
invert = ( (y == cursor_y) && (x == cursor_x) && (tm_info.cs_start < tm_info.cs_end) ); invert = ( (offset == curs) && (cursor_visible) );
gfxcharw9 = ( (tm_info.line_graphics) && ((new_text[0] & 0xE0) == 0xC0) ); gfxcharw9 = ( (tm_info.line_graphics) && ((new_text[0] & 0xE0) == 0xC0) );
// Display this one char // Display this one char
@ -420,12 +423,13 @@ void bx_sdl_gui_c::text_update(
} }
// move to next char location on screen // move to next char location on screen
buf += cfwidth; buf += cfwidth;
// select next char in old/new text // select next char in old/new text
new_text+=2; new_text+=2;
old_text+=2; old_text+=2;
offset+=2;
x++; x++;
// process one entire horizontal row // process one entire horizontal row
} while( --hchars ); } while( --hchars );