lok: slideshow: render animated objects as separate layers
don't merge animated and non-animated objects on single layer Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I259507e08c95c3662e60f7691646395d1a840465 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173084 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177228 Tested-by: Jenkins
This commit is contained in:
parent
505775873f
commit
dfb779ff76
2 changed files with 142 additions and 5 deletions
|
@ -3011,9 +3011,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
|
|||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
|
||||
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
|
||||
|
||||
debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
|
@ -3030,6 +3030,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
|
|||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"hash\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
|
||||
|
||||
debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
|
@ -3062,6 +3063,138 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
|
|||
pXImpressDocument->postSlideshowCleanup();
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animations2)
|
||||
{
|
||||
SdXImpressDocument* pXImpressDocument = createDoc("anim.odp");
|
||||
pXImpressDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
|
||||
sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
|
||||
CPPUNIT_ASSERT(pViewShell);
|
||||
SdPage* pPage = pViewShell->GetActualPage();
|
||||
CPPUNIT_ASSERT(pPage);
|
||||
sal_Int32 nViewWidth = 2000;
|
||||
sal_Int32 nViewHeight = 2000;
|
||||
CPPUNIT_ASSERT(pXImpressDocument->createSlideRenderer(0, nViewWidth, nViewHeight, true, true));
|
||||
CPPUNIT_ASSERT_EQUAL(2000, nViewWidth);
|
||||
CPPUNIT_ASSERT_EQUAL(1125, nViewHeight);
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"Background\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
|
||||
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"hash\""));
|
||||
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
|
||||
|
||||
debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
|
||||
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 2") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
debugWriteImageToFile(5, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
CPPUNIT_ASSERT(bIsBitmapLayer);
|
||||
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": true") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
|
||||
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
|
||||
|
||||
debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4);
|
||||
bool bIsBitmapLayer = false;
|
||||
OUString rJsonMsg;
|
||||
CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, rJsonMsg));
|
||||
}
|
||||
|
||||
pXImpressDocument->postSlideshowCleanup();
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -117,6 +117,7 @@ public:
|
|||
{
|
||||
if (mrRenderState.meStage == RenderStage::Background)
|
||||
{
|
||||
mrRenderState.mbPassHasOutput = true;
|
||||
mrRenderState.mbSkipAllInThisPass = true;
|
||||
return;
|
||||
}
|
||||
|
@ -134,8 +135,6 @@ public:
|
|||
if (pPage == nullptr)
|
||||
return;
|
||||
|
||||
mrRenderState.mpCurrentTarget = pObject;
|
||||
|
||||
// is the object visible and not hidden by any option
|
||||
const bool bVisible
|
||||
= pObject->getSdrPageFromSdrObject()->checkVisibility(rOriginal, rDisplayInfo, true);
|
||||
|
@ -166,6 +165,9 @@ public:
|
|||
|
||||
if (mrRenderState.isObjectInAnimation(pObject))
|
||||
{
|
||||
if (!mrRenderState.mbFirstObjectInPass)
|
||||
return;
|
||||
|
||||
mrRenderState.mbSkipAllInThisPass = true;
|
||||
}
|
||||
|
||||
|
@ -177,6 +179,8 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
mrRenderState.mpCurrentTarget = pObject;
|
||||
|
||||
// render the object
|
||||
sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
|
||||
rOriginal, rDisplayInfo, rVisitor);
|
||||
|
|
Loading…
Reference in a new issue