slideshow: lok: export bounds for animated layers

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Iccc0993fd9736842fc3e9783306d21aabc813e5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173121
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177249
Tested-by: Jenkins
This commit is contained in:
Szymon Kłos 2024-09-10 09:56:54 +02:00
parent c20db9a219
commit 3a00e589ce
2 changed files with 18 additions and 0 deletions

View file

@ -3088,6 +3088,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
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_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"content\": { \"type\": \"%IMAGETYPE%\", \"checksum\": \"%IMAGECHECKSUM%\"}") >= 0);
@ -3103,6 +3104,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 0") >= 0);
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
@ -3117,6 +3119,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"MasterPage\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 1") >= 0);
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
@ -3132,6 +3135,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
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_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
@ -3163,6 +3167,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
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"\"bounds\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
@ -3179,6 +3184,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 3") >= 0);
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"initVisible\""));
CPPUNIT_ASSERT_EQUAL(-1, rJsonMsg.indexOf(u"\"bounds\""));
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);
debugWriteImageToFile(6, pBuffer, nViewWidth, nViewHeight, rJsonMsg.toUtf8().getStr());
@ -3194,6 +3200,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"group\": \"DrawPage\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"index\": 4") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"initVisible\": false") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"bounds\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"animated\"") >= 0);
CPPUNIT_ASSERT(rJsonMsg.indexOf(u"\"type\": \"bitmap\"") >= 0);

View file

@ -334,6 +334,16 @@ static void writeContentNode(::tools::JsonWriter& aJsonWriter)
aJsonWriter.put("checksum", "%IMAGECHECKSUM%");
}
static void writeBoundingBox(::tools::JsonWriter& aJsonWriter, SdrObject* pObject)
{
auto aContentNode = aJsonWriter.startNode("bounds");
::tools::Rectangle aRect = pObject->GetCurrentBoundRect();
aJsonWriter.put("x", aRect.getX());
aJsonWriter.put("y", aRect.getY());
aJsonWriter.put("width", aRect.GetWidth());
aJsonWriter.put("height", aRect.GetHeight());
}
void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg)
{
::tools::JsonWriter aJsonWriter;
@ -354,6 +364,7 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg)
aJsonWriter.put("initVisible", maRenderState.isObjectInitiallyVisible(pObject));
aJsonWriter.put("type", "bitmap");
writeContentNode(aJsonWriter);
writeBoundingBox(aJsonWriter, pObject);
}
}
else