-- Leo's gemini proxy
-- Connecting to git.thebackupbox.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: ddc3a6c736c902f90432398de8bba9d6655e5306: path_to: revision_to:
commit ddc3a6c736c902f90432398de8bba9d6655e5306 Author: Marc Lehmann <schmorp@schmorp.de> Date: Sun Dec 14 04:52:10 2014 +0000 ugh diff --git a/Changes b/Changes
--- a/Changes +++ b/Changes @@ -89,6 +89,9 @@ TODO: open question, what does the nested set_color calls in get_coplours actual simpler and actually more correct code. - hopefully no longer leak colours on !truecolor visuals. - use consistent method names (scr_recolour => scr_recolor). + - use simpler (but slightly less bogus) formula for nearest + colour choice (this is likely only relevant for antique 8bpp + frame buffers). 9.20 Sat Apr 26 16:22:27 CEST 2014 - (libptytty) fix bug that prevented urxvtd from writing utmp diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
--- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -25,6 +25,8 @@ #include <rxvt.h> #include <rxvttoolkit.h> +#include <stdlib.h> + #include <unistd.h> #include <fcntl.h> @@ -809,7 +811,8 @@ rxvt_color::alloc (rxvt_screen *screen, const rgba &color) return true; #endif - c.pixel = (color.r + color.g + color.b) > 128*3 + //TODO: set c.color* or c.* + c.pixel = (color.r * 2 + color.g * 3 + color.b) >= 0x8000 * 6 ? WhitePixelOfScreen (DefaultScreenOfDisplay (screen->dpy)) : BlackPixelOfScreen (DefaultScreenOfDisplay (screen->dpy)); @@ -879,14 +882,15 @@ rxvt_color::set (rxvt_screen *screen, const rgba &color) while (cmap_size) { - int diff = 0x7fffffffUL; + int diff = 0x7fffffffL; XColor *best = colors; for (int i = 0; i < cmap_size; i++) { - int d = (squared_diff<int> (color.r >> 2, colors [i].red >> 2)) - + (squared_diff<int> (color.g >> 2, colors [i].green >> 2)) - + (squared_diff<int> (color.b >> 2, colors [i].blue >> 2)); + // simple weighted rgb distance sucks, but keeps it simple + int d = abs (color.r - colors [i].red ) * 2 + + abs (color.g - colors [i].green) * 3 + + abs (color.b - colors [i].blue ); if (d < diff) { @@ -917,6 +921,7 @@ void rxvt_color::get (rgba &color) const { #if XFT + //TODO premultiplied alpha?? color.r = c.color.red; color.g = c.color.green; color.b = c.color.blue; diff --git a/src/rxvtutil.h b/src/rxvtutil.h
--- a/src/rxvtutil.h +++ b/src/rxvtutil.h @@ -24,8 +24,6 @@ template<typename T, typename U> static inline void max_it (T &a, U b) { a = a > template<typename T, typename U, typename V> static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; } template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; } -template<typename T> static inline T squared_diff (T a, T b) { return (a - b) * (a - b); } - // linear interpolation template<typename T, typename U, typename P> static inline T
-----END OF PAGE-----
-- Response ended
-- Page fetched on Sun Jun 2 12:22:02 2024