/[rdesktop]/sourceforge.net/trunk/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/trunk/rdesktop/xwin.c

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

revision 10 by matty, Tue Aug 15 10:23:24 2000 UTC revision 23 by matty, Tue Oct 17 08:24:09 2000 UTC
# Line 41  BOOL ui_create_window(char *title) Line 41  BOOL ui_create_window(char *title)
41    
42          display = XOpenDisplay(NULL);          display = XOpenDisplay(NULL);
43          if (display == NULL)          if (display == NULL)
44            {
45                    ERROR("Failed to open display\n");
46                  return False;                  return False;
47            }
48    
49          /* Check the screen supports 8-bit depth. */          /* Check the screen supports 8-bit depth. */
50          screen = DefaultScreenOfDisplay(display);          screen = DefaultScreenOfDisplay(display);
# Line 245  HGLYPH ui_create_glyph(int width, int he Line 248  HGLYPH ui_create_glyph(int width, int he
248    
249          image = XCreateImage(display, visual, 1, ZPixmap, 0,          image = XCreateImage(display, visual, 1, ZPixmap, 0,
250                                  data, width, height, 8, scanline);                                  data, width, height, 8, scanline);
251            image->byte_order = MSBFirst;
252            image->bitmap_bit_order = MSBFirst;
253            XInitImage(image);
254    
255          XSetFunction(display, gc, GXcopy);          XSetFunction(display, gc, GXcopy);
256          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
257          XFree(image);          XFree(image);
# Line 419  void ui_triblt(uint8 opcode, Line 426  void ui_triblt(uint8 opcode,
426    
427          switch (opcode)          switch (opcode)
428          {          {
429                    case 0x69: /* PDSxxn */
430                            ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy);
431                            ui_patblt(ROP2_NXOR, x, y, cx, cy,
432                                            brush, bgcolour, fgcolour);
433                            break;
434    
435                  case 0xb8: /* PSDPxax */                  case 0xb8: /* PSDPxax */
436                          ui_patblt(ROP2_XOR, x, y, cx, cy,                          ui_patblt(ROP2_XOR, x, y, cx, cy,
437                                          brush, bgcolour, fgcolour);                                          brush, bgcolour, fgcolour);
438                          ui_memblt(ROP2_AND, x, y, cx, cy,                          ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy);
                                         src, srcx, srcy);  
439                          ui_patblt(ROP2_XOR, x, y, cx, cy,                          ui_patblt(ROP2_XOR, x, y, cx, cy,
440                                          brush, bgcolour, fgcolour);                                          brush, bgcolour, fgcolour);
441                          break;                          break;
442    
443                  default:                  default:
444                          NOTIMP("triblt 0x%x\n", opcode);                          NOTIMP("triblt 0x%x\n", opcode);
445                          ui_memblt(ROP2_COPY, x, y, cx, cy,                          ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy);
                                         brush, bgcolour, fgcolour);  
446          }          }
447  }  }
448    
# Line 487  void ui_draw_glyph(int mixmode, Line 498  void ui_draw_glyph(int mixmode,
498          }          }
499  }  }
500    
501  void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x,  void ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y,
502                          int y, int boxx, int boxy, int boxcx, int boxcy,                          int clipx, int clipy, int clipcx, int clipcy,
503                            int boxx, int boxy, int boxcx, int boxcy,
504                          int bgcolour, int fgcolour, uint8 *text, uint8 length)                          int bgcolour, int fgcolour, uint8 *text, uint8 length)
505  {  {
506          FONTGLYPH *glyph;          FONTGLYPH *glyph;
# Line 498  void ui_draw_text(uint8 font, uint8 flag Line 510  void ui_draw_text(uint8 font, uint8 flag
510          {          {
511                  ui_rect(boxx, boxy, boxcx, boxcy, bgcolour);                  ui_rect(boxx, boxy, boxcx, boxcy, bgcolour);
512          }          }
513            else if (mixmode == MIX_OPAQUE)
514            {
515                    ui_rect(clipx, clipy, clipcx, clipcy, bgcolour);
516            }
517    
518          /* Paint text, character by character */          /* Paint text, character by character */
519          for (i = 0; i < length; i++)          for (i = 0; i < length; i++)
520          {          {
521                  glyph = cache_get_font(font, text[i]);                  glyph = cache_get_font(font, text[i]);
522    
523                    if (!(flags & TEXT2_IMPLICIT_X))
524                            x += text[++i];
525    
526                  if (glyph != NULL)                  if (glyph != NULL)
527                  {                  {
528                          ui_draw_glyph(mixmode, x,                          ui_draw_glyph(mixmode, x + (short)glyph->offset,
529                                          y + (short)glyph->baseline,                                          y + (short)glyph->baseline,
530                                          glyph->width, glyph->height,                                          glyph->width, glyph->height,
531                                          glyph->pixmap, 0, 0,                                          glyph->pixmap, 0, 0,
# Line 514  void ui_draw_text(uint8 font, uint8 flag Line 533  void ui_draw_text(uint8 font, uint8 flag
533    
534                          if (flags & TEXT2_IMPLICIT_X)                          if (flags & TEXT2_IMPLICIT_X)
535                                  x += glyph->width;                                  x += glyph->width;
                         else  
                                 x += text[++i];  
536                  }                  }
537          }          }
538  }  }
# Line 523  void ui_draw_text(uint8 font, uint8 flag Line 540  void ui_draw_text(uint8 font, uint8 flag
540  void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)  void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy)
541  {  {
542          XImage *image;          XImage *image;
         int scanline;  
543    
         scanline = (cx + 3) & ~3;  
         STATUS("XGetImage(%p,%x,%d,%d,%d,%d,%x,%d)\n", display, wnd, x, y,  
                 cx, cy, 0xffffffff, ZPixmap);  
544          image = XGetImage(display, wnd, x, y, cx, cy, 0xffffffff, ZPixmap);          image = XGetImage(display, wnd, x, y, cx, cy, 0xffffffff, ZPixmap);
545          cache_put_desktop(offset, scanline*cy, image->data);          cache_put_desktop(offset, cx, cy, image->bytes_per_line, image->data);
546          XFree(image->data);          XFree(image->data);
547          XFree(image);          XFree(image);
548  }  }
# Line 537  void ui_desktop_save(uint32 offset, int Line 550  void ui_desktop_save(uint32 offset, int
550  void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)  void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
551  {  {
552          XImage *image;          XImage *image;
         int scanline;  
553          uint8 *data;          uint8 *data;
554    
555          scanline = (cx + 3) & ~3;          data = cache_get_desktop(offset, cx, cy);
         data = cache_get_desktop(offset, scanline*cy);  
556          if (data == NULL)          if (data == NULL)
557                  return;                  return;
558    
559          image = XCreateImage(display, visual, 8, ZPixmap, 0,          image = XCreateImage(display, visual, 8, ZPixmap, 0,
560                                  data, cx, cy, 32, scanline);                                  data, cx, cy, 32, cx);
561          XSetFunction(display, gc, GXcopy);          XSetFunction(display, gc, GXcopy);
562          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);          XPutImage(display, wnd, gc, image, 0, 0, x, y, cx, cy);
563          XFree(image);          XFree(image);

Legend:
Removed from v.10  
changed lines
  Added in v.23

  ViewVC Help
Powered by ViewVC 1.1.26