Fixed radius calculation for rounded rectangles
authorIngo Ruhnke <grumbel@gmail.com>
Wed, 30 Jul 2014 16:58:52 +0000 (18:58 +0200)
committerIngo Ruhnke <grumbel@gmail.com>
Wed, 30 Jul 2014 16:58:52 +0000 (18:58 +0200)
src/video/sdl/sdl_renderer.cpp

index 38cd046..21951d6 100644 (file)
@@ -503,7 +503,8 @@ SDLRenderer::draw_filled_rect(const DrawingRequest& request)
   Uint8 b = static_cast<Uint8>(fillrectrequest->color.blue * 255);
   Uint8 a = static_cast<Uint8>(fillrectrequest->color.alpha * 255);
 
-  int radius = std::min(rect.h / 2, static_cast<int>(fillrectrequest->radius));
+  int radius = std::min(std::min(rect.h / 2, rect.w / 2),
+                        static_cast<int>(fillrectrequest->radius));
 
   if (radius)
   {