From bba7e212d172e1c0b290eeaea323a7ac3e91b17c Mon Sep 17 00:00:00 2001 From: Martijn Versteegh Date: Fri, 12 Oct 2018 20:49:54 +0200 Subject: [PATCH] Somewhat hacky method to make images exactly the size specified in geometry (as long as the geometry is a multiple of 16) --- TileGenerator.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index a082e1d..4e22d0b 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -348,8 +348,19 @@ void TileGenerator::createImage() if(!m_drawScale) m_scales = 0; + int gw = (m_geomX2 - m_geomX) * 16; + int gh = (m_geomY2 - m_geomY) * 16; + + m_mapWidth = (m_xMax - m_xMin + 1) * 16; m_mapHeight = (m_zMax - m_zMin + 1) * 16; + + if (m_geomX > -2048 && m_geomX2 < 2048) + m_mapWidth = m_mapWidth > gw ? m_mapWidth : gw; + + if (m_geomY > -2048 && m_geomY2 < 2048) + m_mapHeight = m_mapHeight > gh ? m_mapWidth : gh; + m_xBorder = (m_scales & SCALE_LEFT) ? scale_d : 0; m_yBorder = (m_scales & SCALE_TOP) ? scale_d : 0; m_blockPixelAttributes.setWidth(m_mapWidth);