Bug 102997 - FILEOPEN: Error in OOXML Transparency Conversion Math
Summary: FILEOPEN: Error in OOXML Transparency Conversion Math
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0 target:5.2.4
Keywords:
Depends on:
Blocks: OOXML-Object-Fill
  Show dependency treegraph
 
Reported: 2016-10-05 04:24 UTC by Luke
Modified: 2017-05-03 17:23 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of the Bug (72.79 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-10-05 04:26 UTC, Luke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke 2016-10-05 04:24:52 UTC
User-Agent:       Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36
Build Identifier: 349f4923e265d76cfd76627796dc93e99e0b5d02

Miklos,
Looks like there's an error in your transparency conversion math. 70 -> 30 and 30 -> 70. 

https://cgit.freedesktop.org/libreoffice/core/commit/?id=ecfcee8b05e45ec82dec6ed417e9ac53d4d7b4ff


Reproducible: Always

Steps to Reproduce:
1. Create a file with transparency in MSO
2. Save
3. Open in LO
Actual Results:  
the complement of the transparency ( 1-transparency)

Expected Results:  
same transparency.





Reset User Profile?No
Comment 1 Luke 2016-10-05 04:26:52 UTC
Created attachment 127815 [details]
Example of the Bug

The transparency calculation only works for .5 ( 1-.5=.5). Other values give the complement. .7 -> .3.
Comment 2 Luke 2016-10-06 03:17:38 UTC
Miklos,

--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -655,7 +655,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                     }

                     if (maBlipProps.moAlphaModFix.has())
-                        rPropMap.setProperty(ShapeProperty::FillTransparency, static_cast<sal_Int16>(maBlipProps.moAlphaModFix.get() / PER_PERCENT));
+                        rPropMap.setProperty(ShapeProperty::FillTransparency, static_cast<sal_Int16>(100 - (maBlipProps.moAlphaModFix.get() / PER_PERCENT)));
                 }
             break;



Fixed the import conversion. 


Is the right place to do the conversion? Do you need to use const like PER_PERCENT or is 100 OK here? Can you take care of applying this fix or do you want me to submit a patch?
Comment 3 Miklos Vajna 2016-10-06 06:43:02 UTC
Best if you submit to gerrit, along with a matching testcase. Based on testTdf100830 in sw/qa/extras/ooxmlimport/ooxmlimport.cxx, hopefully you can add a new test easily.

If needed, of course I can help. :-)
Comment 4 Commit Notification 2016-10-07 07:10:01 UTC
lbenes committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ade43e6a86e4f864e771f4b3008a428bc10fa55f

tdf#102997 Fix Error in OOXML Transparency Conversion Math

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2016-10-14 16:19:54 UTC
lbenes committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=24998064599e3371208ad8ae4b149d754828d35b&h=libreoffice-5-2

tdf#102997 Fix Error in OOXML Transparency Conversion Math

It will be available in 5.2.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.