diff options
author | Henry Castro <hcastro@collabora.com> | 2024-12-16 07:42:05 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-12-18 13:02:14 +0100 |
commit | e03a130391a78a47cae1602c1e56817f0a522695 (patch) | |
tree | 1d9f014577ea31b408db4cc99fe4a85ad0f1fc4d | |
parent | f49a7e4e5463b55780d5a65f43344e163600beac (diff) |
lokit: add scale parameter to "renderNextSlideLayer"
cp-24.04.10-3distro/collabora/co-24.04.10
When client side change the device pixel ratio.
Signed-off-by: Henry Castro <hcastro@collabora.com>
Change-Id: I6356ff2a2e6513ac835b5f02a755173aafe01dc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178580
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
-rw-r--r-- | desktop/source/lib/init.cxx | 6 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 2 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 4 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 144 | ||||
-rw-r--r-- | sd/source/ui/inc/SlideshowLayerRenderer.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/tools/SlideshowLayerRenderer.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 4 |
9 files changed, 117 insertions, 65 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b5493bc22cfc..d3cdc01b4189 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1348,7 +1348,7 @@ static bool doc_createSlideRenderer( static void doc_postSlideshowCleanup(LibreOfficeKitDocument* pThis); static bool doc_renderNextSlideLayer( - LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMsg); + LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, double* pScale, char** pJsonMsg); static void doc_setViewOption(LibreOfficeKitDocument* pDoc, const char* pOption, const char* pValue); @@ -5802,7 +5802,7 @@ static void doc_postSlideshowCleanup(LibreOfficeKitDocument* pThis) } static bool doc_renderNextSlideLayer( - LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* pIsBitmapLayer, char** pJsonMessage) + LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* pIsBitmapLayer, double* pScale, char** pJsonMessage) { SolarMutexGuard aGuard; SetLastExceptionMsg(); @@ -5815,7 +5815,7 @@ static bool doc_renderNextSlideLayer( } OUString sJsonMesssage; bool bIsBitmapLayer = false; - bool bDone = pDoc->renderNextSlideLayer(pBuffer, bIsBitmapLayer, sJsonMesssage); + bool bDone = pDoc->renderNextSlideLayer(pBuffer, bIsBitmapLayer, *pScale, sJsonMesssage); if (pJsonMessage) *pJsonMessage = convertOUString(sJsonMesssage); diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index bd4e4b2533a2..f68bbb002489 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -550,7 +550,7 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::renderNextSlideLayer bool (*renderNextSlideLayer)( - LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMessage); + LibreOfficeKitDocument* pThis, unsigned char* pBuffer, bool* bIsBitmapLayer, double* pScale, char** pJsonMessage); /// @see lok::Document::setViewOption void (*setViewOption)(LibreOfficeKitDocument* pThis, const char* pOption, const char* pValue); diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 49fdf03bf233..c85a756ef971 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -932,9 +932,9 @@ public: } /// Render the slide layer - bool renderNextSlideLayer(unsigned char* pBuffer, bool* bIsBitmapLayer, char** pJsonMessage) + bool renderNextSlideLayer(unsigned char* pBuffer, bool* bIsBitmapLayer, double* pScale, char** pJsonMessage) { - return mpDoc->pClass->renderNextSlideLayer(mpDoc, pBuffer, bIsBitmapLayer, pJsonMessage); + return mpDoc->pClass->renderNextSlideLayer(mpDoc, pBuffer, bIsBitmapLayer, pScale, pJsonMessage); } /// Set named view options diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index 9e57fc53b0a0..fa42c077df5f 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -405,7 +405,7 @@ public: } /** render slideshow layer*/ - virtual bool renderNextSlideLayer(unsigned char* /*pBuffer*/, bool& /*bIsBitmapLayer*/, OUString& /*rJsonMsg*/) + virtual bool renderNextSlideLayer(unsigned char* /*pBuffer*/, bool& /*bIsBitmapLayer*/, double& /*rScale*/, OUString& /*rJsonMsg*/) { return true; } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 0683209e687f..e04340817fea 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -3279,9 +3279,10 @@ public: { std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(mnImageFileStep++, pBuffer, mnViewWidth, mnViewHeight, aJson.toUtf8().getStr()); @@ -3303,9 +3304,10 @@ public: std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT_MESSAGE( - sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT_MESSAGE(sMsg, bIsBitmapLayer); debugWriteImageToFile(mnImageFileStep++, pBuffer, mnViewWidth, mnViewHeight, @@ -3343,9 +3345,10 @@ public: std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT_MESSAGE( - sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT_MESSAGE(sMsg, !bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -3370,9 +3373,10 @@ public: std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT_MESSAGE( - sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + sMsg, !mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT_MESSAGE(sMsg, bIsBitmapLayer); debugWriteImageToFile(mnImageFileStep++, pBuffer, mnViewWidth, mnViewHeight, @@ -3418,9 +3422,10 @@ public: { std::vector<sal_uInt8> pBuffer(mnViewWidth * mnViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + mpXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } }; @@ -3455,8 +3460,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3473,8 +3479,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content @@ -3503,8 +3510,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3533,8 +3541,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering) { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } @@ -3570,8 +3579,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); boost::property_tree::ptree aTree; @@ -3586,8 +3596,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3614,8 +3625,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); // TODO - check JSON content debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3645,8 +3657,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3674,9 +3687,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -3691,9 +3705,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -3708,8 +3723,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(5, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3737,8 +3753,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_WithFie { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } @@ -3934,8 +3951,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -3957,9 +3975,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -3977,9 +3996,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -3997,9 +4017,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -4017,8 +4038,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4045,8 +4067,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4073,8 +4096,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } @@ -4099,8 +4123,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4124,9 +4149,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -4144,9 +4170,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -4164,9 +4191,10 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = true; + double dScale = 1.0; OUString aJson; CPPUNIT_ASSERT( - !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + !pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(!bIsBitmapLayer); boost::property_tree::ptree aTree; @@ -4184,8 +4212,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4209,8 +4238,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4238,8 +4268,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4267,8 +4298,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4292,8 +4324,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(bIsBitmapLayer); debugWriteImageToFile(5, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4321,8 +4354,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } @@ -4350,8 +4384,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(0, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4372,8 +4407,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(21, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4394,8 +4430,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4423,8 +4460,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4452,8 +4490,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(4, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4482,8 +4521,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } @@ -4511,8 +4551,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(1, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4533,8 +4574,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(2, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4555,8 +4597,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); debugWriteImageToFile(3, pBuffer, nViewWidth, nViewHeight, aJson.toUtf8().getStr()); @@ -4585,8 +4628,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } @@ -4614,8 +4658,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); // Remember the hash of the buffer for uniqueness check auto aBufferHash = comphelper::Hash::calculateHash(pBuffer.data(), pBuffer.size(), comphelper::HashType::SHA1); @@ -4640,8 +4685,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); // Remember the hash of the buffer for uniqueness check auto aBufferHash = comphelper::Hash::calculateHash(pBuffer.data(), pBuffer.size(), comphelper::HashType::SHA1); @@ -4666,8 +4712,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(!pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); // Remember the hash of the buffer for uniqueness check auto aBufferHash = comphelper::Hash::calculateHash(pBuffer.data(), pBuffer.size(), comphelper::HashType::SHA1); @@ -4703,8 +4750,9 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testSlideshowLayeredRendering_Animati { std::vector<sal_uInt8> pBuffer(nViewWidth * nViewHeight * 4); bool bIsBitmapLayer = false; + double dScale = 1.0; OUString aJson; - CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, aJson)); + CPPUNIT_ASSERT(pXImpressDocument->renderNextSlideLayer(pBuffer.data(), bIsBitmapLayer, dScale, aJson)); CPPUNIT_ASSERT(aJson.isEmpty()); } diff --git a/sd/source/ui/inc/SlideshowLayerRenderer.hxx b/sd/source/ui/inc/SlideshowLayerRenderer.hxx index 0804dd78edc9..ac2faa645152 100644 --- a/sd/source/ui/inc/SlideshowLayerRenderer.hxx +++ b/sd/source/ui/inc/SlideshowLayerRenderer.hxx @@ -201,7 +201,7 @@ public: * The properties of the layer are written to the input string in JSON format. * * @returns false, if nothing was rendered and rendering is done */ - bool render(unsigned char* pBuffer, bool& bIsBitmapLayer, OString& rJsonMsg); + bool render(unsigned char* pBuffer, bool& bIsBitmapLayer, double& scale, OString& rJsonMsg); }; } // end of namespace sd diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 90134c120681..fcf40e94208d 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -299,7 +299,7 @@ public: /// @see vcl::ITiledRenderable::postSlideshowCleanup(). void postSlideshowCleanup() override; /// @see vcl::ITiledRenderable::renderNextSlideLayer(). - bool renderNextSlideLayer(unsigned char* pBuffer, bool& bIsBitmapLayer, OUString& rJsonMsg) override; + bool renderNextSlideLayer(unsigned char* pBuffer, bool& bIsBitmapLayer, double& rScale, OUString& rJsonMsg) override; // XComponent diff --git a/sd/source/ui/tools/SlideshowLayerRenderer.cxx b/sd/source/ui/tools/SlideshowLayerRenderer.cxx index f447aa84f2c3..9ef86479e508 100644 --- a/sd/source/ui/tools/SlideshowLayerRenderer.cxx +++ b/sd/source/ui/tools/SlideshowLayerRenderer.cxx @@ -61,13 +61,16 @@ private: EEControlBits mnSavedControlBits; Color maSavedBackgroundColor; + Fraction maScale; public: ScopedVclPtrInstance<VirtualDevice> maVirtualDevice; - RenderContext(unsigned char* pBuffer, SdrModel& rModel, SdrPage& rPage, Size const& rSlideSize) + RenderContext(unsigned char* pBuffer, SdrModel& rModel, SdrPage& rPage, Size const& rSlideSize, + const Fraction& rScale) : mrModel(rModel) , mrPage(rPage) + , maScale(rScale) , maVirtualDevice(DeviceFormat::WITHOUT_ALPHA) { SdrOutliner& rOutliner = mrModel.GetDrawOutliner(); @@ -82,8 +85,8 @@ public: maVirtualDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); - maVirtualDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(rSlideSize, Fraction(1.0), - Point(), pBuffer); + maVirtualDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(rSlideSize, maScale, Point(), + pBuffer); Size aPageSize(mrPage.GetSize()); MapMode aMapMode(MapUnit::Map100thMM); @@ -982,11 +985,12 @@ void SlideshowLayerRenderer::writeJSON(OString& rJsonMsg, RenderPass const& rRen maRenderState.incrementIndex(); } -bool SlideshowLayerRenderer::render(unsigned char* pBuffer, bool& bIsBitmapLayer, OString& rJsonMsg) +bool SlideshowLayerRenderer::render(unsigned char* pBuffer, bool& bIsBitmapLayer, double& rScale, + OString& rJsonMsg) { // We want to render one pass (one iteration through objects) - RenderContext aRenderContext(pBuffer, mrModel, mrPage, maSlideSize); + RenderContext aRenderContext(pBuffer, mrModel, mrPage, maSlideSize, Fraction(rScale)); // Render Background and analyze other passes if (maRenderState.meStage == RenderStage::Background) @@ -1009,7 +1013,7 @@ bool SlideshowLayerRenderer::render(unsigned char* pBuffer, bool& bIsBitmapLayer // We need to return a valid layer, so if background has to be skipped // render the next layer if (!mbRenderBackground) - render(pBuffer, bIsBitmapLayer, rJsonMsg); + render(pBuffer, bIsBitmapLayer, rScale, rJsonMsg); } else { diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index ecc7d7c16f07..3c04c2276eec 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -4749,7 +4749,7 @@ void SdXImpressDocument::postSlideshowCleanup() pViewSh->destroyXSlideShowInstance(); } -bool SdXImpressDocument::renderNextSlideLayer(unsigned char* pBuffer, bool& bIsBitmapLayer, OUString& rJsonMsg) +bool SdXImpressDocument::renderNextSlideLayer(unsigned char* pBuffer, bool& bIsBitmapLayer, double& rScale, OUString& rJsonMsg) { bool bDone = true; @@ -4757,7 +4757,7 @@ bool SdXImpressDocument::renderNextSlideLayer(unsigned char* pBuffer, bool& bIsB return bDone; OString sMsg; - bool bOK = mpSlideshowLayerRenderer->render(pBuffer, bIsBitmapLayer, sMsg); + bool bOK = mpSlideshowLayerRenderer->render(pBuffer, bIsBitmapLayer, rScale, sMsg); if (bOK) { |