download.lst                                      |    4 +-
 external/lcms2/0001-Added-missing-export.patch.1  |   25 +++++++++++++
 external/lcms2/ExternalPackage_lcms2.mk           |    2 -
 external/lcms2/UnpackedTarball_lcms2.mk           |    4 +-
 external/lcms2/c++17.patch.1                      |   13 ------
 svx/qa/unit/customshapes.cxx                      |   42 ++++++++++++++++++++++
 svx/qa/unit/data/tdf160421_3D_FlipLight.odp       |binary
 svx/source/customshapes/EnhancedCustomShape3d.cxx |    8 ++++
 8 files changed, 81 insertions(+), 17 deletions(-)

New commits:
commit 9ae95bbdfe6494fb87a6e368de8ea3070c5241fb
Author:     Regina Henschel <rb.hensc...@t-online.de>
AuthorDate: Fri Mar 29 22:44:45 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 2 17:53:16 2024 +0200

    tdf#160421 flip lights too for flipped extruded shapes
    
    If an extruded custom shape is mirrored, the lights in the scene are
    also mirrored. This should not happen. MS Office keeps the light
    direction in relation to the camera direction for binary files and pptx
    files with legacy camera. We should do the same, especially since the UI
    does not allow the user to set the light directions at arbitrary angles.
    Otherwise the shape receives only ambient light.
    
    Change-Id: I091d78c581b3d247f8b0680cd57654e3df330cdd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165562
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.hensc...@t-online.de>
    (cherry picked from commit 9761d4239de6398d4f6ecf08356f2ce18e502a04)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165614
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 6ae5cc819c73..fcc68aacf413 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -63,6 +63,9 @@ protected:
     // get shape nShapeIndex from page 0
     uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex);
     sal_uInt8 countShapes();
+    // fX and fY are positions relative to the size of the bitmap of the shape
+    // Thus the position is indepedent from DPI
+    Color getColor(uno::Reference<drawing::XShape> xShape, const double& fX, 
const double& fY);
 };
 
 uno::Reference<drawing::XShape> CustomshapesTest::getShape(sal_uInt8 
nShapeIndex)
@@ -89,6 +92,18 @@ sal_uInt8 CustomshapesTest::countShapes()
     return xDrawPage->getCount();
 }
 
+Color CustomshapesTest::getColor(uno::Reference<drawing::XShape> xShape, const 
double& fX,
+                                 const double& fY)
+{
+    GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", 
maTempFile.GetURL());
+    SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
+    vcl::PngImageReader aPNGReader(aFileStream);
+    Bitmap aBMP = aPNGReader.read().GetBitmap();
+    Size aSize = aBMP.GetSizePixel();
+    BitmapScopedReadAccess pRead(aBMP);
+    return pRead->GetColor(aSize.Height() * fY, aSize.Width() * fX);
+}
+
 CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf150302)
 {
     loadFromFile(u"FontworkSameLetterHeights.fodg");
@@ -1381,6 +1396,33 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf153000_MS0_SPT_25_31)
         CPPUNIT_ASSERT_EQUAL(aExpected[i], aCoordinates.getLength());
     }
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf160421_3D_FlipLight)
+{
+    // The document contains (0)an extruded 'rectangle' custom shape which is 
illuminated with front
+    // light, (1) this shape vertically flipped and (2) this shape 
horizontally flipped.
+    // When the shape is flipped vertically or horizontally, the light 
direction should not
+    // change. MS Office behaves in this way for ppt and pptx and it is 
meaningful as flipping is
+    // applied to the shape, not to the scene.
+
+    // Load document.
+    loadFromFile(u"tdf160421_3D_FlipLight.odp");
+
+    // Get color from untransformed shape (0).
+    uno::Reference<drawing::XShape> xShape = getShape(0);
+    Color aNormalColor = getColor(xShape, 0.6, 0.6);
+
+    // Test that color from vertically flipped shape (1) is same as normal 
color. Without the fix
+    // it was only build from ambient light and thus much darker.
+    xShape = getShape(1);
+    sal_uInt16 nColorDistance = aNormalColor.GetColorError(getColor(xShape, 
0.6, 0.6));
+    CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+
+    // Same for horizontally flipped shape (2)
+    xShape = getShape(2);
+    nColorDistance = aNormalColor.GetColorError(getColor(xShape, 0.6, 0.6));
+    CPPUNIT_ASSERT_LESS(sal_uInt16(6), nColorDistance);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf160421_3D_FlipLight.odp 
b/svx/qa/unit/data/tdf160421_3D_FlipLight.odp
new file mode 100644
index 000000000000..2decc51e3e6d
Binary files /dev/null and b/svx/qa/unit/data/tdf160421_3D_FlipLight.odp differ
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx 
b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index a401246277cc..2a2d049e184a 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -838,6 +838,14 @@ rtl::Reference<SdrObject> 
EnhancedCustomShape3d::Create3DObject(
             basegfx::B3DVector aLight2Vector(aSecondLightDirection.DirectionX, 
-aSecondLightDirection.DirectionY, aSecondLightDirection.DirectionZ);
             aLight2Vector.normalize();
 
+            // tdf#160421 a single flip inverts the light directions currently 
(March 2024). So invert
+            // their directions here for rendering.
+            if (bIsMirroredX != bIsMirroredY)
+            {
+                aLight1Vector *= -1.0;
+                aLight2Vector *= -1.0;
+            }
+
             // Light Intensity
 
             // For "FirstLight" the 3D-Scene light "1" is regularly used. In 
case of surface "Matte"
commit 223be8d2103e3dd133054e4c7aa5b1148abe36a0
Author:     Taichi Haradaguchi <20001...@ymail.ne.jp>
AuthorDate: Tue Mar 26 16:49:26 2024 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 2 17:53:12 2024 +0200

    lcms2: upgrade to 2.16
    
    * backport 0001-Added-missing-export.patch to fix the Windows build.
    * drop c++17.patch.1, which fixed uptream.
    
    Change-Id: Ib658ba3067c35ca5cd1ccb7b3f0f2f3bc9f82a43
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165350
    Tested-by: Jenkins
    Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>
    (cherry picked from commit c2db961ee69c4fe6a7f7162f2adf712651b6ffcc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165611
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/download.lst b/download.lst
index 7759ea2c73d8..9eb6e0e56d99 100644
--- a/download.lst
+++ b/download.lst
@@ -364,8 +364,8 @@ LANGTAGREG_TARBALL := 
language-subtag-registry-2023-08-02.tar.bz2
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-LCMS2_SHA256SUM := 
b20cbcbd0f503433be2a4e81462106fa61050a35074dc24a4e356792d971ab39
-LCMS2_TARBALL := lcms2-2.15.tar.gz
+LCMS2_SHA256SUM := 
d873d34ad8b9b4cea010631f1a6228d2087475e4dc5e763eb81acc23d9d45a51
+LCMS2_TARBALL := lcms2-2.16.tar.gz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/lcms2/0001-Added-missing-export.patch.1 
b/external/lcms2/0001-Added-missing-export.patch.1
new file mode 100644
index 000000000000..ad131e9533d3
--- /dev/null
+++ b/external/lcms2/0001-Added-missing-export.patch.1
@@ -0,0 +1,25 @@
+From f7b3c637c20508655f8b49935a4b556d52937b69 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <d...@lemstra.org>
+Date: Sun, 10 Dec 2023 20:31:32 +0100
+Subject: [PATCH] Added missing export.
+
+---
+ src/cmsvirt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cmsvirt.c b/src/cmsvirt.c
+index 3d662b2..6615604 100644
+--- a/src/cmsvirt.c
++++ b/src/cmsvirt.c
+@@ -676,7 +676,7 @@ cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfile(void)
+ * 
+ * This virtual profile cannot be saved as an ICC file
+ */
+-cmsHPROFILE cmsCreate_OkLabProfile(cmsContext ctx)
++cmsHPROFILE CMSEXPORT cmsCreate_OkLabProfile(cmsContext ctx)
+ {
+     cmsStage* XYZPCS = _cmsStageNormalizeFromXyzFloat(ctx);
+     cmsStage* PCSXYZ = _cmsStageNormalizeToXyzFloat(ctx);
+-- 
+2.44.0.windows.1
+
diff --git a/external/lcms2/ExternalPackage_lcms2.mk 
b/external/lcms2/ExternalPackage_lcms2.mk
index a2c051f6eb9a..62e2ebad8981 100644
--- a/external/lcms2/ExternalPackage_lcms2.mk
+++ b/external/lcms2/ExternalPackage_lcms2.mk
@@ -17,7 +17,7 @@ $(eval $(call 
gb_ExternalPackage_add_file,lcms2,$(LIBO_LIB_FOLDER)/liblcms2.2.dy
 else ifeq ($(COM),MSC)
 $(eval $(call 
gb_ExternalPackage_add_file,lcms2,$(LIBO_LIB_FOLDER)/lcms2.dll,bin/lcms2.dll))
 else
-$(eval $(call 
gb_ExternalPackage_add_file,lcms2,$(LIBO_LIB_FOLDER)/liblcms2.so.2,src/.libs/liblcms2.so.2.0.15))
+$(eval $(call 
gb_ExternalPackage_add_file,lcms2,$(LIBO_LIB_FOLDER)/liblcms2.so.2,src/.libs/liblcms2.so.2.0.16))
 endif
 endif # $(DISABLE_DYNLOADING)
 
diff --git a/external/lcms2/UnpackedTarball_lcms2.mk 
b/external/lcms2/UnpackedTarball_lcms2.mk
index 28b30ef3acee..745da1a0a782 100644
--- a/external/lcms2/UnpackedTarball_lcms2.mk
+++ b/external/lcms2/UnpackedTarball_lcms2.mk
@@ -15,10 +15,12 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,lcms2))
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,lcms2,3))
 
+# external/lcms2/0001-Added-missing-export.patch.1:
+# backport of 
https://github.com/mm2/Little-CMS/commit/f7b3c637c20508655f8b49935a4b556d52937b69
 $(eval $(call gb_UnpackedTarball_add_patches,lcms2,\
+       external/lcms2/0001-Added-missing-export.patch.1 \
        external/lcms2/lcms2-2.4-windows.patch \
        external/lcms2/lcms2-windows_aarch64_outdir.patch.1 \
-       external/lcms2/c++17.patch.1 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/lcms2/c++17.patch.1 b/external/lcms2/c++17.patch.1
deleted file mode 100644
index dc5b2ccde46c..000000000000
--- a/external/lcms2/c++17.patch.1
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/include/lcms2.h b/include/lcms2.h
-index cf52014..926e2a0 100644
---- a/include/lcms2.h
-+++ b/include/lcms2.h
-@@ -62,7 +62,7 @@
- // #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
- 
- // Uncomment this to remove the "register" storage class
--// #define CMS_NO_REGISTER_KEYWORD 1
-+#define CMS_NO_REGISTER_KEYWORD 1
- 
- // ********** End of configuration toggles ******************************
- 

Reply via email to