Skip to content

Commit 345d930

Browse files
committed
Make sure text quad is big enough for floating point offsets
1 parent 285ab53 commit 345d930

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

visage_graphics/shape_batcher.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ namespace visage {
242242
if (length == 0)
243243
continue;
244244

245-
int x = text_block.x + batch.x;
246-
int y = text_block.y + batch.y;
245+
float x = text_block.x + batch.x;
246+
float y = text_block.y + batch.y;
247247
for (const IBounds& invalid_rect : *batch.invalid_rects) {
248248
ClampBounds clamp = text_block.clamp.clamp(invalid_rect.x() - batch.x,
249249
invalid_rect.y() - batch.y,
@@ -299,14 +299,14 @@ namespace visage {
299299
if (!overlaps(text_block.quads[i]))
300300
continue;
301301

302-
float left = x + text_block.quads[i].x;
303-
float right = left + text_block.quads[i].width;
302+
float left = x + text_block.quads[i].x - 0.5f;
303+
float right = left + text_block.quads[i].width + 1.0f;
304304
float top = y + text_block.quads[i].y;
305305
float bottom = top + text_block.quads[i].height;
306306

307-
float texture_x = text_block.quads[i].packed_glyph->atlas_left;
307+
float texture_x = text_block.quads[i].packed_glyph->atlas_left - 0.5f;
308308
float texture_y = text_block.quads[i].packed_glyph->atlas_top;
309-
float texture_width = text_block.quads[i].packed_glyph->width;
309+
float texture_width = text_block.quads[i].packed_glyph->width + 1.0f;
310310
float texture_height = text_block.quads[i].packed_glyph->height;
311311

312312
vertices[vertex_index].x = left;

0 commit comments

Comments
 (0)