[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2732 - branches/pingus_sdl/src
From: |
jsalmon3 |
Subject: |
[Pingus-CVS] r2732 - branches/pingus_sdl/src |
Date: |
Sat, 14 Jul 2007 08:27:16 +0200 |
Author: jsalmon3
Date: 2007-07-14 08:27:13 +0200 (Sat, 14 Jul 2007)
New Revision: 2732
Modified:
branches/pingus_sdl/src/font.cpp
Log:
SDL_BlitSurface modifies dstrect if it gets clipped which causes the rest of
the letters to be drawn at the wrong location
Modified: branches/pingus_sdl/src/font.cpp
===================================================================
--- branches/pingus_sdl/src/font.cpp 2007-07-14 05:35:52 UTC (rev 2731)
+++ branches/pingus_sdl/src/font.cpp 2007-07-14 06:27:13 UTC (rev 2732)
@@ -129,29 +129,29 @@
{
Vector2i offset = calc_origin(origin, get_size(text));
- SDL_Rect dstrect;
- dstrect.x = x - offset.x;
- dstrect.y = y - offset.y;
+ int dstx = x - offset.x;
+ int dsty = y - offset.y;
for(std::string::size_type i = 0; i < text.size(); ++i)
{
if (text[i] == ' ')
{
- dstrect.x += space_length;
+ dstx += space_length;
}
else if (text[i] == '\n')
{
- dstrect.x = x;
- dstrect.y += surface->h;
+ dstx = x;
+ dsty += surface->h;
}
else
{
SDL_Rect& srcrect = chrs[static_cast<unsigned char>(text[i])];
if (srcrect.w != 0 && srcrect.h != 0)
{
+ SDL_Rect dstrect = { dstx, dsty, 0, 0 };
SDL_BlitSurface(surface, &srcrect, target, &dstrect);
- dstrect.x += srcrect.w+1;
+ dstx += srcrect.w+1;
}
else
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2732 - branches/pingus_sdl/src,
jsalmon3 <=