Permalink
Browse files

force Align to align to integer coordinates

this works around a text rendering bug in the main menu on nvidia where the
next glyph can bleed onto the end of the current one by some fractional pixel
amount. I don't know if its a GL quirk, a missing default, a text renderer bug
or a UI bug, but this will have to do for now.
  • Loading branch information...
1 parent d937d4a commit f2f46373aad2cf0a12fd9e90667b8bfb1b592558 @robn robn committed Sep 21, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/ui/Align.cpp
View
@@ -27,13 +27,13 @@ void Align::Layout()
case TOP:
case MIDDLE:
case BOTTOM:
- pos.x = std::max(0.0f, (size.x-preferred.x)/2);
+ pos.x = std::max(0.0f, floorf((size.x-preferred.x)/2));
break;
case TOP_RIGHT:
case RIGHT:
case BOTTOM_RIGHT:
- pos.x = std::max(0.0f, size.x-preferred.x);
+ pos.x = std::max(0.0f, floorf(size.x-preferred.x));
break;
}
@@ -47,13 +47,13 @@ void Align::Layout()
case LEFT:
case MIDDLE:
case RIGHT:
- pos.y = std::max(0.0f, (size.y-preferred.y)/2);
+ pos.y = std::max(0.0f, floorf((size.y-preferred.y)/2));
break;
case BOTTOM_LEFT:
case BOTTOM:
case BOTTOM_RIGHT:
- pos.y = std::max(0.0f, size.y-preferred.y);
+ pos.y = std::max(0.0f, floorf(size.y-preferred.y));
break;
}

0 comments on commit f2f4637

Please sign in to comment.