Static analysis fix: more cleanups of unused variables, etc, in blitters.

This commit is contained in:
Ryan C. Gordon 2014-03-21 10:40:15 -04:00
parent 7bf36abfc0
commit cc52939853
2 changed files with 157 additions and 397 deletions

File diff suppressed because it is too large Load diff

View file

@ -214,7 +214,6 @@ sub output_copycore
my $blend = shift; my $blend = shift;
my $s = ""; my $s = "";
my $d = ""; my $d = "";
my $ignore_dst_alpha = 0;
# Nice and easy... # Nice and easy...
if ( $src eq $dst && !$modulate && !$blend ) { if ( $src eq $dst && !$modulate && !$blend ) {
@ -224,13 +223,12 @@ __EOF__
return; return;
} }
if (not $dst =~ /A/) { my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0;
$ignore_dst_alpha = !$blend; my $ignore_dst_alpha = !$dst_has_alpha && !$blend;
}
if ( $blend ) { if ( $blend ) {
get_rgba("src", $src, $ignore_dst_alpha); get_rgba("src", $src, $ignore_dst_alpha);
get_rgba("dst", $dst, $ignore_dst_alpha); get_rgba("dst", $dst, !$dst_has_alpha);
$s = "src"; $s = "src";
$d = "dst"; $d = "dst";
} else { } else {
@ -270,7 +268,7 @@ __EOF__
${d}B = ${s}B + ((255 - ${s}A) * ${d}B) / 255; ${d}B = ${s}B + ((255 - ${s}A) * ${d}B) / 255;
__EOF__ __EOF__
if ( $dst =~ /A/ ) { if ( $dst_has_alpha ) {
print FILE <<__EOF__; print FILE <<__EOF__;
${d}A = ${s}A + ((255 - ${s}A) * ${d}A) / 255; ${d}A = ${s}A + ((255 - ${s}A) * ${d}A) / 255;
__EOF__ __EOF__
@ -306,6 +304,9 @@ sub output_copyfunc
my $blend = shift; my $blend = shift;
my $scale = shift; my $scale = shift;
my $dst_has_alpha = ($dst =~ /A/) ? 1 : 0;
my $ignore_dst_alpha = !$dst_has_alpha && !$blend;
output_copyfuncname("static void", $src, $dst, $modulate, $blend, $scale, 1, "\n"); output_copyfuncname("static void", $src, $dst, $modulate, $blend, $scale, 1, "\n");
print FILE <<__EOF__; print FILE <<__EOF__;
{ {
@ -320,21 +321,41 @@ __EOF__
const Uint32 modulateR = info->r; const Uint32 modulateR = info->r;
const Uint32 modulateG = info->g; const Uint32 modulateG = info->g;
const Uint32 modulateB = info->b; const Uint32 modulateB = info->b;
__EOF__
if (!$ignore_dst_alpha) {
print FILE <<__EOF__;
const Uint32 modulateA = info->a; const Uint32 modulateA = info->a;
__EOF__ __EOF__
}
} }
if ( $blend ) { if ( $blend ) {
print FILE <<__EOF__; print FILE <<__EOF__;
Uint32 srcpixel; Uint32 srcpixel;
Uint32 srcR, srcG, srcB, srcA; Uint32 srcR, srcG, srcB, srcA;
Uint32 dstpixel; Uint32 dstpixel;
__EOF__
if ($dst_has_alpha) {
print FILE <<__EOF__;
Uint32 dstR, dstG, dstB, dstA; Uint32 dstR, dstG, dstB, dstA;
__EOF__ __EOF__
} else {
print FILE <<__EOF__;
Uint32 dstR, dstG, dstB;
__EOF__
}
} elsif ( $modulate || $src ne $dst ) { } elsif ( $modulate || $src ne $dst ) {
print FILE <<__EOF__; print FILE <<__EOF__;
Uint32 pixel; Uint32 pixel;
__EOF__
if (!$ignore_dst_alpha) {
print FILE <<__EOF__;
Uint32 R, G, B, A; Uint32 R, G, B, A;
__EOF__ __EOF__
} else {
print FILE <<__EOF__;
Uint32 R, G, B;
__EOF__
}
} }
if ( $scale ) { if ( $scale ) {
print FILE <<__EOF__; print FILE <<__EOF__;
@ -343,27 +364,6 @@ __EOF__
int incy, incx; int incy, incx;
__EOF__ __EOF__
# !!! FIXME: the script should just exclude in these cases.
if ( (!$blend) && ($modulate || $src ne $dst) ) {
print FILE <<__EOF__;
(void) A; /* not all formats use alpha. */
__EOF__
}
# !!! FIXME: the script should just exclude in these cases.
if ( $modulate ) {
print FILE <<__EOF__;
(void) modulateA; /* not all formats use alpha. */
__EOF__
}
# !!! FIXME: the script should just exclude in these cases.
if ( $blend ) {
print FILE <<__EOF__;
(void) dstA; /* not all formats use alpha. */
__EOF__
}
print FILE <<__EOF__; print FILE <<__EOF__;
srcy = 0; srcy = 0;
@ -402,27 +402,6 @@ __EOF__
} }
__EOF__ __EOF__
} else { } else {
# !!! FIXME: the script should just exclude in these cases.
if ( (!$blend) && ($modulate || $src ne $dst) ) {
print FILE <<__EOF__;
(void) A; /* not all formats use alpha. */
__EOF__
}
# !!! FIXME: the script should just exclude in these cases.
if ( $modulate ) {
print FILE <<__EOF__;
(void) modulateA; /* not all formats use alpha. */
__EOF__
}
# !!! FIXME: the script should just exclude in these cases.
if ( $blend ) {
print FILE <<__EOF__;
(void) dstA; /* not all formats use alpha. */
__EOF__
}
print FILE <<__EOF__; print FILE <<__EOF__;
while (info->dst_h--) { while (info->dst_h--) {