give core better padding
This commit is contained in:
parent
2a75cd1525
commit
f2b2f9b800
1 changed files with 21 additions and 3 deletions
|
@ -119,9 +119,27 @@ void core_widget::draw(int width, int height) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cpr = width / scale;
|
cpr = width / scale + 1;
|
||||||
xpad = (width % scale) / 2;
|
xpad = INT_MAX;
|
||||||
ypad = (height % scale) / 2;
|
ypad = 0;
|
||||||
|
|
||||||
|
while (cpr >= 1) {
|
||||||
|
--cpr;
|
||||||
|
|
||||||
|
int rows = (LIB94_CORE_SIZE - 1) / cpr + 1;
|
||||||
|
int new_xpad = (width - cpr * scale) / 2;
|
||||||
|
int new_ypad = (height - rows * scale) / 2;
|
||||||
|
|
||||||
|
if (abs(new_xpad - new_ypad) < abs(xpad - ypad)) {
|
||||||
|
xpad = new_xpad;
|
||||||
|
ypad = new_ypad;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
++cpr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *buffer = (uint8_t *)pixbuf->property_pixels().get_value();
|
uint8_t *buffer = (uint8_t *)pixbuf->property_pixels().get_value();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue