Kaydet (Commit) 8072a926 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#124521 sw btlr writing mode render: fix paint rectangle on scroll

By implementing btlr support in
SwTextFrame::SwitchVerticalToHorizontal(SwRect), so not only
invalidation but paint rectangle is also correct, which means actual
text painting happens.

Change-Id: I4215799ff63c93b300e4e8f97c6824f75d7c5401
Reviewed-on: https://gerrit.libreoffice.org/70797
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 8c75e662
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <wrtsh.hxx> #include <wrtsh.hxx>
#include <edtwin.hxx> #include <edtwin.hxx>
#include <view.hxx> #include <view.hxx>
#include <txtfrm.hxx>
static char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/"; static char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/";
...@@ -2839,6 +2840,36 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell) ...@@ -2839,6 +2840,36 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBtlrCell)
ss << "selection rectangle " << rRect << " is not inside cell rectangle " << aCellRect; ss << "selection rectangle " << rRect << " is not inside cell rectangle " << aCellRect;
CPPUNIT_ASSERT_MESSAGE(ss.str(), aCellRect.IsInside(rRect)); CPPUNIT_ASSERT_MESSAGE(ss.str(), aCellRect.IsInside(rRect));
} }
// Make sure that the correct rectangle gets repainted on scroll.
SwFrame* pPageFrame = pLayout->GetLower();
CPPUNIT_ASSERT(pPageFrame->IsPageFrame());
SwFrame* pBodyFrame = pPageFrame->GetLower();
CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame());
SwFrame* pTabFrame = pBodyFrame->GetLower();
CPPUNIT_ASSERT(pTabFrame->IsTabFrame());
SwFrame* pRowFrame = pTabFrame->GetLower();
CPPUNIT_ASSERT(pRowFrame->IsRowFrame());
SwFrame* pCellFrame = pRowFrame->GetLower();
CPPUNIT_ASSERT(pCellFrame->IsCellFrame());
SwFrame* pFrame = pCellFrame->GetLower();
CPPUNIT_ASSERT(pFrame->IsTextFrame());
SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pFrame);
pTextFrame->SwapWidthAndHeight();
// Mimic what normally SwTextFrame::PaintSwFrame() does:
SwRect aRect(4207, 2273, 269, 572);
pTextFrame->SwitchVerticalToHorizontal(aRect);
// Without the accompanying fix in place, this test would have failed with:
// Expected: 572x269@(1691,4217)
// Actual : 572x269@(2263,4217)
// i.e. the paint rectangle position was incorrect, text was not painted on scrolling up.
CPPUNIT_ASSERT_EQUAL(SwRect(1691, 4217, 572, 269), aRect);
#endif #endif
} }
......
...@@ -595,7 +595,18 @@ void SwTextFrame::SwitchVerticalToHorizontal( SwRect& rRect ) const ...@@ -595,7 +595,18 @@ void SwTextFrame::SwitchVerticalToHorizontal( SwRect& rRect ) const
nOfstX = getFrameArea().Left() + getFrameArea().Width() - ( rRect.Left() + rRect.Width() ); nOfstX = getFrameArea().Left() + getFrameArea().Width() - ( rRect.Left() + rRect.Width() );
} }
const long nOfstY = rRect.Top() - getFrameArea().Top(); long nOfstY;
if (IsVertLRBT())
{
// Note that mbIsSwapped only affects the frame area, not rRect, so rRect.Height() is used
// here unconditionally.
if (mbIsSwapped)
nOfstY = getFrameArea().Top() + getFrameArea().Width() - (rRect.Top() + rRect.Height());
else
nOfstY = getFrameArea().Top() + getFrameArea().Height() - (rRect.Top() + rRect.Height());
}
else
nOfstY = rRect.Top() - getFrameArea().Top();
const long nWidth = rRect.Height(); const long nWidth = rRect.Height();
const long nHeight = rRect.Width(); const long nHeight = rRect.Width();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment