repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 4c147216e54a696112029a38e88838b5226c8fb1:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 4c147216e54a696112029a38e88838b5226c8fb1
Author: Marc Lehmann 
Date:   Wed Jun 6 22:01:45 2012 +0000

    *** empty log message ***

diff --git a/src/perl/background b/src/perl/background
index 7f14b53b686dfee48153d68d217238cfd338d341..
index ..7ba4269fb4f8a5eb0ed265b4786dcbf446e81cd9 100644
--- a/src/perl/background
+++ b/src/perl/background
@@ -26,10 +26,10 @@ our $MIN_INTERVAL = 1/100;
 {
    package urxvt::bgdsl; # background language

-   *repeat_empty  = \&urxvt::RepeatNone;
-   *repeat_tile   = \&urxvt::RepeatNormal;
-   *repeat_pad    = \&urxvt::RepeatPad;
-   *repeat_mirror = \&urxvt::RepeatReflect;
+#   *repeat_empty  = \&urxvt::RepeatNone;
+#   *repeat_tile   = \&urxvt::RepeatNormal;
+#   *repeat_pad    = \&urxvt::RepeatPad;
+#   *repeat_mirror = \&urxvt::RepeatReflect;

 =head2 PROVIDERS/GENERATORS

@@ -58,6 +58,30 @@ our $MIN_INTERVAL = 1/100;

 =back

+=head2 VARIABLES
+
+=over 4
+
+=cut
+
+   sub X() { $new->{position_sensitive} = 1; $l }
+   sub Y() { $new->{position_sensitive} = 1; $t }
+   sub W() { $new->{size_sensitive}     = 1; $w }
+   sub H() { $new->{size_sensitive}     = 1; $h }
+
+   sub now() { urxvt::NOW }
+
+   sub again($) {
+      $new->{again} = $_[0];
+   }
+
+   sub counter($) {
+      $new->{again} = $_[0];
+      $bgdsl_self->{counter} + 0
+   }
+
+=back
+
 =head2 OPERATORS

 =over 4
@@ -68,9 +92,9 @@ our $MIN_INTERVAL = 1/100;
 #      $_[0]->clone
 #   }

-   sub clip($$$$$;$) {
+   sub clip($;$$;$$) {
       my $img = pop;
-      $img->sub_rect ($_[0], $_[1], $_[2], $_[3], $_[4])
+      $img->sub_rect ($_[0], $_[1], $_[2] || W, $_[3] || H)
    }

    sub resize($$$) {
@@ -80,15 +104,18 @@ our $MIN_INTERVAL = 1/100;

    # TODO: ugly
    sub move($$;$) {
-      my $img = pop;
-      $img->sub_rect (
-         $_[0], $_[1],
-         $img->w, $img->h,
-         $_[2],
-      )
+      my $img = pop->clone;
+      $img->move ($_[0], $_[1]);
+      $img
+#      my $img = pop;
+#      $img->sub_rect (
+#         $_[0], $_[1],
+#         $img->w, $img->h,
+#         $_[2],
+#      )
    }

-   sub rotate($$$$$$;$) {
+   sub rotate($$$$$$) {
       my $img = pop;
       $img->rotate (
          $_[0],
@@ -96,7 +123,6 @@ our $MIN_INTERVAL = 1/100;
          $_[2] * $img->w * .01,
          $_[3] * $img->h * .01,
          $_[4] * (3.14159265 / 180),
-         $_[5],
       )
    }

@@ -130,22 +156,6 @@ our $MIN_INTERVAL = 1/100;
       $img
    }

-   sub X() { $new->{position_sensitive} = 1; $l }
-   sub Y() { $new->{position_sensitive} = 1; $t }
-   sub W() { $new->{size_sensitive}     = 1; $w }
-   sub H() { $new->{size_sensitive}     = 1; $h }
-
-   sub now() { urxvt::NOW }
-
-   sub again($) {
-      $new->{again} = $_[0];
-   }
-
-   sub counter($) {
-      $new->{again} = $_[0];
-      $bgdsl_self->{counter} + 0
-   }
-
 =back

 =cut
diff --git a/src/rxvtimg.C b/src/rxvtimg.C
index 867c5141f61a0af49294cde274e5a18e4e44e773..
index ..2a53179066d0560f9d7ae0b6002375b1644656be 100644
--- a/src/rxvtimg.C
+++ b/src/rxvtimg.C
@@ -7,13 +7,13 @@
 #define float_to_component(d) ((d) * 65535.99)

 rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height)
-: s(screen), w(width), h(height), format(format), shared(false)
+: s(screen), x(0), y(0), w(width), h(height), format(format), repeat(RepeatNormal), shared(false)
 {
   pm = XCreatePixmap (s->display->dpy, s->display->root, w, h, format->depth);
 }

 rxvt_img::rxvt_img (rxvt_screen *screen, XRenderPictFormat *format, int width, int height, Pixmap pixmap)
-: s(screen), pm(pixmap), w(width), h(height), format(format), shared(false)
+: s(screen), x(0), y(0), w(width), h(height), format(format), repeat(RepeatNormal), shared(false), pm(pixmap)
 {
 }

@@ -354,7 +354,7 @@ rxvt_img::clone ()
 }

 rxvt_img *
-rxvt_img::sub_rect (int x, int y, int width, int height, int repeat)
+rxvt_img::sub_rect (int x, int y, int width, int height)
 {
   rxvt_img *img = new rxvt_img (s, format, width, height);

@@ -373,7 +373,7 @@ rxvt_img::sub_rect (int x, int y, int width, int height, int repeat)
 }

 rxvt_img *
-rxvt_img::transform (int new_width, int new_height, double matrix[9], int repeat)
+rxvt_img::transform (int new_width, int new_height, double matrix[9])
 {
   rxvt_img *img = new rxvt_img (s, format, new_width, new_height);

@@ -412,7 +412,7 @@ rxvt_img::scale (int new_width, int new_height)
 }

 rxvt_img *
-rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi, int repeat)
+rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi)
 {
   double s = sin (phi);
   double c = cos (phi);
@@ -423,7 +423,7 @@ rxvt_img::rotate (int new_width, int new_height, int x, int y, double phi, int r
     0,  0,                  1
   };

-  return transform (new_width, new_height, matrix, repeat);
+  return transform (new_width, new_height, matrix);
 }

 rxvt_img *
diff --git a/src/rxvtimg.h b/src/rxvtimg.h
index fa044fa3401c8e0d602ecb53a37070bafe82bdfe..
index ..d634fd2413a04e7950fc09a179da5012b103eaed 100644
--- a/src/rxvtimg.h
+++ b/src/rxvtimg.h
@@ -13,7 +13,7 @@ struct rxvt_img
 {
   rxvt_screen *s;
   Pixmap pm;
-  int w, h;
+  int x, y, w, h, repeat;
   XRenderPictFormat *format;
   bool shared; // true if we don't own it

@@ -31,6 +31,17 @@ struct rxvt_img
   }

   // inplace
+  void move (int dx, int dy)
+  {
+    x += dx;
+    y += dy;
+  }
+
+  void repeat_mode (int repeat)
+  {
+    this->repeat = repeat;
+  }
+
   void unshare (); // create a copy of the pixmap if !shared
   void fill (const rxvt_color &c);
   void brightness (double r, double g, double b, double a = 1.);
@@ -40,10 +51,10 @@ struct rxvt_img
   // copy
   rxvt_img *blur (int rh, int rv);
   rxvt_img *clone ();
-  rxvt_img *sub_rect (int x, int y, int width, int height, int repeat = RepeatNormal);
-  rxvt_img *transform (int new_width, int new_height, double matrix[9], int repeat = RepeatNormal);
+  rxvt_img *sub_rect (int x, int y, int width, int height);
+  rxvt_img *transform (int new_width, int new_height, double matrix[9]);
   rxvt_img *scale (int new_width, int new_height);
-  rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi, int repeat = RepeatNormal);
+  rxvt_img *rotate (int new_width, int new_height, int x, int y, double phi);
   rxvt_img *convert_to (XRenderPictFormat *format, const rxvt_color &bg);
   rxvt_img *blend (rxvt_img *img, double factor);
 };
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index 784cc2716e6dd9be5d44f61b4fe25b57f66a5fe3..
index ..0a64cc6e8f920928faadf5755deb96bb6acb1143 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -2096,6 +2096,7 @@ rxvt_term::set_background (rxvt_img *img)
           {
             XRenderPictFormat *f = XRenderFindVisualFormat (THIS->dpy, THIS->visual);
             rxvt_img *img2 = 0;
+            rxvt_img *img3 = 0;

             if (f != img->format)
               img = img2 = img->convert_to (f, THIS->pix_colors [Color_bg]);
@@ -2193,39 +2194,45 @@ rxvt_img::DESTROY ()
 	CODE:
         delete THIS;

-rxvt_img *
-rxvt_img::blur (int rh, int rv)
+void
+rxvt_img::unshare ()

 void
-rxvt_img::brightness (NV r, NV g, NV b, NV a = 1.)
+rxvt_img::repeat_mode (render_repeat_mode repeat = RepeatNormal)

 void
-rxvt_img::contrast (NV r, NV g, NV b, NV a = 1.)
+rxvt_img::move (int dx, int dy)

 void
-rxvt_img::unshare ()
+rxvt_img::brightness (NV r, NV g, NV b, NV a = 1.)
+
+void
+rxvt_img::contrast (NV r, NV g, NV b, NV a = 1.)

 rxvt_img *
 rxvt_img::clone ()

 rxvt_img *
-rxvt_img::sub_rect (int x, int y, int width, int height, render_repeat_mode repeat = RepeatNormal)
+rxvt_img::sub_rect (int x, int y, int width, int height)
+
+rxvt_img *
+rxvt_img::blur (int rh, int rv)

 rxvt_img *
-rxvt_img::transform (int new_width, int new_height, NV p11, NV p12, NV p13, NV p21, NV p22, NV p23, NV p31, NV p32, NV p33, render_repeat_mode repeat = RepeatNormal)
+rxvt_img::transform (int new_width, int new_height, NV p11, NV p12, NV p13, NV p21, NV p22, NV p23, NV p31, NV p32, NV p33)
 	INIT:
         double matrix[9] = {
           p11, p12, p13,
           p21, p22, p23,
           p31, p32, p33
         };
-	C_ARGS: new_width, new_height, matrix, repeat
+	C_ARGS: new_width, new_height, matrix

 rxvt_img *
 rxvt_img::scale (int new_width, int new_height)

 rxvt_img *
-rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi, render_repeat_mode repeat = RepeatNormal)
+rxvt_img::rotate (int new_width, int new_height, int x, int y, NV phi)

 #endif

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