diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-17 18:59:12 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-04-17 18:59:12 +0000 |
commit | 9ef231fcc3ccc2cd496bbbf9c0cb2a5fbe34d577 (patch) | |
tree | 11b3720107b7dd9b5a94ea72b039db8e66b09637 /nuttx/graphics/nxglib/fb | |
parent | a5d69f54d9b9a7225010bcf8be7244e8a0e1898a (diff) | |
download | px4-nuttx-9ef231fcc3ccc2cd496bbbf9c0cb2a5fbe34d577.tar.gz px4-nuttx-9ef231fcc3ccc2cd496bbbf9c0cb2a5fbe34d577.tar.bz2 px4-nuttx-9ef231fcc3ccc2cd496bbbf9c0cb2a5fbe34d577.zip |
Fix move rectangle logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2607 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics/nxglib/fb')
-rw-r--r-- | nuttx/graphics/nxglib/fb/nxglib_moverectangle.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c index 228bc3bb9..4403c6f6d 100644 --- a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c +++ b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c @@ -123,7 +123,9 @@ static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *slin * * Descripton: * Move a rectangular region from location to another in the - * framebuffer memory. + * framebuffer memory. The source is expressed as a rectangle; the + * destination position is expressed as a point corresponding to the + * translation of the upper, left-hand corner. * ****************************************************************************/ @@ -172,12 +174,16 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) # endif #endif - /* Case 1: The starting position is above the display */ + /* Case 1: The destination position (offset) is above the displayed + * position (rect) + */ - if (offset->y < 0) + if (offset->y < rect->pt1.y) { - dline = pinfo->fbmem + rect->pt1.y * stride + NXGL_SCALEX(rect->pt1.x); - sline = dline - offset->y * stride - NXGL_SCALEX(offset->x); + /* Copy the rectangle from top down. */ + + sline = pinfo->fbmem + rect->pt1.y * stride + NXGL_SCALEX(rect->pt1.x); + dline = dline - offset->y * stride - NXGL_SCALEX(offset->x); while (rows--) { @@ -191,12 +197,16 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) } } - /* Case 2: It's not */ + /* Case 2: The destination position (offset) is below the displayed + * position (rect) + */ else { - dline = pinfo->fbmem + rect->pt2.y * stride + NXGL_SCALEX(rect->pt1.x); - sline = dline - offset->y * stride - NXGL_SCALEX(offset->x); + /* Copy the rectangle from the bottom up */ + + sline = pinfo->fbmem + rect->pt2.y * stride + NXGL_SCALEX(rect->pt1.x); + dline = dline - offset->y * stride - NXGL_SCALEX(offset->x); while (rows--) { |