[Libreoffice-commits] core.git: include/basebmp
Caolán McNamara
caolanm at redhat.com
Tue Aug 26 01:40:13 PDT 2014
include/basebmp/clippedlinerenderer.hxx | 35 +++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 12 deletions(-)
New commits:
commit fde9961034e954f39a6c221b714813557eb63040
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Aug 25 21:06:54 2014 +0100
keep acc.set within clip bounds
Change-Id: I6af2eda03148dd400afa2f375b98e396ab0d5f3c
diff --git a/include/basebmp/clippedlinerenderer.hxx b/include/basebmp/clippedlinerenderer.hxx
index b3a5fd09..0265a65 100644
--- a/include/basebmp/clippedlinerenderer.hxx
+++ b/include/basebmp/clippedlinerenderer.hxx
@@ -256,6 +256,12 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
sal_Int32 xs = x1;
sal_Int32 ys = y1;
bool bUseAlternateBresenham=false;
+
+ sal_Int32 nMinY(rClipRect.getMinY());
+ sal_Int32 nMaxY(rClipRect.getMaxY()-1);
+ sal_Int32 nMinX(rClipRect.getMinX());
+ sal_Int32 nMaxX(rClipRect.getMaxX()-1);
+
if( adx >= ady )
{
// semi-horizontal line
@@ -263,10 +269,10 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
if( !prepareClip(x1, x2, y1, adx, ady, xs, ys, sx, sy,
rem, n, clipCode1, clipCount1, clipCode2, clipCount2,
- rClipRect.getMinX(), basegfx::tools::RectClipFlags::LEFT,
- rClipRect.getMaxX()-1, basegfx::tools::RectClipFlags::RIGHT,
- rClipRect.getMinY(), basegfx::tools::RectClipFlags::TOP,
- rClipRect.getMaxY()-1, basegfx::tools::RectClipFlags::BOTTOM,
+ nMinX, basegfx::tools::RectClipFlags::LEFT,
+ nMaxX, basegfx::tools::RectClipFlags::RIGHT,
+ nMinY, basegfx::tools::RectClipFlags::TOP,
+ nMaxY, basegfx::tools::RectClipFlags::BOTTOM,
bRoundTowardsPt2, bUseAlternateBresenham ) )
return; // line fully clipped away, no active pixel inside rect
@@ -284,7 +290,8 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
while(true)
{
- acc.set(color, rowIter);
+ if (xs >= nMinX && xs <= nMaxX && ys >= nMinY && ys <= nMaxY)
+ acc.set(color, rowIter);
if( rem >= 0 )
{
@@ -313,7 +320,8 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
{
while(true)
{
- acc.set(color, rowIter);
+ if (xs >= nMinX && xs <= nMaxX && ys >= nMinY && ys <= nMaxY)
+ acc.set(color, rowIter);
if( --n < 0 )
break;
@@ -344,10 +352,10 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
if( !prepareClip(y1, y2, x1, ady, adx, ys, xs, sy, sx,
rem, n, clipCode1, clipCount1, clipCode2, clipCount2,
- rClipRect.getMinY(), basegfx::tools::RectClipFlags::TOP,
- rClipRect.getMaxY()-1, basegfx::tools::RectClipFlags::BOTTOM,
- rClipRect.getMinX(), basegfx::tools::RectClipFlags::LEFT,
- rClipRect.getMaxX()-1, basegfx::tools::RectClipFlags::RIGHT,
+ nMinY, basegfx::tools::RectClipFlags::TOP,
+ nMaxY, basegfx::tools::RectClipFlags::BOTTOM,
+ nMinX, basegfx::tools::RectClipFlags::LEFT,
+ nMaxY, basegfx::tools::RectClipFlags::RIGHT,
bRoundTowardsPt2, bUseAlternateBresenham ) )
return; // line fully clipped away, no active pixel inside rect
@@ -365,7 +373,8 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
while(true)
{
- acc.set(color, colIter);
+ if (xs >= nMinX && xs <= nMaxX && ys >= nMinY && ys <= nMaxY)
+ acc.set(color, colIter);
if( rem >= 0 )
{
@@ -376,6 +385,7 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
xs += sx;
ys += sy;
+
rem -= ady;
currIter.x += sx;
@@ -394,7 +404,8 @@ void renderClippedLine( basegfx::B2IPoint aPt1,
{
while(true)
{
- acc.set(color, colIter);
+ if (xs >= nMinX && xs <= nMaxX && ys >= nMinY && ys <= nMaxY)
+ acc.set(color, colIter);
if( --n < 0 )
break;
More information about the Libreoffice-commits
mailing list