tidy
This commit is contained in:
@@ -5,47 +5,47 @@ namespace Gma.QrCodeNet.Encoding.Masking.Scoring;
|
||||
/// </summary>
|
||||
internal class Penalty2 : Penalty
|
||||
{
|
||||
internal override int PenaltyCalculate(BitMatrix matrix)
|
||||
{
|
||||
int width = matrix.Width;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int penalty = 0;
|
||||
internal override int PenaltyCalculate(BitMatrix matrix)
|
||||
{
|
||||
int width = matrix.Width;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int penalty = 0;
|
||||
|
||||
while (y < (width - 1))
|
||||
{
|
||||
while (x < (width - 1))
|
||||
{
|
||||
bool topR = matrix[x + 1, y];
|
||||
while (y < (width - 1))
|
||||
{
|
||||
while (x < (width - 1))
|
||||
{
|
||||
bool topR = matrix[x + 1, y];
|
||||
|
||||
if (topR == matrix[x + 1, y + 1]) // Bottom Right
|
||||
{
|
||||
if (topR == matrix[x, y + 1]) // Bottom Left
|
||||
{
|
||||
if (topR == matrix[x, y]) // Top Left
|
||||
{
|
||||
penalty += 3;
|
||||
x += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 2;
|
||||
}
|
||||
}
|
||||
if (topR == matrix[x + 1, y + 1]) // Bottom Right
|
||||
{
|
||||
if (topR == matrix[x, y + 1]) // Bottom Left
|
||||
{
|
||||
if (topR == matrix[x, y]) // Top Left
|
||||
{
|
||||
penalty += 3;
|
||||
x += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 2;
|
||||
}
|
||||
}
|
||||
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
return penalty;
|
||||
}
|
||||
}
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
return penalty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user