Minor
This commit is contained in:
parent
617f4ac46f
commit
8caf5dcd66
|
@ -251,8 +251,6 @@ block_best (const biimage_t &bi, unsigned int *score, bool *inverse)
|
||||||
col_sum_i[i] += col_sum_i[i - 1];
|
col_sum_i[i] += col_sum_i[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
*score = (unsigned int) -1;
|
|
||||||
*inverse = false;
|
|
||||||
const char *best_c = " ";
|
const char *best_c = " ";
|
||||||
|
|
||||||
/* Maybe empty is better! */
|
/* Maybe empty is better! */
|
||||||
|
@ -301,7 +299,6 @@ block_best (const biimage_t &bi, unsigned int *score, bool *inverse)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find best left line */
|
/* Find best left line */
|
||||||
/* Disable this as it looks ugly because of line height issues. */
|
|
||||||
if (1) {
|
if (1) {
|
||||||
unsigned int best_s = (unsigned int) -1;
|
unsigned int best_s = (unsigned int) -1;
|
||||||
bool best_inv = false;
|
bool best_inv = false;
|
||||||
|
@ -333,35 +330,37 @@ block_best (const biimage_t &bi, unsigned int *score, bool *inverse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Quadrant? */
|
/* Find best quadrant */
|
||||||
unsigned int q = 0;
|
if (1) {
|
||||||
unsigned int qs = 0;
|
unsigned int q = 0;
|
||||||
for (unsigned int i = 0; i < 2; i++)
|
unsigned int qs = 0;
|
||||||
for (unsigned int j = 0; j < 2; j++)
|
for (unsigned int i = 0; i < 2; i++)
|
||||||
if (quad[i][j] > quad_i[i][j]) {
|
for (unsigned int j = 0; j < 2; j++)
|
||||||
q += 1 << (2 * i + j);
|
if (quad[i][j] > quad_i[i][j]) {
|
||||||
qs += quad_i[i][j];
|
q += 1 << (2 * i + j);
|
||||||
} else
|
qs += quad_i[i][j];
|
||||||
qs += quad[i][j];
|
} else
|
||||||
if (qs < *score) {
|
qs += quad[i][j];
|
||||||
const char *c = NULL;
|
if (qs < *score) {
|
||||||
bool inv = false;
|
const char *c = NULL;
|
||||||
switch (q) {
|
bool inv = false;
|
||||||
case 1: c = "▟"; inv = true; break;
|
switch (q) {
|
||||||
case 2: c = "▙"; inv = true; break;
|
case 1: c = "▟"; inv = true; break;
|
||||||
case 4: c = "▖"; inv = false; break;
|
case 2: c = "▙"; inv = true; break;
|
||||||
case 8: c = "▗"; inv = false; break;
|
case 4: c = "▖"; inv = false; break;
|
||||||
case 9: c = "▚"; inv = false; break;
|
case 8: c = "▗"; inv = false; break;
|
||||||
case 6: c = "▞"; inv = false; break;
|
case 9: c = "▚"; inv = false; break;
|
||||||
case 7: c = "▜"; inv = true; break;
|
case 6: c = "▞"; inv = false; break;
|
||||||
case 11: c = "▜"; inv = true; break;
|
case 7: c = "▜"; inv = true; break;
|
||||||
case 13: c = "▙"; inv = true; break;
|
case 11: c = "▜"; inv = true; break;
|
||||||
case 14: c = "▟"; inv = true; break;
|
case 13: c = "▙"; inv = true; break;
|
||||||
}
|
case 14: c = "▟"; inv = true; break;
|
||||||
if (c) {
|
}
|
||||||
*score = qs;
|
if (c) {
|
||||||
*inverse = inv;
|
*score = qs;
|
||||||
best_c = c;
|
*inverse = inv;
|
||||||
|
best_c = c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +376,7 @@ ansi_print_image_rgb24 (const uint32_t *data,
|
||||||
image_t image (width, height, data, stride);
|
image_t image (width, height, data, stride);
|
||||||
|
|
||||||
unsigned int rows = (height + CELL_H - 1) / CELL_H;
|
unsigned int rows = (height + CELL_H - 1) / CELL_H;
|
||||||
unsigned int cols = (width + CELL_W - 1) / CELL_W;
|
unsigned int cols = (width + CELL_W - 1) / CELL_W;
|
||||||
image_t cell (CELL_W, CELL_H);
|
image_t cell (CELL_W, CELL_H);
|
||||||
biimage_t bi (CELL_W, CELL_H);
|
biimage_t bi (CELL_W, CELL_H);
|
||||||
unsigned int last_bg = -1, last_fg = -1;
|
unsigned int last_bg = -1, last_fg = -1;
|
||||||
|
@ -394,7 +393,7 @@ ansi_print_image_rgb24 (const uint32_t *data,
|
||||||
} else {
|
} else {
|
||||||
/* Figure out the closest character to the biimage */
|
/* Figure out the closest character to the biimage */
|
||||||
unsigned int score = (unsigned int) -1;
|
unsigned int score = (unsigned int) -1;
|
||||||
bool inverse;
|
bool inverse = false;
|
||||||
const char *c = block_best (bi, &score, &inverse);
|
const char *c = block_best (bi, &score, &inverse);
|
||||||
if (inverse) {
|
if (inverse) {
|
||||||
if (last_bg != bi.fg || last_fg != bi.bg) {
|
if (last_bg != bi.fg || last_fg != bi.bg) {
|
||||||
|
|
Loading…
Reference in New Issue