repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 04ea16588fd12df326733d6e300ac93a144709a3:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 04ea16588fd12df326733d6e300ac93a144709a3
Author: Marc Lehmann 
Date:   Wed Jul 5 19:22:15 2006 +0000

    *** empty log message ***

diff --git a/Changes b/Changes
index 7463f948342199d210bfbfe689bf88b88f7e026d..
index ..284f4eee1dba44c863d21e64edb733d2fc1c36f6 100644
--- a/Changes
+++ b/Changes
@@ -19,8 +19,7 @@ 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

-TODO: rxvt -bg "#262626" -fn "xft:Andale Mono:pixelsize=15"
-      # causes some lines with #252525 in the output. rounding bug in xft?
+TODO: investigate -pe tabbed -g 80x25 being 23 not 24 or 25 lines
 TODO: zero scorllback buffer should free memory
 TODO: kuake
 TODO: depth resource not working(?)
@@ -28,6 +27,8 @@ TODO: fix the flaw in the url regex jost pointed out
 TODO: look into the selection hilight patch
 TODO: implement smartcase-like search in searchable-scrollback
 TODO: check wether -depth works as resource
+TODO: digital clock gets nuked after searching
+TODO: read .Xdefaults even when we have display resources, but give them lower priority
 	- add FORCE_UNBUFFERED_XFT define to features.h.
         - double-buffered xft drawing did suffer from pixel offset issues
           when pixmap transparency was enabled.
@@ -47,6 +48,8 @@ TODO: check wether -depth works as resource
         - slap in a using namespace std, might help on platforms that don't
           follow C++ closely enough.
         - fix mailto url regex, spotted within milliseconds by Jost Krieger.
+        - use less "correct" color scaling that is compatible with libX11 and Xft
+          (avoids off-by-one colors resulting in striped backgrounds).

 7.7  Tue Feb 21 12:32:49 CET 2006
 	- use double-buffered drawing (xft fonts only). On many driver/hardware
diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
index e2518b90806e588d4199169fb365dbcbdb946e01..
index ..102b69bfe775e9f56b7dfb6a85b6b270db863f4a 100644
--- a/src/rxvttoolkit.C
+++ b/src/rxvttoolkit.C
@@ -651,6 +651,13 @@ template class refcache;
 refcache displays;

 /////////////////////////////////////////////////////////////////////////////
+//
+
+static unsigned int
+insert_component (unsigned int value, unsigned int mask, unsigned int shift)
+{
+  return (value * (mask + 1) >> 16) << shift;
+}

 bool
 rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
@@ -670,10 +677,10 @@ rxvt_color::alloc (rxvt_screen *screen, const rgba &color)
       c.color.blue  = color.b;
       c.color.alpha = color.a;

-      c.pixel = ((color.r * format->direct.redMask   / rgba::MAX_CC) << format->direct.red  )
-              | ((color.g * format->direct.greenMask / rgba::MAX_CC) << format->direct.green)
-              | ((color.b * format->direct.blueMask  / rgba::MAX_CC) << format->direct.blue )
-              | ((color.a * format->direct.alphaMask / rgba::MAX_CC) << format->direct.alpha);
+      c.pixel = insert_component (color.r, format->direct.redMask  , format->direct.red  )
+              | insert_component (color.g, format->direct.greenMask, format->direct.green)
+              | insert_component (color.b, format->direct.blueMask , format->direct.blue )
+              | insert_component (color.a, format->direct.alphaMask, format->direct.alpha);

       return true;
     }

-----END OF PAGE-----