@@ -108,7 +108,7 @@ void engine_draw_blit(texture_resource_class_obj_t *texture, uint32_t offset, fl
108108 // ENGINE_PERFORMANCE_CYCLES_START();
109109 float inverse_x_scale = 1.0f / x_scale ;
110110 float inverse_y_scale = 1.0f / y_scale ;
111-
111+
112112 // https://codereview.stackexchange.com/a/86546
113113 float sin_angle = sinf (rotation_radians );
114114 float cos_angle = cosf (rotation_radians );
@@ -131,8 +131,8 @@ void engine_draw_blit(texture_resource_class_obj_t *texture, uint32_t offset, fl
131131 float dim_half = (dim / 2.0f );
132132
133133 // The top-left of the bitmap destination
134- int32_t top_left_x = (int32_t )roundf (center_x - dim_half );
135- int32_t top_left_y = (int32_t )roundf (center_y - dim_half );
134+ int32_t top_left_x = (int32_t )floorf (center_x - dim_half );
135+ int32_t top_left_y = (int32_t )floorf (center_y - dim_half );
136136
137137 // If the top-left is above the viewport but
138138 // the bitmap may eventually showup, clip the
@@ -157,7 +157,7 @@ void engine_draw_blit(texture_resource_class_obj_t *texture, uint32_t offset, fl
157157 uint32_t dest_offset = center_pixel_offset ;
158158
159159 // The stride to the next row usually consists of just the
160- // screen width, however, subtract the dimensions of the
160+ // screen width, however, subtract the dimensions of the
161161 // destination rect so that we end up at the next row
162162 // in the rect. Also proceed forward on the next row
163163 // by the amount we are left clipping the dest rect
@@ -257,7 +257,7 @@ void engine_draw_blit_depth(texture_resource_class_obj_t *texture, uint32_t offs
257257 // ENGINE_PERFORMANCE_CYCLES_START();
258258 float inverse_x_scale = 1.0f / x_scale ;
259259 float inverse_y_scale = 1.0f / y_scale ;
260-
260+
261261 // https://codereview.stackexchange.com/a/86546
262262 float sin_angle = sinf (rotation_radians );
263263 float cos_angle = cosf (rotation_radians );
@@ -306,7 +306,7 @@ void engine_draw_blit_depth(texture_resource_class_obj_t *texture, uint32_t offs
306306 uint32_t dest_offset = center_pixel_offset ;
307307
308308 // The stride to the next row usually consists of just the
309- // screen width, however, subtract the dimensions of the
309+ // screen width, however, subtract the dimensions of the
310310 // destination rect so that we end up at the next row
311311 // in the rect. Also proceed forward on the next row
312312 // by the amount we are left clipping the dest rect
@@ -407,7 +407,7 @@ void engine_draw_rect(uint16_t color, float center_x, float center_y, int32_t wi
407407 // ENGINE_PERFORMANCE_CYCLES_START();
408408 float inverse_x_scale = 1.0f / x_scale ;
409409 float inverse_y_scale = 1.0f / y_scale ;
410-
410+
411411 // https://codereview.stackexchange.com/a/86546
412412 float sin_angle = sinf (rotation_radians );
413413 float cos_angle = cosf (rotation_radians );
@@ -456,7 +456,7 @@ void engine_draw_rect(uint16_t color, float center_x, float center_y, int32_t wi
456456 uint32_t dest_offset = center_pixel_offset ;
457457
458458 // The stride to the next row usually consists of just the
459- // screen width, however, subtract the dimensions of the
459+ // screen width, however, subtract the dimensions of the
460460 // destination rect so that we end up at the next row
461461 // in the rect. Also proceed forward on the next row
462462 // by the amount we are left clipping the dest rect
@@ -532,7 +532,7 @@ void engine_draw_outline_circle(uint16_t color, float center_x, float center_y,
532532 for (float angle = 0 ; angle <= 90 ; angle += angle_increment ){
533533 float cx = distance * cosf (angle );
534534 float cy = distance * sinf (angle );
535-
535+
536536 // Bottom right quadrant of the circle
537537 int brx = (int )(center_x + cx );
538538 int bry = (int )(center_y + cy );
@@ -575,7 +575,7 @@ void engine_draw_filled_circle(uint16_t color, float center_x, float center_y, f
575575}
576576
577577
578- void engine_draw_text (font_resource_class_obj_t * font , mp_obj_t text , float center_x , float center_y , float text_box_width , float text_box_height , float letter_spacing , float line_spacing , float x_scale , float y_scale , float rotation_radians , float alpha , engine_shader_t * shader ){
578+ void engine_draw_text (font_resource_class_obj_t * font , mp_obj_t text , float center_x , float center_y , float text_box_width , float text_box_height , float letter_spacing , float line_spacing , float x_scale , float y_scale , float rotation_radians , float alpha , engine_shader_t * shader ){
579579 float sin_angle = sinf (rotation_radians );
580580 float cos_angle = cosf (rotation_radians );
581581
@@ -791,7 +791,7 @@ void engine_draw_filled_triangle_depth(texture_resource_class_obj_t *texture, ui
791791 // https://fgiesen.wordpress.com/2013/02/10/optimizing-the-basic-rasterizer/#:~:text=In%20our%20basic%20triangle%20rasterization%20loop
792792 float dy_bc = (float )(by - cy ) / ABC ;
793793 float dx_bc = (float )(cx - bx ) / ABC ;
794-
794+
795795 float dy_ca = (float )(cy - ay ) / ABC ;
796796 float dx_ca = (float )(ax - cx ) / ABC ;
797797
0 commit comments