-- 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: 5b286192850c126a32dfa39864a09338e344f1ad:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

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

commit 5b286192850c126a32dfa39864a09338e344f1ad
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Wed Jun 6 22:00:20 2012 +0000

    Remove image vector implementation.

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

index 60e958322da64fbd22ccd41e179b50ff572e4a8f..

index ..65cd55c8371e40b8206d9d8a0377e86787c606fe 100644

--- a/src/background.C
+++ b/src/background.C
@@ -61,8 +61,7 @@ void
 rxvt_term::bg_destroy ()
 {
 # if BG_IMAGE_FROM_FILE
-  for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
-    bg_image->destroy ();
+  fimage.destroy ();
 # endif

   if (bg_pixmap)
@@ -92,11 +91,11 @@ rxvt_term::bg_window_size_sensitive ()
 # endif

 # if BG_IMAGE_FROM_FILE
-  for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
+  if (fimage.flags & IM_IS_SET)
     {
-      if ((bg_image->flags & IM_IS_SIZE_SENSITIVE)
-          || bg_image->width () > szHint.width
-          || bg_image->height () > szHint.height)
+      if ((fimage.flags & IM_IS_SIZE_SENSITIVE)
+          || fimage.width () > szHint.width
+          || fimage.height () > szHint.height)
         return true;
     }
 # endif
@@ -113,9 +112,9 @@ rxvt_term::bg_window_position_sensitive ()
 # endif

 # if BG_IMAGE_FROM_FILE
-  for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
+  if (fimage.flags & IM_IS_SET)
     {
-      if (bg_image->flags & IM_ROOT_ALIGN)
+      if (fimage.flags & IM_ROOT_ALIGN)
         return true;
     }
 # endif
@@ -539,11 +538,7 @@ rxvt_term::render_image (rxvt_image &image)
     tmp_pixmap = XCreatePixmap (dpy, vt, new_pmap_width, new_pmap_height, 32);
   else
     {
-      // optimise bg pixmap size when tiling, but only if there are no
-      // other pixbufs to render. Otherwise, the bg pixmap size must
-      // be equal to the window size.
-      if ((image.flags & IM_TILE)
-          && image_vec.size () == 1)
+      if (image.flags & IM_TILE)
         {
           new_pmap_width = min (image_width, target_width);
           new_pmap_height = min (image_height, target_height);
@@ -653,39 +648,6 @@ rxvt_term::render_image (rxvt_image &image)
 }
 #  endif /* HAVE_PIXBUF */

-#  ifndef NO_RESOURCES
-static int
-rxvt_define_image (XrmDatabase *database ecb_unused,
-                   XrmBindingList bindings ecb_unused,
-                   XrmQuarkList quarks,
-                   XrmRepresentation *type ecb_unused,
-                   XrmValue *value,
-                   XPointer closure ecb_unused)
-{
-  int size;
-
-  for (size = 0; quarks[size] != NULLQUARK; size++)
-    ;
-
-  if (size >= 2)
-    {
-      int id = strtol (XrmQuarkToString (quarks[size-2]), 0, 0);
-      if (id >= 1)
-        GET_R->parse_image (id, XrmQuarkToString (quarks[size-1]), (char *)value->addr);
-    }
-  return False;
-}
-#  endif
-
-void
-rxvt_term::parse_image (int id, const char *type, const char *arg)
-{
-  if (image_vec.size () < id + 1)
-    image_vec.resize (id + 1);
-
-  rxvt_image *image = &image_vec[id];
-}
-
 rxvt_image::rxvt_image ()
 {
   alpha = 0xffff;
@@ -1158,9 +1120,9 @@ rxvt_term::bg_render ()
 # endif

 # if BG_IMAGE_FROM_FILE
-  for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
+  if (fimage.flags & IM_IS_SET)
     {
-      if (render_image (*bg_image))
+      if (render_image (fimage))
         bg_flags |= BG_IS_VALID;
     }
 # endif
@@ -1188,32 +1150,10 @@ rxvt_term::bg_init ()
 #if BG_IMAGE_FROM_FILE
   if (rs[Rs_backgroundPixmap])
     {
-      rxvt_image *image = new_image ();
-      if (!image->set_file_geometry (rs[Rs_backgroundPixmap]))
-        image_vec.pop_back ();
-    }
-
-# ifndef NO_RESOURCES
-  find_resources ("image", "Image", XrmEnumAllLevels, rxvt_define_image);
-# endif
-
-  vector<rxvt_image>::iterator bg_image = image_vec.begin ();
-  while (bg_image != image_vec.end ())
-    {
-      if (!(bg_image->flags & IM_IS_SET))
-        bg_image = image_vec.erase (bg_image);
-      else
-        {
-          if (bg_image->is_size_sensitive ())
-            bg_image->flags |= IM_IS_SIZE_SENSITIVE;
-
-          bg_image++;
-        }
+      if (fimage.set_file_geometry (rs[Rs_backgroundPixmap])
+          && !bg_window_position_sensitive ())
+        update_background ();
     }
-
-  if (image_vec.size () > 0
-      && !bg_window_position_sensitive ())
-    update_background ();
 #endif
 }

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

index 8cdbe8663dd9b7fc2d3a109acd0994caf02f1196..

index ..73fc733db94c33f3b3b06ad6a9306323273b5622 100644

--- a/src/command.C
+++ b/src/command.C
@@ -3474,15 +3474,10 @@ rxvt_term::process_xterm_seq (int op, char *str, char resp)
         if (!strcmp (str, "?"))
           {
             char str[256];
-            int h_scale = 0, v_scale = 0;
-            int h_align = 0, v_align = 0;
-            if (image_vec.size () > 0)
-              {
-                h_scale = image_vec[0].h_scale;
-                v_scale = image_vec[0].v_scale;
-                h_align = image_vec[0].h_align;
-                v_align = image_vec[0].v_align;
-              }
+            int h_scale = fimage.h_scale;
+            int v_scale = fimage.v_scale;
+            int h_align = fimage.h_align;
+            int v_align = fimage.v_align;

             sprintf (str, "[%dx%d+%d+%d]",
                      h_scale, v_scale,
@@ -3495,22 +3490,14 @@ rxvt_term::process_xterm_seq (int op, char *str, char resp)

             if (*str != ';')
               {
-                if (image_vec.size () > 0)
-                  changed = image_vec[0].set_file_geometry (str);
-                else
-                  {
-                    rxvt_image *image = new_image ();
-                    if (!image->set_file_geometry (str))
-                      image_vec.pop_back ();
-                    else
-                      changed = true;
-                  }
+                if (fimage.set_file_geometry (str))
+                  changed = true;
               }
             else
               {
                 str++;
-                if (image_vec.size () > 0)
-                  changed = image_vec[0].set_geometry (str, true);
+                if (fimage.set_geometry (str, true))
+                  changed = true;
               }

             if (changed)
diff --git a/src/rxvt.h b/src/rxvt.h

index 85920a60b81f0a526070ab352c2d087aecf2205d..

index ..9ee91124fcec1493f5cbfb875b66e8a8a0ad7097 100644

--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -1200,15 +1200,9 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen
   uint8_t bg_flags;

 # if BG_IMAGE_FROM_FILE
-  vector<rxvt_image> image_vec;
-  rxvt_image *new_image ()
-  {
-    image_vec.resize (image_vec.size () + 1);
-    return &image_vec.back ();
-  }
+  rxvt_image fimage;
   void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y);
   bool render_image (rxvt_image &image);
-  void parse_image (int id, const char *type, const char *arg);
 # endif

 # if ENABLE_TRANSPARENCY
diff --git a/src/xdefaults.C b/src/xdefaults.C

index 693fecf1cccc30c83b4694ac5cb54642589d6bcc..

index ..878df8fddbe874ecbe07494dc25fe4b48ea4820a 100644

--- a/src/xdefaults.C
+++ b/src/xdefaults.C
@@ -833,7 +833,7 @@ rxvt_term::extract_keysym_resources ()
 #endif
 }

-#if !defined NO_RESOURCES && (defined KEYSYM_RESOURCE || defined BG_IMAGE_FROM_FILE)
+#if !defined NO_RESOURCES && defined KEYSYM_RESOURCE
 void
 rxvt_term::find_resources (const char *n_prefix, const char *c_prefix, int mode,
                            Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer))

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

-- Response ended

-- Page fetched on Sun Jun 2 09:40:05 2024