Fixed bitmap reading (Y offset corruption + total lines were interpreted +1)
authorshort <>
Mon, 7 Jan 2002 12:06:40 +0000 (12:06 +0000)
committershort <>
Mon, 7 Jan 2002 12:06:40 +0000 (12:06 +0000)
GSM/SMS/Bitmap.pm

index a6e5a66..e74d490 100644 (file)
@@ -58,7 +58,7 @@ sub pixref {
                        || $x<0 || $x>=$self->{"width" }
                        || $y<0 || $y>=$self->{"height"}
                        ;
-       return \vec($self->{"blob"},int(($self->{"width"}+7)/8)*$y + $x,1);
+       return \vec($self->{"blob"},int(($self->{"width"}+7)/8)*8*$y + $x,1);
 }
 
 sub pixget {
@@ -75,7 +75,7 @@ sub pixlist_horiz {
        my ($self) = @_;
 
        my $bits="";
-       for my $y (0..$self->{"height"}) {
+       for my $y (0..$self->{"height"}-1) {
                for my $x (0..int(($self->{"width"}+7)&~0x7)-1) {
                        $bits.=$self->pixget($x,$y);
                }