hedgewars/uChat.pas
changeset 12107 51596d30a724
parent 11840 8f7e28428f3e
child 12415 8b971d8944d6
--- a/hedgewars/uChat.pas	Sun Dec 04 01:07:36 2016 +0100
+++ b/hedgewars/uChat.pas	Sun Dec 04 02:02:18 2016 +0100
@@ -161,7 +161,7 @@
  * It will use the color stored in cl and update width
  *)
 procedure RenderChatLineTex(var cl: TChatLine; var str: shortstring);
-var strSurface,
+var strSurface, tmpSurface,
     resSurface: PSDL_Surface;
     dstrect   : TSDL_Rect; // destination rectangle for blitting
     font      : THWFont;
@@ -194,10 +194,14 @@
 SDL_FillRect(resSurface, @dstrect, shadowint);
 
 // create and blit text
+tmpSurface:= nil;
 strSurface:= TTF_RenderUTF8_Blended(Fontz[font].Handle, Str2PChar(str), cl.color);
+// fix format
+if strSurface <> nil then tmpSurface:= SDL_ConvertSurface(strSurface, resSurface^.format, 0);
+SDL_FreeSurface(strSurface);
 //SDL_UpperBlit(strSurface, nil, resSurface, @dstrect);
-if strSurface <> nil then copyToXY(strSurface, resSurface, Padding, Padding);
-SDL_FreeSurface(strSurface);
+if tmpSurface <> nil then copyToXY(tmpSurface, resSurface, Padding, Padding);
+SDL_FreeSurface(tmpSurface);
 
 cl.Tex:= Surface2Tex(resSurface, false);