From bcb133279259216c1509cfc4b986c81c536e59fc Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Thu, 2 Apr 2026 20:11:38 +0800 Subject: [PATCH] graphics/nxglib: use putarea for lcd copyrectangle when available For LCD drivers that implement putarea(), use it to copy the entire rectangle in a single call instead of per-row putrun() calls. This avoids the per-row overhead of setting the display window (CASET+RASET over SPI) for every scanline. Signed-off-by: wangjianyu3 --- graphics/nxglib/lcd/nxglib_copyrectangle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/graphics/nxglib/lcd/nxglib_copyrectangle.c b/graphics/nxglib/lcd/nxglib_copyrectangle.c index 0631f9e0a69..952bda3f212 100644 --- a/graphics/nxglib/lcd/nxglib_copyrectangle.c +++ b/graphics/nxglib/lcd/nxglib_copyrectangle.c @@ -75,8 +75,18 @@ void NXGL_FUNCNAME(nxgl_copyrectangle, NXGLIB_SUFFIX) xoffset = dest->pt1.x - origin->x; sline = (FAR const uint8_t *)src + NXGL_SCALEX(xoffset) + (dest->pt1.y - origin->y) * srcstride; + #if NXGLIB_BITSPERPIXEL < 8 remainder = NXGL_REMAINDERX(xoffset); +#else + if (pinfo->putarea != NULL) + { + pinfo->putarea(pinfo->dev, + dest->pt1.y, dest->pt2.y, + dest->pt1.x, dest->pt2.x, + sline, srcstride); + return; + } #endif /* Copy the image, one row at a time */