CVS: rdesktop cache.c, 1.28, 1.29 constants.h, 1.51, 1.52 orders.c, 1.53, 1.54 proto.h, 1.111, 1.112 rdp.c, 1.103, 1.104 types.h, 1.34, 1.35
Jay Sorg <[email protected]> Thu, 10 Jul 2008 20:35:30 -0700
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv3088
Modified Files:
cache.c constants.h orders.c proto.h rdp.c types.h
Log Message:
added brush cache
Index: cache.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/cache.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** cache.c 4 Jan 2007 05:39:38 -0000 1.28
--- cache.c 11 Jul 2008 03:35:23 -0000 1.29
***************
*** 431,432 ****
--- 431,461 ----
}
}
+
+ /* BRUSH CACHE */
+ static BRUSHDATA g_brushcache[64];
+
+ /* Retrieve brush from cache */
+ BRUSHDATA *
+ cache_get_brush_data(uint16 cache_idx)
+ {
+ if (cache_idx < NUM_ELEMENTS(g_brushcache))
+ {
+ return &g_brushcache[cache_idx];
+ }
+ error("get brush %d\n", cache_idx);
+ return NULL;
+ }
+
+ /* Store brush in cache */
+ void
+ cache_put_brush_data(uint16 cache_idx, BRUSHDATA * brush_data)
+ {
+ if (cache_idx < NUM_ELEMENTS(g_brushcache))
+ {
+ memcpy(&g_brushcache[cache_idx], brush_data, sizeof(BRUSHDATA));
+ }
+ else
+ {
+ error("put brush %d\n", cache_idx);
+ }
+ }
Index: constants.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/constants.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** constants.h 6 Mar 2008 15:39:21 -0000 1.51
--- constants.h 11 Jul 2008 03:35:23 -0000 1.52
***************
*** 252,255 ****
--- 252,258 ----
#define RDP_CAPLEN_COLCACHE 0x08
+ #define RDP_CAPSET_BRUSHCACHE 15
+ #define RDP_CAPLEN_BRUSHCACHE 0x08
+
#define RDP_CAPSET_BMPCACHE2 19
#define RDP_CAPLEN_BMPCACHE2 0x28
Index: orders.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/orders.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** orders.c 8 Jan 2007 04:47:05 -0000 1.53
--- orders.c 11 Jul 2008 03:35:23 -0000 1.54
***************
*** 149,152 ****
--- 149,185 ----
}
+ static void
+ setup_brush(BRUSH * out_brush, BRUSH * in_brush)
+ {
+ BRUSHDATA * brush_data;
+ uint16 cache_idx;
+ uint8 brush_bpp;
+
+ memcpy(out_brush, in_brush, sizeof(BRUSH));
+ if (out_brush->style & 0x80)
+ {
+ brush_bpp = out_brush->style & 0x0f;
+ if (brush_bpp == 1) /* 1 bpp */
+ {
+ cache_idx = out_brush->pattern[0];
+ brush_data = cache_get_brush_data(cache_idx);
+ if (brush_data == NULL)
+ {
+ error("error getting brush data, style %x\n", out_brush->style);
+ }
+ else
+ {
+ memcpy(out_brush->pattern, brush_data->pattern,
+ sizeof(out_brush->pattern));
+ }
+ }
+ else
+ {
+ error("bad brush bpp %d\n", brush_bpp);
+ }
+ out_brush->style = 3;
+ }
+ }
+
/* Parse a brush */
static RD_BOOL
***************
*** 200,203 ****
--- 233,238 ----
process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta)
{
+ BRUSH brush;
+
if (present & 0x0001)
rdp_in_coord(s, &os->x, delta);
***************
*** 226,231 ****
os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour));
ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,
! &os->brush, os->bgcolour, os->fgcolour);
}
--- 261,268 ----
os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour));
+ setup_brush(&brush, &os->brush);
+
ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,
! &brush, os->bgcolour, os->fgcolour);
}
***************
*** 427,430 ****
--- 464,468 ----
{
RD_HBITMAP bitmap;
+ BRUSH brush;
if (present & 0x000001)
***************
*** 477,482 ****
return;
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,
! bitmap, os->srcx, os->srcy, &os->brush, os->bgcolour, os->fgcolour);
}
--- 515,522 ----
return;
+ setup_brush(&brush, &os->brush);
+
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,
! bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour);
}
***************
*** 567,570 ****
--- 607,611 ----
uint8 flags = 0;
RD_POINT *points;
+ BRUSH brush;
if (present & 0x0001)
***************
*** 614,617 ****
--- 655,660 ----
}
+ setup_brush(&brush, &os->brush);
+
points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT));
memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT));
***************
*** 638,642 ****
if (next - 1 == os->npoints)
ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1,
! &os->brush, os->bgcolour, os->fgcolour);
else
error("polygon2 parse error\n");
--- 681,685 ----
if (next - 1 == os->npoints)
ui_polygon(os->opcode - 1, os->fillmode, points, os->npoints + 1,
! &brush, os->bgcolour, os->fgcolour);
else
error("polygon2 parse error\n");
***************
*** 759,762 ****
--- 802,807 ----
process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta)
{
+ BRUSH brush;
+
if (present & 0x0001)
rdp_in_coord(s, &os->left, delta);
***************
*** 789,794 ****
os->bgcolour, os->fgcolour));
ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left,
! os->bottom - os->top, &os->brush, os->bgcolour, os->fgcolour);
}
--- 834,841 ----
os->bgcolour, os->fgcolour));
+ setup_brush(&brush, &os->brush);
+
ui_ellipse(os->opcode - 1, os->fillmode, os->left, os->top, os->right - os->left,
! os->bottom - os->top, &brush, os->bgcolour, os->fgcolour);
}
***************
*** 798,801 ****
--- 845,849 ----
{
int i;
+ BRUSH brush;
if (present & 0x000001)
***************
*** 864,872 ****
DEBUG(("\n"));
ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y,
os->clipleft, os->cliptop, os->clipright - os->clipleft,
os->clipbottom - os->cliptop, os->boxleft, os->boxtop,
os->boxright - os->boxleft, os->boxbottom - os->boxtop,
! &os->brush, os->bgcolour, os->fgcolour, os->text, os->length);
}
--- 912,922 ----
DEBUG(("\n"));
+ setup_brush(&brush, &os->brush);
+
ui_draw_text(os->font, os->flags, os->opcode - 1, os->mixmode, os->x, os->y,
os->clipleft, os->cliptop, os->clipright - os->clipleft,
os->clipbottom - os->cliptop, os->boxleft, os->boxtop,
os->boxright - os->boxleft, os->boxbottom - os->boxtop,
! &brush, os->bgcolour, os->fgcolour, os->text, os->length);
}
***************
*** 1105,1108 ****
--- 1155,1186 ----
}
+ /* Process a brush cache order */
+ static void
+ process_brushcache(STREAM s, uint16 flags)
+ {
+ BRUSHDATA brush_data;
+ uint8 cache_idx, depth, width, height, size;
+
+ in_uint8(s, cache_idx);
+ in_uint8(s, depth);
+ in_uint8(s, width);
+ in_uint8(s, height);
+ in_uint8s(s, 1); /* type, 0x80 = cached */
+ in_uint8(s, size);
+
+ DEBUG(("BRUSHCACHE(idx=%d,dp=%d,wd=%d,ht=%d,sz=%d)\n", cache_idx, depth,
+ width, height, size));
+
+ if ((depth == 1) && (width == 8) && (height == 8) && (size == 8))
+ {
+ in_uint8a(s, brush_data.pattern, sizeof(brush_data.pattern));
+ cache_put_brush_data(cache_idx, &brush_data);
+ }
+ else
+ {
+ warning("ignoring incompatible brush type. display may be incorrect\n");
+ }
+ }
+
/* Process a secondary order */
static void
***************
*** 1149,1152 ****
--- 1227,1234 ----
break;
+ case RDP_ORDER_BRUSHCACHE:
+ process_brushcache(s, flags);
+ break;
+
default:
unimpl("secondary order %d\n", type);
Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -d -r1.111 -r1.112
*** proto.h 7 Mar 2008 11:26:28 -0000 1.111
--- proto.h 11 Jul 2008 03:35:24 -0000 1.112
***************
*** 45,48 ****
--- 45,50 ----
RD_HCURSOR cache_get_cursor(uint16 cache_idx);
void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor);
+ BRUSHDATA * cache_get_brush_data(uint16 cache_idx);
+ void cache_put_brush_data(uint16 cache_idx, BRUSHDATA * brush_data);
/* channels.c */
VCHANNEL *channel_register(char *name, uint32 flags, void (*callback) (STREAM));
Index: rdp.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdp.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -C2 -d -r1.103 -r1.104
*** rdp.c 24 Jan 2008 08:06:02 -0000 1.103
--- rdp.c 11 Jul 2008 03:35:24 -0000 1.104
***************
*** 801,804 ****
--- 801,813 ----
}
+ /* Output brush cache capability set */
+ static void
+ rdp_out_brushcache_caps(STREAM s)
+ {
+ out_uint16_le(s, RDP_CAPSET_BRUSHCACHE);
+ out_uint16_le(s, RDP_CAPLEN_BRUSHCACHE);
+ out_uint32_le(s, 1); /* cache type */
+ }
+
static uint8 caps_0x0d[] = {
0x01, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00,
***************
*** 849,853 ****
RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE +
RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL +
! RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE +
0x58 + 0x08 + 0x08 + 0x34 /* unknown caps */ +
4 /* w2k fix, why? */ ;
--- 858,862 ----
RDP_CAPLEN_BMPCACHE + RDP_CAPLEN_COLCACHE +
RDP_CAPLEN_ACTIVATE + RDP_CAPLEN_CONTROL +
! RDP_CAPLEN_POINTER + RDP_CAPLEN_SHARE + RDP_CAPLEN_BRUSHCACHE +
0x58 + 0x08 + 0x08 + 0x34 /* unknown caps */ +
4 /* w2k fix, why? */ ;
***************
*** 877,880 ****
--- 886,890 ----
rdp_out_pointer_caps(s);
rdp_out_share_caps(s);
+ rdp_out_brushcache_caps(s);
rdp_out_unknown_caps(s, 0x0d, 0x58, caps_0x0d); /* international? */
Index: types.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/types.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** types.h 8 Jan 2007 04:47:06 -0000 1.34
--- types.h 11 Jul 2008 03:35:24 -0000 1.35
***************
*** 80,83 ****
--- 80,90 ----
PEN;
+ /* this is whats in the brush cache */
+ typedef struct _BRUSHDATA
+ {
+ uint8 pattern[8];
+ }
+ BRUSHDATA;
+
typedef struct _BRUSH
{
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08