Qt: Fix centering of sprite preview

This commit is contained in:
Jeffrey Pfau 2016-10-21 02:15:12 -07:00
parent 35fcb725e4
commit 536dc8f7ab
2 changed files with 2 additions and 6 deletions

View File

@ -59,11 +59,12 @@ void ObjView::updateTilesGBA(bool force) {
unsigned width = GBAVideoObjSizes[shape * 4 + size][0];
unsigned height = GBAVideoObjSizes[shape * 4 + size][1];
m_ui.tiles->setTileCount(width * height / 64);
m_ui.tiles->resize(QSize(width, height) * m_ui.magnification->value());
m_ui.tiles->setMinimumSize(QSize(width, height) * m_ui.magnification->value());
unsigned palette = GBAObjAttributesCGetPalette(obj->c);
unsigned tile = GBAObjAttributesCGetTile(obj->c);
int i = 0;
// TODO: Tile stride
// TODO: Check to see if parameters are changed (so as to enable force if needed)
if (GBAObjAttributesAIs256Color(obj->a)) {
mTileCacheSetPalette(m_tileCache.get(), 1);
m_ui.tile->setPalette(0);

View File

@ -28,11 +28,6 @@ void TilePainter::paintEvent(QPaintEvent* event) {
void TilePainter::resizeEvent(QResizeEvent* event) {
int w = width() / m_size;
if (w < 1) {
// FIXME: Uhh...how did we get here?
// Resizing the window when magnification > 1 seems to trigger this
return;
}
int calculatedHeight = (m_tileCount + w - 1) * m_size / w;
calculatedHeight -= calculatedHeight % m_size;
if (width() / m_size != m_backing.width() / m_size || m_backing.height() != calculatedHeight) {