all repos — mgba @ 536dc8f7ab9ec2512b90505a30eb14a4c0a6b4f6

mGBA Game Boy Advance Emulator

Qt: Fix centering of sprite preview
Jeffrey Pfau jeffrey@endrift.com
Fri, 21 Oct 2016 02:15:12 -0700
commit

536dc8f7ab9ec2512b90505a30eb14a4c0a6b4f6

parent

35fcb725e42bfe55245cf2fafc552ad7e06784b3

2 files changed, 2 insertions(+), 6 deletions(-)

jump to
M src/platform/qt/ObjView.cppsrc/platform/qt/ObjView.cpp

@@ -59,11 +59,12 @@ unsigned size = GBAObjAttributesBGetSize(obj->b);

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);
M src/platform/qt/TilePainter.cppsrc/platform/qt/TilePainter.cpp

@@ -28,11 +28,6 @@ }

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) {