[SCM] SDL (Simple DirectMedia Layer) bindings for Perl branch, master, updated. debian/2.537_02-2-9-gf9918d8

Dominique Dumont dod at debian.org
Mon May 28 12:23:46 UTC 2012


The following commit has been merged in the master branch:
commit 7b2f8621b28c926d752af82acb926d7b0512ee47
Author: Dominique Dumont <dod at debian.org>
Date:   Mon May 28 10:49:01 2012 +0200

    + patch to fix centered text in SDLx::Text

diff --git a/debian/patches/fix-centered-text b/debian/patches/fix-centered-text
new file mode 100644
index 0000000..4d412f3
--- /dev/null
+++ b/debian/patches/fix-centered-text
@@ -0,0 +1,46 @@
+Description: Fix centered text
+ Centered text was off-center
+Forwarded: yes, done
+Author: dod
+--- a/lib/SDLx/Text.pm
++++ b/lib/SDLx/Text.pm
+@@ -342,16 +342,20 @@
+ 
+         foreach my $i ( 0 .. $#{$surfaces}) {
+             if (my $surface = $surfaces->[$i]) {
++                my $tx ;
+                 $y += ($linebreaks * $surface->h);
+                 $linebreaks = 0;
+ 
+                 if ($self->{h_align} eq 'center' ) {
+                     # $x = ($target->w / 2) - ($surface->w / 2);
+-                    $x -= $surface->w / 2;
++                    $tx = $x + ($self->w -$surface->w) / 2;
+                 }
+                 elsif ($self->{h_align} eq 'right' ) {
+                     # $x = $target->w - $surface->w;
+-                    $x -= $surface->w;
++                    $tx = $x + $self->w - $surface->w;
++                }
++                else {
++                    $tx = $x ;
+                 }
+ 
+                 # blit the shadow
+@@ -361,14 +365,14 @@
+ 
+                     SDL::Video::blit_surface(
+                        $shadow, SDL::Rect->new(0,0,$shadow->w, $shadow->h),
+-                       $target, SDL::Rect->new($x + $offset, $y + $offset, 0, 0)
++                       $target, SDL::Rect->new($tx + $offset, $y + $offset, 0, 0)
+                     );
+                 }
+ 
+                 # blit the text
+                 SDL::Video::blit_surface(
+                     $surface, SDL::Rect->new(0,0,$surface->w, $surface->h),
+-                    $target, SDL::Rect->new($x, $y, 0, 0)
++                    $target, SDL::Rect->new($tx, $y, 0, 0)
+                 );
+             }
+             $linebreaks++;
diff --git a/debian/patches/series b/debian/patches/series
index fda96fd..01c1298 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+fix-centered-text
 relax-module-build
 do_not_ship_ttf_font
 install_man_pages_correctly

-- 
SDL (Simple DirectMedia Layer) bindings for Perl



More information about the Pkg-perl-cvs-commits mailing list