Browse Source

fix overflow bug in DynamicTextGlyph::erase()

David Rose 16 years ago
parent
commit
f98bb64996
1 changed files with 7 additions and 2 deletions
  1. 7 2
      panda/src/text/dynamicTextGlyph.cxx

+ 7 - 2
panda/src/text/dynamicTextGlyph.cxx

@@ -74,9 +74,14 @@ erase(DynamicTextFont *font) {
   nassertv(_page != (DynamicTextPage *)NULL);
   nassertv(_page->has_ram_image());
 
+  // The glyph covers the pixels from (_x, _y) over the rectangle
+  // (_x_size, _y_size), but it doesn't include _margin pixels around
+  // the interior of the rectangle.  Erase all the pixels that the
+  // glyph covers.
   _page->fill_region(_x + _margin, 
-                     _page->get_y_size() - (_y + _y_size + _margin),
-                     _x_size, _y_size, font->get_bg());
+                     _page->get_y_size() - (_y + _y_size - _margin),
+                     _x_size - _margin * 2, _y_size - _margin * 2,
+                     font->get_bg());
 }
 
 ////////////////////////////////////////////////////////////////////