summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-03-26 11:58:51 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-03-26 12:07:45 +0200
commit8945f1bc858f3636d4270f16bd2e66ce88c0021c (patch)
tree4874d2dfb10e9822faac277fcaa60444cd46ce24 /sw
parentb42362e7095785daf3a2614f679671e9df245e51 (diff)
Fix recent paintfrm.cxx regressions
...as reported by Linux-RHEL6-x86_64@14-with-check tinderbox. For one, e94c4ab5523c7dcbee2f1b7fd47685529498e774 "Conver SV VARARR to std::deque for sw module." did not use rbegin/rend to iterate backwards. For another, e94c4ab5523c7dcbee2f1b7fd47685529498e774 and subsequent 1a412714031bf6cf3f7962b044b2edea74899b46 "fixed crash due to use of STL deque for SwLineRects" failed to get the nested loop "Remove all help line that are almost covered (tables)" at the start of SwSubsRects::PaintSubsidiary converted correctly. This attempt here at fixing it models the original behavior (before conversion) more closely, and hopefully gets it right now.
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/paintfrm.cxx34
1 files changed, 14 insertions, 20 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a9f60f3cee83..286908aaf697 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -492,7 +492,8 @@ void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol, const Svx
//Loop backwards because lines which can be combined, can usually be painted
//in the same context.
- for (SwLineRects::iterator it = this->end(); it != this->begin(); --it)
+ for (SwLineRects::reverse_iterator it = this->rbegin(); it != this->rend();
+ ++it)
{
SwLineRect &rLRect = (*it);
// Test for the orientation, color, table
@@ -948,17 +949,14 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
// Remove all help line that are almost covered (tables)
- SwSubsRects::iterator it = this->begin();
- while ( it != this->end() )
+ for (SwSubsRects::size_type i = 0; i != this->size(); ++i)
{
- SwLineRect &rLi = *it;
+ SwLineRect &rLi = (*this)[i];
const bool bVerticalSubs = rLi.Height() > rLi.Width();
- SwSubsRects::iterator itK = it;
- while ( itK != this->end() )
+ for (SwSubsRects::size_type k = i + 1; k != this->size(); ++k)
{
- bool bRemoved = false;
- SwLineRect &rLk = (*itK);
+ SwLineRect &rLk = (*this)[k];
if ( rLi.SSize() == rLk.SSize() )
{
if ( bVerticalSubs == ( rLk.Height() > rLk.Width() ) )
@@ -971,11 +969,11 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
((nLi < rLk.Left() && nLi+21 > rLk.Left()) ||
(nLk < rLi.Left() && nLk+21 > rLi.Left())))
{
- this->erase( itK );
+ this->erase(this->begin() + k);
// don't continue with inner loop any more:
// the array may shrink!
- itK = this->end();
- bRemoved = true;
+ --i;
+ break;
}
}
else
@@ -986,21 +984,16 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
((nLi < rLk.Top() && nLi+21 > rLk.Top()) ||
(nLk < rLi.Top() && nLk+21 > rLi.Top())))
{
- this->erase( itK );
+ this->erase(this->begin() + k);
// don't continue with inner loop any more:
// the array may shrink!
- itK = this->end();
- bRemoved = true;
+ --i;
+ break;
}
}
}
}
-
- if ( !bRemoved )
- ++itK;
}
-
- ++it;
}
if ( pRects && (!pRects->empty()) )
@@ -1021,7 +1014,8 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
pOut->SetDrawMode( 0 );
}
- for (it = this->begin(); it != this->end(); ++it)
+ for (SwSubsRects::iterator it = this->begin(); it != this->end();
+ ++it)
{
SwLineRect &rLRect = (*it);
// Add condition <!rLRect.IsLocked()> to prevent paint of locked subsidiary lines.