From ffcb65f3653f65a86187692a198841565eec9157 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Wed, 13 Feb 2013 18:40:15 -0200 Subject: [PATCH] Draw minimap background without map --- src/client/minimap.cpp | 9 +++++++-- src/framework/ui/uiwidgetimage.cpp | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index 426022f2..14d26417 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -95,8 +95,8 @@ void Minimap::clean() void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scale) { - if(screenRect.isEmpty() || MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition()) - return ; + if(screenRect.isEmpty()) + return; Rect mapRect = calcMapRect(screenRect, mapCenter, scale); g_painter->saveState(); @@ -105,6 +105,11 @@ void Minimap::draw(const Rect& screenRect, const Position& mapCenter, float scal g_painter->resetColor(); g_painter->setClipRect(screenRect); + if(MMBLOCK_SIZE*scale <= 1 || !mapCenter.isMapPosition()) { + g_painter->restoreSavedState(); + return; + } + Point blockOff = getBlockOffset(mapRect.topLeft()); Point off = Point((mapRect.size() * scale).toPoint() - screenRect.size().toPoint())/2; Point start = screenRect.topLeft() -(mapRect.topLeft() - blockOff)*scale - off; diff --git a/src/framework/ui/uiwidgetimage.cpp b/src/framework/ui/uiwidgetimage.cpp index f4ff8ce2..e96b613e 100644 --- a/src/framework/ui/uiwidgetimage.cpp +++ b/src/framework/ui/uiwidgetimage.cpp @@ -182,4 +182,3 @@ void UIWidget::setImageSource(const std::string& source) m_imageTexture = g_textures.getTexture(source); m_imageMustRecache = true; } -