lcd: Refactor viewport clipping functions

There's no need to generate separate copies of these functions
for main and remote LCDs; we can just pass the viewport directly.

Change-Id: I20aa04a58d327b479a942708e161068bd6a3357b
This commit is contained in:
Aidan MacDonald 2022-10-02 00:54:31 +01:00
parent 6acc8a81a7
commit f737e5025d
9 changed files with 47 additions and 51 deletions

View file

@ -243,7 +243,7 @@ void LCDFN(hline)(int x1, int x2, int y)
unsigned mask;
LCDFN(blockfunc_type) *bfunc;
if (!LCDFN(clip_viewport_hline)(&x1, &x2, &y))
if (!clip_viewport_hline(vp, &x1, &x2, &y))
return;
width = x2 - x1 + 1;
@ -268,7 +268,7 @@ void LCDFN(vline)(int x, int y1, int y2)
unsigned mask, mask_bottom;
LCDFN(blockfunc_type) *bfunc;
if (!LCDFN(clip_viewport_vline)(&x, &y1, &y2))
if (!clip_viewport_vline(vp, &x, &y1, &y2))
return;
bfunc = LCDFN(blockfuncs)[vp->drawmode];
@ -300,7 +300,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
LCDFN(blockfunc_type) *bfunc;
bool fillopt = false;
if (!LCDFN(clip_viewport_rect)(&x, &y, &width, &height, NULL, NULL))
if (!clip_viewport_rect(vp, &x, &y, &width, &height, NULL, NULL))
return;
if (vp->drawmode & DRMODE_INVERSEVID)
@ -378,7 +378,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
unsigned mask, mask_bottom;
LCDFN(blockfunc_type) *bfunc;
if (!LCDFN(clip_viewport_rect)(&x, &y, &width, &height, &src_x, &src_y))
if (!clip_viewport_rect(vp, &x, &y, &width, &height, &src_x, &src_y))
return;
src += stride * (src_y >> 3) + src_x; /* move starting point */