From 13e8c0aed401865232a04835a4c50a12529c54b2 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sun, 6 Oct 2019 01:01:52 -0700 Subject: [PATCH] Rendering alignment bug fixed (this shit needs a deep cleaning!) --- 4ed_api_implementation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 814f1327..d7251ca0 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2855,6 +2855,9 @@ text_layout_region(Application_Links *app, Text_Layout_ID text_layout_id){ Text_Layout *layout = text_layout_get(&models->text_layouts, text_layout_id); if (layout != 0){ result = layout->rect; + Vec2_f32 coordinate_center = models_get_coordinate_center(models); + result.p0 -= coordinate_center; + result.p1 -= coordinate_center; } return(result); } @@ -2906,7 +2909,7 @@ text_layout_line_on_screen(Application_Links *app, Text_Layout_ID layout_id, i64 result.min = result.max; } - result -= layout->point.pixel_shift.y; + result += rect.y0 - layout->point.pixel_shift.y; result = range_intersect(result, rect_range_y(rect)); Vec2_f32 coordinate_center = models_get_coordinate_center(models); result -= coordinate_center.y;