Fixing row_size calculation when bpp is equal 1

This commit is contained in:
jturnsek 2023-09-15 19:36:18 +02:00 committed by Xiang Xiao
parent 6840b4444b
commit 4407aa148e

View File

@ -118,7 +118,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct lcddev_area_s *lcd_area = FAR struct lcddev_area_s *lcd_area =
(FAR struct lcddev_area_s *)arg; (FAR struct lcddev_area_s *)arg;
size_t cols = lcd_area->col_end - lcd_area->col_start + 1; size_t cols = lcd_area->col_end - lcd_area->col_start + 1;
size_t row_size = cols * (priv->planeinfo.bpp >> 3); size_t row_size = cols * (priv->planeinfo.bpp > 1 ?
priv->planeinfo.bpp >> 3 : 1);
if (priv->planeinfo.getarea) if (priv->planeinfo.getarea)
{ {
@ -157,7 +158,8 @@ static int lcddev_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR const struct lcddev_area_s *lcd_area = FAR const struct lcddev_area_s *lcd_area =
(FAR const struct lcddev_area_s *)arg; (FAR const struct lcddev_area_s *)arg;
size_t cols = lcd_area->col_end - lcd_area->col_start + 1; size_t cols = lcd_area->col_end - lcd_area->col_start + 1;
size_t row_size = cols * (priv->planeinfo.bpp >> 3); size_t row_size = cols * (priv->planeinfo.bpp > 1 ?
priv->planeinfo.bpp >> 3 : 1);
if (priv->planeinfo.putarea) if (priv->planeinfo.putarea)
{ {