lcd: Fix off by one error in clipping check
When I converted all the clipping checks in 4b8fe8acd1
I messed
up the hline and vline checks. This produced some weird panics on
the Shanling Q1, probably memory corruption -- but somehow it got
past AddressSanitizer. Go figure.
Change-Id: I84820c23a491d422218c72d2d5e199e2fc7def0f
This commit is contained in:
parent
ffdc64bea2
commit
5e7c34f5b3
1 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@ static inline bool clip_viewport_pixel(struct viewport *vp, int *x, int *y)
|
||||||
static inline bool clip_viewport_hline(struct viewport *vp,
|
static inline bool clip_viewport_hline(struct viewport *vp,
|
||||||
int *x1, int *x2, int *y)
|
int *x1, int *x2, int *y)
|
||||||
{
|
{
|
||||||
if (*y < 0 || *y > vp->height)
|
if (*y < 0 || *y >= vp->height)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (*x2 < *x1) {
|
if (*x2 < *x1) {
|
||||||
|
@ -105,7 +105,7 @@ static inline bool clip_viewport_hline(struct viewport *vp,
|
||||||
static inline bool clip_viewport_vline(struct viewport *vp,
|
static inline bool clip_viewport_vline(struct viewport *vp,
|
||||||
int *x, int *y1, int *y2)
|
int *x, int *y1, int *y2)
|
||||||
{
|
{
|
||||||
if (*x < 0 || *x > vp->width)
|
if (*x < 0 || *x >= vp->width)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (*y2 < *y1) {
|
if (*y2 < *y1) {
|
||||||
|
|
Loading…
Reference in a new issue