repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 2336c9af5d052b47e90c6767d9f1aed11010149b:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 2336c9af5d052b47e90c6767d9f1aed11010149b
Author: Marc Lehmann 
Date:   Thu Jun 14 19:31:17 2012 +0000

    *** empty log message ***

diff --git a/src/perl/background b/src/perl/background
index 85c3d4854e4b768ea2d44308b6dc56d8b302e365..
index ..acea1acd2d38a3baf8d9ef29e03d35ac9bb19d44 100644
--- a/src/perl/background
+++ b/src/perl/background
@@ -287,7 +287,7 @@ useful for solid backgrounds or for use in filtering effects.
    sub solid($;$$) {
       my $colour = pop;

-      my $img = $self->new_img (urxvt::PictStandardARGB32, $_[0] || 1, $_[1] || 1);
+      my $img = $self->new_img (urxvt::PictStandardARGB32, 0, 0, $_[0] || 1, $_[1] || 1);
       $img->fill ($colour);
       $img
    }
@@ -313,8 +313,8 @@ image containing them all.
    sub merge(@) {
       # rather annoyingly clumsy, but optimisation is for another time

-      my $x0 = 1e9;
-      my $y0 = 1e9;
+      my $x0 = +1e9;
+      my $y0 = +1e9;
       my $x1 = -1e9;
       my $y1 = -1e9;

@@ -327,14 +327,14 @@ image containing them all.
          $x += $w;
          $y += $h;

-         $x1 = $x if $x1 > $x;
-         $y1 = $y if $y1 > $y;
+         $x1 = $x if $x1 < $x;
+         $y1 = $y if $y1 < $y;
       }

-      my $base = $self->new_img ($x0, $y0, $x1 - $x0, $y1 - $y0);
+      my $base = $self->new_img (urxvt::PictStandardARGB32, $x0, $y0, $x1 - $x0, $y1 - $y0);
       $base->fill ([0, 0, 0, 0]);

-      $base->blend (1., $_)
+      $base->draw ($_)
          for @_;

       $base
diff --git a/src/rxvtimg.C b/src/rxvtimg.C
index d85953dd23124435197535c2a49fc8a377f1c6de..
index ..b14f4c0492e56675e4e0646db176fda66d4c027f 100644
--- a/src/rxvtimg.C
+++ b/src/rxvtimg.C
@@ -532,7 +532,7 @@ rxvt_img::draw (rxvt_img *img, int op, nv mask)
   XRenderFreePicture (dpy, src);
   XRenderFreePicture (dpy, dst);

-  if (mask)
+  if (mask_p)
     XRenderFreePicture (dpy, mask_p);
 }

@@ -565,10 +565,10 @@ rxvt_img::reify ()
     {
       XRenderColor rc = { 0, 0, 0, 0 };
       XRenderFillRectangle (dpy, PictOpSrc, dst, &rc, 0, 0, w, h);//TODO: split into four fillrectangles
-      XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, -x, -y, ref->w, ref->h);
+      XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, x, y, ref->w, ref->h);
     }
   else
-    XRenderComposite (dpy, PictOpSrc, src, None, dst, x, y, 0, 0, 0, 0, w, h);
+    XRenderComposite (dpy, PictOpSrc, src, None, dst, -x, -y, 0, 0, 0, 0, w, h);

   XRenderFreePicture (dpy, src);
   XRenderFreePicture (dpy, dst);
@@ -581,8 +581,8 @@ rxvt_img::sub_rect (int x, int y, int width, int height)
 {
   rxvt_img *img = clone ();

-  img->x += x;
-  img->y += y;
+  img->x -= x;
+  img->y -= y;

   if (w != width || h != height)
     {
@@ -632,8 +632,8 @@ rxvt_img *
 rxvt_img::transform (nv matrix[3][3])
 {
   // find new offset
-  int ox = mat_apply (matrix, 0, x, y);
-  int oy = mat_apply (matrix, 1, x, y);
+  int ox = mat_apply (matrix, 0, -x, -y);
+  int oy = mat_apply (matrix, 1, -x, -y);

   // calculate new pixel bounding box coordinates
   nv d [2], rmin[2], rmax[2];
diff --git a/src/rxvtimg.h b/src/rxvtimg.h
index 60dceb8091005bbc892a3267c18dd447f81b92c2..
index ..5546d161621ff8f773114ac7ac6e5d09a73b77bd 100644
--- a/src/rxvtimg.h
+++ b/src/rxvtimg.h
@@ -1,4 +1,4 @@
-#ifndef IMG_H
+#ifndef IMG_H),
 #define IMG_H

 #if HAVE_BG_PIXMAP
@@ -59,8 +59,8 @@ public:
   // inplace
   void move (int dx, int dy)
   {
-    x -= dx;
-    y -= dy;
+    x += dx;
+    y += dy;
   }

   void repeat_mode (int repeat)
@@ -93,7 +93,7 @@ public:
               float_to_component (a));
   }

-  void draw (rxvt_img *img, int op = PictOpSrc, nv mask = 1.);
+  void draw (rxvt_img *img, int op = PictOpOver, nv mask = 1.);

   // copy
   rxvt_img *reify (); // make x, y 0, make real width/height
diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs
index c86270e63fc3c95045f7ed292a835eba90b29355..
index ..47aeddffd8f9f73c6a7ed034714c5d84d7dbb7f6 100644
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -2157,7 +2157,7 @@ rxvt_term::background_geometry (bool border = false)
 #if HAVE_IMG

 rxvt_img *
-rxvt_term::new_img (SV *format, int x = 0, int y = 0, int width = 1, int height = 1)
+rxvt_term::new_img (SV *format = &PL_sv_undef, int x = 0, int y = 0, int width = 1, int height = 1)
 	CODE:
         XRenderPictFormat *f = SvOK (format)
                              ? XRenderFindStandardFormat (THIS->dpy, SvIV (format))
@@ -2348,6 +2348,9 @@ rxvt_img::brightness (rxvt_img::nv r, rxvt_img::nv g, rxvt_img::nv b, rxvt_img::
 void
 rxvt_img::contrast (rxvt_img::nv r, rxvt_img::nv g, rxvt_img::nv b, rxvt_img::nv a = 1.)

+void
+rxvt_img::draw (rxvt_img *img, int op = PictOpOver, rxvt_img::nv mask = 1.);
+
 rxvt_img *
 rxvt_img::clone ()

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