|
@@ -799,21 +799,23 @@ void CSDL_Ext::fillSurface( SDL_Surface *dst, const SDL_Color & color )
|
|
|
fillRect(dst, allSurface, color);
|
|
|
}
|
|
|
|
|
|
-void CSDL_Ext::fillRect( SDL_Surface *dst, const Rect & dstrect, const SDL_Color & color, const bool replace)
|
|
|
+void CSDL_Ext::fillRect( SDL_Surface *dst, const Rect & dstrect, const SDL_Color & color)
|
|
|
{
|
|
|
SDL_Rect newRect = CSDL_Ext::toSDL(dstrect);
|
|
|
+
|
|
|
uint32_t sdlColor = SDL_MapRGBA(dst->format, color.r, color.g, color.b, color.a);
|
|
|
+ SDL_FillRect(dst, &newRect, sdlColor);
|
|
|
+}
|
|
|
|
|
|
- // replacing or overdrawing (relevant for transparency)
|
|
|
- if(replace)
|
|
|
- SDL_FillRect(dst, &newRect, sdlColor);
|
|
|
- else
|
|
|
- {
|
|
|
- SDL_Surface * tmp = SDL_CreateRGBSurface(0, newRect.w, newRect.h, dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
|
|
|
- SDL_FillRect(tmp, NULL, sdlColor);
|
|
|
- SDL_BlitSurface(tmp, NULL, dst, &newRect);
|
|
|
- SDL_FreeSurface(tmp);
|
|
|
- }
|
|
|
+void CSDL_Ext::fillRectBlended( SDL_Surface *dst, const Rect & dstrect, const SDL_Color & color)
|
|
|
+{
|
|
|
+ SDL_Rect newRect = CSDL_Ext::toSDL(dstrect);
|
|
|
+ uint32_t sdlColor = SDL_MapRGBA(dst->format, color.r, color.g, color.b, color.a);
|
|
|
+
|
|
|
+ SDL_Surface * tmp = SDL_CreateRGBSurface(0, newRect.w, newRect.h, dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
|
|
|
+ SDL_FillRect(tmp, NULL, sdlColor);
|
|
|
+ SDL_BlitSurface(tmp, NULL, dst, &newRect);
|
|
|
+ SDL_FreeSurface(tmp);
|
|
|
}
|
|
|
|
|
|
STRONG_INLINE static uint32_t mapColor(SDL_Surface * surface, SDL_Color color)
|