@@ -17,19 +17,17 @@ void CMinimapWindow::draw(Position /*parentOrigin*/)
1717 // Compute content area (inside the frames)
1818 const auto & b = getBorderSizes ();
1919 const Position contentPos = pos_ + Position (b.left , b.top );
20- const int cw = static_cast <int >(size_.x ) - b.left - b.right ;
21- const int ch = static_cast <int >(size_.y ) - b.top - b.bottom ;
22- if (cw <= 0 || ch <= 0 )
20+ const auto contentSize = getSize () - getBorderSize ();
21+ if (static_cast <int >(contentSize.x ) <= 0 || static_cast <int >(contentSize.y ) <= 0 )
2322 return ;
24- const Extent contentSize (cw, ch);
2523
2624 auto * map = global::s2->getMapObj ();
2725 if (!map)
2826 return ;
2927
3028 // Fill pixel buffer with minimap terrain
3129 int scale = 1 ;
32- map->drawMinimap (pixels_, cw, ch , scale);
30+ map->drawMinimap (pixels_, static_cast < int >(contentSize. x ), static_cast < int >(contentSize. y ) , scale);
3331
3432 // Upload to texture and draw
3533 if (!minimapTex_.isValid () || minimapTex_.getSize () != contentSize)
@@ -59,8 +57,10 @@ void CMinimapWindow::draw(Position /*parentOrigin*/)
5957 {
6058 const int arrowIdx = MAPPIC_ARROWCROSS_ORANGE ;
6159 const auto & dispRect = map->getDisplayRect ();
62- const Position arrowCenter = dispRect.getOrigin () + Position (dispRect.getSize ().x / 2 , dispRect.getSize ().y / 2 );
63- const Position arrowPos = contentPos + arrowCenter / Position (triangleWidth, triangleHeight) / scale
60+ const Position arrowCenter =
61+ dispRect.getOrigin () + Position (dispRect.getSize ().x / 2 , dispRect.getSize ().y / 2 );
62+ const Position arrowPos =
63+ contentPos + arrowCenter / Position (triangleWidth, triangleHeight) / scale
6464 - Position (static_cast <int >(global::bmpArray[arrowIdx].nx ), static_cast <int >(global::bmpArray[arrowIdx].ny ));
6565 getBmpTexture (arrowIdx).draw (arrowPos);
6666 }
0 commit comments