]> git.localhorst.tv Git - l2e.git/commitdiff
fixed sdl::OutlineRect for rects with x or y < 0
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 25 Mar 2013 07:09:19 +0000 (08:09 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 25 Mar 2013 07:10:49 +0000 (08:10 +0100)
src/sdl/utility.cpp

index 1dbf502cd953ed1698ac738ebfb3ca616e2ff9c3..061d64c048a0c591eb1f6f3614d86dd2169519cd 100644 (file)
@@ -41,13 +41,20 @@ void OutlineRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) {
        destRect.w = dstrect->w;
        destRect.h = 1;
        SDL_FillRect(dst, &destRect, color);
-       destRect.y += dstrect->h - 1;
+       destRect.x = dstrect->x;
+       destRect.y = dstrect->y + dstrect->h - 1;
+       destRect.w = dstrect->w;
+       destRect.h = 1;
        SDL_FillRect(dst, &destRect, color);
+       destRect.x = dstrect->x;
        destRect.y = dstrect->y;
        destRect.w = 1;
        destRect.h = dstrect->h;
        SDL_FillRect(dst, &destRect, color);
-       destRect.x += dstrect->w - 1;
+       destRect.x = dstrect->x + dstrect->w - 1;
+       destRect.y = dstrect->y;
+       destRect.w = 1;
+       destRect.h = dstrect->h;
        SDL_FillRect(dst, &destRect, color);
 }