summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-10-23 21:27:03 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-10-23 21:27:03 +0000
commite479c3fd01478ce47eb5a067796e925db9c1a4e4 (patch)
tree9d327c50b171d3560bc7b284b77add9a5cf3b761 /nuttx
parent214bee5a9d5cc49d58906e7a982c897369dd4371 (diff)
downloadnuttx-e479c3fd01478ce47eb5a067796e925db9c1a4e4.tar.gz
nuttx-e479c3fd01478ce47eb5a067796e925db9c1a4e4.tar.bz2
nuttx-e479c3fd01478ce47eb5a067796e925db9c1a4e4.zip
Fix an error in some graphics error handling
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4059 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/graphics/nxbe/nxbe_bitmap.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 2d1e08bd3..fad579bf5 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2170,4 +2170,5 @@
* graphics/nxmu/nx_getrectangle.c, graphics/nxsu/nx_getrectangle.c,
graphics/mxtk/nx_getwindow.c, graphics/nxmu/nx_gettoobar.c: New
interfaces to read from graphics memory
-
+ * graphics/nxbe/nxbe_bitmap.c: Fix an error in the error handling that
+ can cause valid bitmaps to fail to render.
diff --git a/nuttx/graphics/nxbe/nxbe_bitmap.c b/nuttx/graphics/nxbe/nxbe_bitmap.c
index 3076b2c84..1c23445b1 100644
--- a/nuttx/graphics/nxbe/nxbe_bitmap.c
+++ b/nuttx/graphics/nxbe/nxbe_bitmap.c
@@ -1,7 +1,7 @@
/****************************************************************************
* graphics/nxbe/nxbe_bitmap.c
*
- * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -125,6 +125,7 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
struct nxgl_rect_s bounds;
struct nxgl_point_s offset;
struct nxgl_rect_s remaining;
+ unsigned int deststride;
int i;
#ifdef CONFIG_DEBUG
@@ -150,10 +151,11 @@ void nxbe_bitmap(FAR struct nxbe_window_s *wnd, FAR const struct nxgl_rect_s *de
}
/* Verify that the width of the destination rectangle does not exceed the
- * with of the source bitmap data
+ * width of the source bitmap data
*/
- if ((((bounds.pt2.x - offset.x) * wnd->be->plane[0].pinfo.bpp) >> 3) > stride)
+ deststride = (((bounds.pt2.x - bounds.pt1.x + 1) * wnd->be->plane[0].pinfo.bpp + 7) >> 3);
+ if (deststride > stride)
{
gdbg("Bad dest width\n");
return;