/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/rdesktop/xwin.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/branches/seamlessrdp-branch/rdesktop/xwin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 821 by jdmeijer, Mon Feb 28 01:15:45 2005 UTC revision 843 by jdmeijer, Thu Mar 10 22:40:20 2005 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     User interface services - X Window System     User interface services - X Window System
4     Copyright (C) Matthew Chapman 1999-2002     Copyright (C) Matthew Chapman 1999-2005
5    
6     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 119  PixelColour; Line 119  PixelColour;
119          XFillRectangle(g_display, g_ownbackstore ? g_backstore : g_wnd, g_gc, x, y, cx, cy); \          XFillRectangle(g_display, g_ownbackstore ? g_backstore : g_wnd, g_gc, x, y, cx, cy); \
120  }  }
121    
122    #define FILL_POLYGON(p,np)\
123    { \
124            XFillPolygon(g_display, g_wnd, g_gc, p, np, Complex, CoordModePrevious); \
125            if (g_ownbackstore) \
126                    XFillPolygon(g_display, g_backstore, g_gc, p, np, Complex, CoordModePrevious); \
127    }
128    
129    #define DRAW_ELLIPSE(x,y,cx,cy,m)\
130    { \
131            switch (m) \
132            { \
133                    case 0: /* Outline */ \
134                            XDrawArc(g_display, g_wnd, g_gc, x, y, cx, cy, 0, 360*64); \
135                            if (g_ownbackstore) \
136                                    XDrawArc(g_display, g_backstore, g_gc, x, y, cx, cy, 0, 360*64); \
137                            break; \
138                    case 1: /* Filled */ \
139                            XFillArc(g_display, g_ownbackstore ? g_backstore : g_wnd, g_gc, x, y, \
140                                     cx, cy, 0, 360*64); \
141                            if (g_ownbackstore) \
142                                    XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, x, y); \
143                            break; \
144            } \
145    }
146    
147  /* colour maps */  /* colour maps */
148  extern BOOL g_owncolmap;  extern BOOL g_owncolmap;
149  static Colormap g_xcolmap;  static Colormap g_xcolmap;
# Line 662  translate16to32(const uint16 * data, uin Line 687  translate16to32(const uint16 * data, uin
687                  }                  }
688                  else                  else
689                  {                  {
690                            while (out < end)
691                          {                          {
692                                  pixel = *(data++);                                  pixel = *(data++);
693                                  SPLITCOLOUR16(pixel, pc);                                  SPLITCOLOUR16(pixel, pc);
# Line 764  translate24to32(const uint8 * data, uint Line 790  translate24to32(const uint8 * data, uint
790          if (g_arch_match)          if (g_arch_match)
791          {          {
792                  /* *INDENT-OFF* */                  /* *INDENT-OFF* */
793    #ifdef NEED_ALIGN
794                  REPEAT4                  REPEAT4
795                  (                  (
 #ifdef NEED_ALIGN  
796                          *(out++) = *(data++);                          *(out++) = *(data++);
797                          *(out++) = *(data++);                          *(out++) = *(data++);
798                          *(out++) = *(data++);                          *(out++) = *(data++);
799                          *(out++) = 0;                          *(out++) = 0;
800                    )
801  #else  #else
802                    REPEAT4
803                    (
804                          *((uint32 *) out) = *((uint32 *) data);                          *((uint32 *) out) = *((uint32 *) data);
805                          out += 4;                          out += 4;
806                          data += 3;                          data += 3;
 #endif  
807                  )                  )
808    #endif
809                  /* *INDENT-ON* */                  /* *INDENT-ON* */
810          }          }
811          else if (g_xserver_be)          else if (g_xserver_be)
# Line 2162  ui_rect( Line 2191  ui_rect(
2191          FILL_RECTANGLE(x, y, cx, cy);          FILL_RECTANGLE(x, y, cx, cy);
2192  }  }
2193    
2194    void
2195    ui_polygon(uint8 opcode,
2196               /* mode */ uint8 fillmode,
2197               /* dest */ POINT * point, int npoints,
2198               /* brush */ BRUSH * brush, int bgcolour, int fgcolour)
2199    {
2200            uint8 style, i, ipattern[8];
2201            Pixmap fill;
2202    
2203            SET_FUNCTION(opcode);
2204    
2205            switch (fillmode)
2206            {
2207                    case ALTERNATE:
2208                            XSetFillRule(g_display, g_gc, EvenOddRule);
2209                            break;
2210                    case WINDING:
2211                            XSetFillRule(g_display, g_gc, WindingRule);
2212                            break;
2213                    default:
2214                            unimpl("fill mode %d\n", fillmode);
2215            }
2216    
2217            if (brush)
2218                    style = brush->style;
2219            else
2220                    style = 0;
2221    
2222            switch (style)
2223            {
2224                    case 0: /* Solid */
2225                            SET_FOREGROUND(fgcolour);
2226                            FILL_POLYGON((XPoint *) point, npoints);
2227                            break;
2228    
2229                    case 2: /* Hatch */
2230                            fill = (Pixmap) ui_create_glyph(8, 8,
2231                                                            hatch_patterns + brush->pattern[0] * 8);
2232                            SET_FOREGROUND(fgcolour);
2233                            SET_BACKGROUND(bgcolour);
2234                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2235                            XSetStipple(g_display, g_gc, fill);
2236                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2237                            FILL_POLYGON((XPoint *) point, npoints);
2238                            XSetFillStyle(g_display, g_gc, FillSolid);
2239                            XSetTSOrigin(g_display, g_gc, 0, 0);
2240                            ui_destroy_glyph((HGLYPH) fill);
2241                            break;
2242    
2243                    case 3: /* Pattern */
2244                            for (i = 0; i != 8; i++)
2245                                    ipattern[7 - i] = brush->pattern[i];
2246                            fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
2247                            SET_FOREGROUND(bgcolour);
2248                            SET_BACKGROUND(fgcolour);
2249                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2250                            XSetStipple(g_display, g_gc, fill);
2251                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2252                            FILL_POLYGON((XPoint *) point, npoints);
2253                            XSetFillStyle(g_display, g_gc, FillSolid);
2254                            XSetTSOrigin(g_display, g_gc, 0, 0);
2255                            ui_destroy_glyph((HGLYPH) fill);
2256                            break;
2257    
2258                    default:
2259                            unimpl("brush %d\n", brush->style);
2260            }
2261    
2262            RESET_FUNCTION(opcode);
2263    }
2264    
2265    void
2266    ui_ellipse(uint8 opcode,
2267               /* mode */ uint8 fillmode,
2268               /* dest */ int x, int y, int cx, int cy,
2269               /* brush */ BRUSH * brush, int bgcolour, int fgcolour)
2270    {
2271            uint8 style, i, ipattern[8];
2272            Pixmap fill;
2273    
2274            SET_FUNCTION(opcode);
2275    
2276            if (brush)
2277                    style = brush->style;
2278            else
2279                    style = 0;
2280    
2281            switch (style)
2282            {
2283                    case 0: /* Solid */
2284                            SET_FOREGROUND(fgcolour);
2285                            DRAW_ELLIPSE(x, y, cx, cy, fillmode);
2286                            break;
2287    
2288                    case 2: /* Hatch */
2289                            fill = (Pixmap) ui_create_glyph(8, 8,
2290                                                            hatch_patterns + brush->pattern[0] * 8);
2291                            SET_FOREGROUND(fgcolour);
2292                            SET_BACKGROUND(bgcolour);
2293                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2294                            XSetStipple(g_display, g_gc, fill);
2295                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2296                            DRAW_ELLIPSE(x, y, cx, cy, fillmode);
2297                            XSetFillStyle(g_display, g_gc, FillSolid);
2298                            XSetTSOrigin(g_display, g_gc, 0, 0);
2299                            ui_destroy_glyph((HGLYPH) fill);
2300                            break;
2301    
2302                    case 3: /* Pattern */
2303                            for (i = 0; i != 8; i++)
2304                                    ipattern[7 - i] = brush->pattern[i];
2305                            fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
2306                            SET_FOREGROUND(bgcolour);
2307                            SET_BACKGROUND(fgcolour);
2308                            XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
2309                            XSetStipple(g_display, g_gc, fill);
2310                            XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
2311                            DRAW_ELLIPSE(x, y, cx, cy, fillmode);
2312                            XSetFillStyle(g_display, g_gc, FillSolid);
2313                            XSetTSOrigin(g_display, g_gc, 0, 0);
2314                            ui_destroy_glyph((HGLYPH) fill);
2315                            break;
2316    
2317                    default:
2318                            unimpl("brush %d\n", brush->style);
2319            }
2320    
2321            RESET_FUNCTION(opcode);
2322    }
2323    
2324  /* warning, this function only draws on wnd or backstore, not both */  /* warning, this function only draws on wnd or backstore, not both */
2325  void  void
2326  ui_draw_glyph(int mixmode,  ui_draw_glyph(int mixmode,
# Line 2217  ui_draw_glyph(int mixmode, Line 2376  ui_draw_glyph(int mixmode,
2376  }  }
2377    
2378  void  void
2379  ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,  ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y,
2380               int clipx, int clipy, int clipcx, int clipcy,               int clipx, int clipy, int clipcx, int clipcy,
2381               int boxx, int boxy, int boxcx, int boxcy, int bgcolour,               int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush,
2382               int fgcolour, uint8 * text, uint8 length)               int bgcolour, int fgcolour, uint8 * text, uint8 length)
2383  {  {
2384            /* TODO: use brush appropriately */
2385    
2386          FONTGLYPH *glyph;          FONTGLYPH *glyph;
2387          int i, j, xyoffset, x1, y1;          int i, j, xyoffset, x1, y1;
2388          DATABLOB *entry;          DATABLOB *entry;

Legend:
Removed from v.821  
changed lines
  Added in v.843

  ViewVC Help
Powered by ViewVC 1.1.26