From c1e79ef7a83554805aaf3f6d61338b77323e05fe Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Sat, 15 Oct 2022 07:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9E=97=E4=BC=9F=E5=A4=A7?= =?UTF-8?q?=E4=BD=AC=E7=9A=84=E4=BC=98=E5=8C=96=E6=96=B9=E5=BC=8F=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BA=86=E5=90=88=E5=B9=B6=E6=AF=94=E8=BE=83=20?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E5=9C=A8=E6=AD=A4=EF=BC=9Ahttps://www.zhihu.?= =?UTF-8?q?com/question/264505093/answer/281849883?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/acf.c | 3 ++- source/arm11/atp.c | 4 +++- source/arm11/filebrowser.c | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/arm11/acf.c b/source/arm11/acf.c index 6cc9d73..abd26c5 100644 --- a/source/arm11/acf.c +++ b/source/arm11/acf.c @@ -292,7 +292,8 @@ static int render_unicode(FHandle fd, int *x, unsigned width, unsigned height, u for (int j = 0; j < bbx[0]; ++j) { int tx = cx+j, ty = cy-i; - if( 0 <= ty && ty < (int)height && 0 <= tx && tx < (int)width ) + // see: https://www.zhihu.com/question/264505093/answer/281849883 + if( ( tx | ((int)width-tx) | ty | ((int)height-ty) ) > 0 ) // 0 <= tx && tx < width && 0 <= ty && ty <= height { if( BIT_AT_POS(glyph, bbx[0] * i + j) ) { diff --git a/source/arm11/atp.c b/source/arm11/atp.c index 672c107..e1b8d2f 100644 --- a/source/arm11/atp.c +++ b/source/arm11/atp.c @@ -34,7 +34,9 @@ static void set_screen_color( acf_callerdata_t data, acf_position_t tx, acf_posi int x = tx + draw_data[0]; int y = ty + draw_data[1]; - if( 0 <= x && x < draw_data[2] && 0 <= y && y < draw_data[3] ) + + // see: https://www.zhihu.com/question/264505093/answer/281849883 + if( ( x | (draw_data[2]-x) | y | (draw_data[3]-y) ) > 0 ) // 0 <= x && x < draw_data[2] && 0 <= y && y < draw_data[3] { frame[ x*draw_data[3] + (draw_data[3]-1-y) ] = (u16)draw_data[4]; } diff --git a/source/arm11/filebrowser.c b/source/arm11/filebrowser.c index 91aa8ca..819a7e2 100644 --- a/source/arm11/filebrowser.c +++ b/source/arm11/filebrowser.c @@ -224,7 +224,6 @@ Result browseFiles(const char *const basePath, char selected[512]) break; } } - screenClean(); end: free(dList);