This fixes TEXT2(cache) procesing with corrupted screen with long lines and vertical text.

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@48 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Michal Mihalik 2002-04-19 12:06:08 +00:00
parent abb9ba3f59
commit c3fa5116c7
2 changed files with 78 additions and 59 deletions

View File

@ -542,7 +542,6 @@ process_polyline(STREAM s, POLYLINE_ORDER *os, uint32 present, BOOL delta)
static void
process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
{
DATABLOB *entry;
int i;
if (present & 0x000001)
@ -612,24 +611,6 @@ process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, BOOL delta)
DEBUG(("\n"));
/* Process special cache strings */
if ((os->length >= 2) && (os->text[0] == 0xfe))
{
entry = cache_get_text(os->text[1]);
if (entry == NULL)
return;
memcpy(os->text, entry->data, entry->size);
os->length = entry->size;
}
else if ((os->length >= 3) && (os->text[os->length - 3] == 0xff))
{
os->length -= 3;
cache_put_text(os->text[os->length + 1], os->text,
os->length);
}
ui_draw_text(os->font, os->flags, os->mixmode, os->x, os->y,
os->clipleft, os->cliptop,
os->clipright - os->clipleft,

118
xwin.c
View File

@ -863,15 +863,47 @@ ui_draw_glyph(int mixmode,
XSetFillStyle(display, gc, FillSolid);
}
#define DO_GLYPH(ttext,idx) \
{\
glyph = cache_get_font (font, ttext[idx]);\
if (!(flags & TEXT2_IMPLICIT_X))\
{\
xyoffset = ttext[++idx];\
if ((xyoffset & 0x80))\
{\
if (flags & TEXT2_VERTICAL) \
y += ttext[++idx] | (ttext[++idx] << 8);\
else\
x += ttext[++idx] | (ttext[++idx] << 8);\
}\
else\
{\
if (flags & TEXT2_VERTICAL) \
y += xyoffset;\
else\
x += xyoffset;\
}\
}\
if (glyph != NULL)\
{\
ui_draw_glyph (mixmode, x + (short) glyph->offset,\
y + (short) glyph->baseline,\
glyph->width, glyph->height,\
glyph->pixmap, 0, 0, bgcolour, fgcolour);\
if (flags & TEXT2_IMPLICIT_X)\
x += glyph->width;\
}\
}
void
ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,
int clipx, int clipy, int clipcx, int clipcy,
int boxx, int boxy, int boxcx, int boxcy,
int bgcolour, int fgcolour, uint8 *text, uint8 length)
int clipx, int clipy, int clipcx, int clipcy, int boxx,
int boxy, int boxcx, int boxcy, int bgcolour,
int fgcolour, uint8 * text, uint8 length)
{
FONTGLYPH *glyph;
short offset;
int i;
int i, j, xyoffset;
DATABLOB *entry;
SET_FOREGROUND(bgcolour);
@ -885,46 +917,52 @@ ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,
}
/* Paint text, character by character */
for (i = 0; i < length; i++)
{
glyph = cache_get_font(font, text[i]);
if (!(flags & TEXT2_IMPLICIT_X))
{
offset = text[++i];
if (offset & 0x80)
{
if (offset == 0x80)
{
/* next two bytes, little-endian */
offset = text[++i];
offset |= text[++i] << 8;
}
else
{
offset = (offset & 0x7f) << 8;
offset |= text[++i];
}
for (i = 0; i < length;) {
switch (text[i]) {
case 0xff:
if (i + 2 < length)
cache_put_text(text[i + 1], text, text[i + 2]);
else {
error("this shouldn't be happening\n");
break;
}
/* this will move pointer from start to first character after FF command */
length -= i + 3;
text = &(text[i + 3]);
i = 0;
break;
if (flags & TEXT2_VERTICAL)
y += offset;
else
x += offset;
}
case 0xfe:
entry = cache_get_text(text[i + 1]);
if (entry != NULL) {
if ((((uint8 *) (entry->data))[1] == 0)
&& (!(flags & TEXT2_IMPLICIT_X))) {
if (flags & TEXT2_VERTICAL)
y += text[i + 2];
else
x += text[i + 2];
}
if (i + 2 < length)
i += 3;
else
i += 2;
length -= i;
/* this will move pointer from start to first character after FE command */
text = &(text[i]);
i = 0;
for (j = 0; j < entry->size; j++)
DO_GLYPH(((uint8 *) (entry->data)), j);
}
break;
if (glyph != NULL)
{
ui_draw_glyph(mixmode, x + (short) glyph->offset,
y + (short) glyph->baseline,
glyph->width, glyph->height,
glyph->pixmap, 0, 0,
bgcolour, fgcolour);
if (flags & TEXT2_IMPLICIT_X)
x += glyph->width;
default:
DO_GLYPH(text, i);
i++;
break;
}
}
}
void