-- 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: 3b89422bf459e1e3ee8757139485ef8a8a5c9328:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit 3b89422bf459e1e3ee8757139485ef8a8a5c9328
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Sun Jun 3 15:50:22 2012 +0000

    Move detection of render extension in rxvt_display, and check also if
    the render version is recent enough to provide the multiply operator.

diff --git a/src/background.C b/src/background.C

index 3cad18153672648daa0834ec9eab44c8a9f9b480..

index ..08c31c14131e3483428273d4abd492ba03bb17e1 100644

--- a/src/background.C
+++ b/src/background.C
@@ -486,7 +486,7 @@ rxvt_term::render_image (rxvt_image &image)
   bool need_blend = bg_flags & BG_IS_VALID;

   if (need_blend
-      && !(bg_flags & BG_HAS_RENDER))
+      && !(display->flags & DISPLAY_HAS_RENDER))
     return false;

   GdkPixbuf *result;
@@ -839,7 +839,7 @@ rxvt_term::blur_pixmap (Pixmap pixmap, int width, int height, bool argb, int h_b
 {
   bool ret = false;
 #if XRENDER
-  if (!(bg_flags & BG_HAS_RENDER_CONV))
+  if (!(display->flags & DISPLAY_HAS_RENDER_CONV))
     return false;

   int size = max (h_blurRadius, v_blurRadius) * 2 + 1;
@@ -933,7 +933,7 @@ rxvt_term::tint_pixmap (Pixmap pixmap, int width, int height, bool argb, rxvt_co
         }
     }
 #  if XRENDER
-  else if (bg_flags & BG_HAS_RENDER)
+  else if (display->flags & DISPLAY_HAS_RENDER)
     {
       if (shade <= 100)
         {
@@ -1048,7 +1048,7 @@ rxvt_term::render_root_image ()
   if (root_pixmap != None && root_depth != depth)
     {
 #if XRENDER
-      if (bg_flags & BG_HAS_RENDER)
+      if (display->flags & DISPLAY_HAS_RENDER)
         {
           recoded_root_pmap = XCreatePixmap (dpy, vt, root_pmap_width, root_pmap_height, depth);

@@ -1185,22 +1185,6 @@ rxvt_term::bg_render ()
 void
 rxvt_term::bg_init ()
 {
-  bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV);
-#if XRENDER
-  int major, minor;
-  if (XRenderQueryVersion (dpy, &major, &minor))
-    bg_flags |= BG_HAS_RENDER;
-  XFilters *filters = XRenderQueryFilters (dpy, vt);
-  if (filters)
-    {
-      for (int i = 0; i < filters->nfilter; i++)
-        if (!strcmp (filters->filter[i], FilterConvolution))
-          bg_flags |= BG_HAS_RENDER_CONV;
-
-      XFree (filters);
-    }
-#endif
-
 #ifdef BG_IMAGE_FROM_FILE
   if (rs[Rs_backgroundPixmap])
     {
diff --git a/src/rxvt.h b/src/rxvt.h

index 557d20dbd0c4688f731c711d0972bb4be72ce889..

index ..23eff7b8a5c162b239a9e22f1808ca7a19a5ea5d 100644

--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -1194,9 +1194,6 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen

     BG_IS_TRANSPARENT    = 1 << 1,
     BG_NEEDS_REFRESH     = 1 << 2,
-
-    BG_HAS_RENDER        = 1 << 3,
-    BG_HAS_RENDER_CONV   = 1 << 4,
   };

   uint8_t bg_flags;
diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C

index e2d0e6914a7a5e4772026b7bd59b63e5f3f5ac26..

index ..aa56bb52051620b80a2536369bfd6aa51c6e270f 100644

--- a/src/rxvttoolkit.C
+++ b/src/rxvttoolkit.C
@@ -468,6 +468,28 @@ bool rxvt_display::ref_init ()
   XUnloadFont (dpy, f);
 #endif

+  flags = 0;
+#if XRENDER
+  int major, minor;
+  if (XRenderQueryVersion (dpy, &major, &minor))
+    {
+      flags |= DISPLAY_HAS_RENDER;
+
+      if (major > 0 || (major == 0 && minor >= 11))
+        flags |= DISPLAY_HAS_RENDER_MUL;
+
+      XFilters *filters = XRenderQueryFilters (dpy, root);
+      if (filters)
+        {
+          for (int i = 0; i < filters->nfilter; i++)
+            if (!strcmp (filters->filter[i], FilterConvolution))
+              flags |= DISPLAY_HAS_RENDER_CONV;
+
+          XFree (filters);
+        }
+    }
+#endif
+
   int fd = XConnectionNumber (dpy);

   // try to detect whether we have a local connection.
diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h

index 95abd8a6fe072e95139d4987386434c6ad5dc243..

index ..6c6e23eacb26367401bd54766ea55e3dfc08c76e 100644

--- a/src/rxvttoolkit.h
+++ b/src/rxvttoolkit.h
@@ -218,6 +218,12 @@ struct rxvt_screen
   void clear ();
 };

+enum {
+  DISPLAY_HAS_RENDER      = 1 << 0,
+  DISPLAY_HAS_RENDER_MUL  = 1 << 1,
+  DISPLAY_HAS_RENDER_CONV = 1 << 2,
+};
+
 struct rxvt_display : refcounted
 {
   event_vec<xevent_watcher> xw;
@@ -244,6 +250,7 @@ struct rxvt_display : refcounted
 #ifdef POINTER_BLANK
   Cursor    blank_cursor;
 #endif
+  uint8_t   flags;

   rxvt_display (const char *id);
   XrmDatabase get_resources (bool refresh);

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

-- Response ended

-- Page fetched on Sun Jun 2 11:59:35 2024