*** empty log message ***
authorroot <root>
Sat, 18 Feb 2006 15:24:39 +0000 (15:24 +0000)
committerroot <root>
Sat, 18 Feb 2006 15:24:39 +0000 (15:24 +0000)
Changes
src/init.C
src/rxvtfont.C
src/screen.C
src/xpm.C

diff --git a/Changes b/Changes
index 2c6b01d731a3e81d81f43ce7941302051c11b2b1..816f63d6c105d6f55fcc633b5e72a4f43191a61b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -13,8 +13,13 @@ WISH: anyevent mouse notification / manage MotionMask better.
 WISH: http://www120.pair.com/mccarthy/nextstep/intro.htmld/Workspace.html is the correct nextstep look.
 DUMB: support tex fonts
 
+       - use double-buffered drawing for xft fonts only. On many driver/hardware
+          combination this actually increases xft drawing speed, at the expense
+          of more network bandwidth and slight nausea on the side of the author.
        - readline perl extension now requires shift-click instead of a normal
           click.
+        - disabled graphics-exposures on the main drawing GC, report any
+          refresh bugs please.
        - improve property handling for -pe tabbed: avoid unnecessary property
           changes (for kde's benefit) at the expense of extra round-trips,
           improve size hint setting.
index c4ff9a7fcfe502abbedcabf05e664ce49524dc60..45693336fd6af55fa762e852835a9c8c0b27c424 100644 (file)
@@ -1054,7 +1054,7 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   /* graphics context for the vt window */
   gcvalue.foreground         = pix_colors[Color_fg];
   gcvalue.background         = pix_colors[Color_bg];
-  gcvalue.graphics_exposures = 1;
+  gcvalue.graphics_exposures = 0;
 
   gc = XCreateGC (dpy, vt,
                   GCForeground | GCBackground | GCGraphicsExposures,
index 75fc571d426740159aae427176cda5c8412f6b62..0551463df6cc60f1b129570a3a39acc27e3b7df0 100644 (file)
@@ -234,9 +234,9 @@ rxvt_font::clear_rect (rxvt_drawable &d, int x, int y, int w, int h, int color)
   dTermDisplay;
   dTermGC;
   
-  if (color == Color_bg)
+  if (color < 0 || color == Color_bg)
     XClearArea (disp, d, x, y, w, h, false);
-  else if (color >= 0)
+  else
     {
 #if XFT
       XftDrawRect (d, &term->pix_colors[color].c, x, y, w, h);
@@ -1276,7 +1276,9 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
   int w = term->fwidth * len;
   int h = term->fheight;
 
-  bool buffered = false;
+  bool buffered = !term->am_transparent           // we aren't transparent
+                  || term->am_pixmap_trans        // we have a pixmap
+                  || bg >= 0;                     // we don't use a transparent bg
 
   // cut trailing spaces
   while (len && text [len - 1] == ' ')
@@ -1317,7 +1319,27 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y,
         {
           rxvt_drawable &d2 = d.screen->scratch_drawable (w, h);
 
-          XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h);
+          if (bg < 0 && term->am_pixmap_trans)
+            XCopyArea (disp, term->pixmap, d2, gc, x, y, w, h, 0, 0);
+          else if (bg < 0 && term->bgPixmap.pixmap)
+            {
+              XGCValues gcv;
+
+              gcv.fill_style  = FillTiled;
+              gcv.tile        = term->pixmap;
+              gcv.ts_x_origin = -x;
+              gcv.ts_y_origin = -y;
+
+              GC gc2 = XCreateGC (disp, d2,
+                                  GCTile | GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle,
+                                  &gcv);
+
+              XFillRectangle (disp, d2, gc2, 0, 0, w, h);
+
+              XFreeGC (disp, gc2);
+            }
+          else
+            XftDrawRect (d2, &term->pix_colors[bg].c, 0, 0, w, h);
 
           XftDrawGlyphSpec (d2, &term->pix_colors[fg].c, f, enc, ep - enc);
           XCopyArea (disp, d2, d, gc, 0, 0, w, h, x, y);
index 89c8da42077e107dca21c8c7047dd433ed8d20e6..66fc25c75ac1269ba560e1de11116ce3b9519244 100644 (file)
@@ -1971,7 +1971,7 @@ rxvt_term::scr_printscreen (int fullhist) NOTHROW
 void
 rxvt_term::scr_refresh () NOTHROW
 {
-  unsigned char must_clear, /* use draw_string not draw_image_string     */
+  unsigned char have_bg,
                 showcursor; /* show the cursor                           */
   int16_t col, row,   /* column/row we're processing               */
           ocrow;      /* old cursor row                            */
@@ -1989,14 +1989,14 @@ rxvt_term::scr_refresh () NOTHROW
   /*
    * A: set up vars
    */
-  must_clear = 0;
+  have_bg = 0;
   refresh_count = 0;
 
 #if XPM_BACKGROUND
-  must_clear |= bgPixmap.pixmap != None;
+  have_bg |= bgPixmap.pixmap != None;
 #endif
 #if TRANSPARENT
-  must_clear |= OPTION (Opt_transparent) && am_transparent;
+  have_bg |= OPTION (Opt_transparent) && am_transparent;
 #endif
   ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
 
@@ -2105,7 +2105,7 @@ rxvt_term::scr_refresh () NOTHROW
    */
   if (!display->is_local
       && refresh_type == FAST_REFRESH && num_scr_allow && num_scr
-      && abs (num_scr) < nrow && !must_clear)
+      && abs (num_scr) < nrow && !have_bg)
     {
       int16_t nits;
       int j;
@@ -2151,11 +2151,16 @@ rxvt_term::scr_refresh () NOTHROW
               if (wlen < len)
                 ::swap (wlen, len);
 
+              XGCValues gcv;
+
+              gcv.graphics_exposures = 1; XChangeGC (dpy, gc, GCGraphicsExposures, &gcv);
               XCopyArea (dpy, vt, vt,
                          gc, 0, Row2Pixel (len + i),
                          (unsigned int)this->width,
                          (unsigned int)Height2Pixel (wlen - len + 1),
                          0, Row2Pixel (len));
+              gcv.graphics_exposures = 0; XChangeGC (dpy, gc, GCGraphicsExposures, &gcv);
+
               len = -1;
             }
         }
@@ -2221,14 +2226,14 @@ rxvt_term::scr_refresh () NOTHROW
               if (stp[col] != dtp[col]
                   || !RS_SAME (srp[col], drp[col]))
                 {
-                  if (must_clear && (i++ > count / 2))
+                  if (have_bg && (i++ > count / 2))
                     break;
 
                   dtp[col] = stp[col];
                   drp[col] = rend;
                   i = 0;
                 }
-              else if (must_clear || (stp[col] != ' ' && ++i >= 16))
+              else if (have_bg || (stp[col] != ' ' && ++i >= 16))
                 break;
             }
 
@@ -2332,21 +2337,19 @@ rxvt_term::scr_refresh () NOTHROW
 
           if (back == fore)
             font->clear_rect (*drawable, xpixel, ypixel, fwidth * count, fheight, back);
-          else if (back == Color_bg)
+          else if (back == Color_bg && have_bg)
             {
-              if (must_clear)
-                {
-                  CLEAR_CHARS (xpixel, ypixel, count);
-
-                  for (i = 0; i < count; i++) /* don't draw empty strings */
-                    if (text[i] != ' ')
-                      {
-                        font->draw (*drawable, xpixel, ypixel, text, count, fore, -1);
-                        break;
-                      }
-                }
-              else
-                font->draw (*drawable, xpixel, ypixel, text, count, fore, Color_bg);
+              // this is very ugly, maybe push it into ->draw?
+
+              for (i = 0; i < count; i++) /* don't draw empty strings */
+                if (text[i] != ' ')
+                  {
+                    font->draw (*drawable, xpixel, ypixel, text, count, fore, -1);
+                    goto did_clear;
+                  }
+
+              CLEAR_CHARS (xpixel, ypixel, count);
+              did_clear: ;
             }
           else
             font->draw (*drawable, xpixel, ypixel, text, count, fore, back);
index 4366467ccce57bd555c880c228c98b9b36159cc3..43236c1fcc2335e9490ef7eb998e0ed3e7181aec 100644 (file)
--- a/src/xpm.C
+++ b/src/xpm.C
@@ -260,12 +260,6 @@ rxvt_term::resize_pixmap ()
 
   XSetWindowBackgroundPixmap (dpy, vt, pixmap);
 
-  if (pixmap != None)
-    {
-      XFreePixmap (dpy, pixmap);
-      pixmap = None;
-    }
-
   XFreeGC (dpy, gc);
   am_transparent = 0;
 }