Add borders in padding printing.
This commit is contained in:
parent
57c5052908
commit
7f1bd27ac0
18
rotation.cpp
18
rotation.cpp
|
@ -233,6 +233,7 @@ uint16_t* generate_padding_table(Image const& src,
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_padding_table(uint16_t const* padding_table,
|
void print_padding_table(uint16_t const* padding_table,
|
||||||
|
uint16_t const* border_table,
|
||||||
unsigned int size)
|
unsigned int size)
|
||||||
{
|
{
|
||||||
cout << "Padding table:" << endl;
|
cout << "Padding table:" << endl;
|
||||||
|
@ -240,23 +241,32 @@ void print_padding_table(uint16_t const* padding_table,
|
||||||
for (unsigned int i = 0; i < size; ++i)
|
for (unsigned int i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
int left_padding = padding_table[i];
|
int left_padding = padding_table[i];
|
||||||
|
int left_border = border_table[i];
|
||||||
int right_padding = padding_table[size - 1 - i];
|
int right_padding = padding_table[size - 1 - i];
|
||||||
int core_pixels = size - left_padding - right_padding;
|
int right_border = border_table[size - 1 - i];
|
||||||
|
int core_pixels = size - left_padding - right_padding - left_border - right_border;
|
||||||
|
|
||||||
if (core_pixels < 0)
|
if (core_pixels < 0)
|
||||||
{
|
{
|
||||||
cout << "Too much padding at line " << i << endl;
|
cout << "Too much padding + border at line " << i << endl;
|
||||||
cout << " left padding = " << left_padding << endl;
|
cout << " left padding = " << left_padding << endl;
|
||||||
|
cout << " left border = " << left_border << endl;
|
||||||
cout << " right padding = " << right_padding << endl;
|
cout << " right padding = " << right_padding << endl;
|
||||||
cout << " max size = " << size << endl;
|
cout << " right border = " << right_border << endl;
|
||||||
|
cout << " total = " << left_padding + left_border + right_border + right_padding << endl;
|
||||||
|
cout << " max size = " << size << endl;
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << " [";
|
cout << " [";
|
||||||
for (int j = 0; j < left_padding; ++j)
|
for (int j = 0; j < left_padding; ++j)
|
||||||
cout << " ";
|
cout << " ";
|
||||||
|
for (int j = 0; j < left_border; ++j)
|
||||||
|
cout << ".";
|
||||||
for (int j = 0; j < core_pixels; ++j)
|
for (int j = 0; j < core_pixels; ++j)
|
||||||
cout << "x";
|
cout << "x";
|
||||||
|
for (int j = 0; j < right_border; ++j)
|
||||||
|
cout << ".";
|
||||||
for (int j = 0; j < right_padding; ++j)
|
for (int j = 0; j < right_padding; ++j)
|
||||||
cout << " ";
|
cout << " ";
|
||||||
cout << "]" << endl;
|
cout << "]" << endl;
|
||||||
|
|
Loading…
Reference in a new issue