Bug 154880

Summary: FILEOPEN PPTX Blue line missing from image
Product: LibreOffice Reporter: Gabor Kelemen (allotropia) <kelemeng>
Component: ImpressAssignee: Bartosz <gang65>
Status: ASSIGNED ---    
Severity: normal CC: gang65
Priority: medium Keywords: bibisected, bisected, regression
Version: 7.0.0.3 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=113163
https://bugs.documentfoundation.org/show_bug.cgi?id=119884
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 139902    
Attachments: The example file in PP 2016 and Impress master
The image extracted from the pptx, then opened in Draw

Description Gabor Kelemen (allotropia) 2023-04-18 11:01:14 UTC
Created attachment 186755 [details]
The example file in PP 2016 and Impress master

This is a followup to bug 119884

1. Open attachment 176522 [details]
2. Compare to how it looks in PP

-> blue line is missing from the chart image

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: fc6806c4be8585ce0d35a6b581bf8b3dbf858500
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

Bibisected to:
https://git.libreoffice.org/core/+/560f8935c3b9d854128d414753f871fa38c6da2a

author	Bartosz Kosiorek <gang65@poczta.onet.pl>	Tue Nov 03 16:48:08 2020 +0100
committer	Xisco Fauli <xiscofauli@libreoffice.org>	Thu Nov 19 12:41:06 2020 +0100

tdf#113163 OOXML Fix transparency and alpha channel support
Comment 1 Gabor Kelemen (allotropia) 2023-04-18 11:03:13 UTC
Created attachment 186756 [details]
The image extracted from the pptx, then opened in Draw

When the image is extracted from the pptx and opened in Draw the blue line is visible.
Comment 2 Bartosz 2023-04-19 08:05:05 UTC
The color change inside the white-transparent.pptx (in slide1.xml) is:

    <p:blipFill>
        <a:blip r:embed="rId2" cstate="print">
            <a:clrChange>
                <a:clrFrom>
                    <a:srgbClr val="FFFFFF"/>
                </a:clrFrom>
                <a:clrTo>
                    <a:srgbClr val="FFFFFF">
                        <a:alpha val="0"/>
                    </a:srgbClr>
                </a:clrTo>
            </a:clrChange> 

More information about clrChange:
https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/5860f816-13d3-4a83-9e63-bcd1e0808404

In method: `SAL_CALL Graphic::colorChange`
there is check for alpha ` if (aBitmapEx.IsAlpha())`
which is not working correctly
Comment 3 Bartosz 2023-04-19 20:06:48 UTC
The root cause of blue color is missing is `BitmapColor::GetIndex()` method which is taking blue color:


inline sal_uInt8 BitmapColor::GetIndex() const
{
    return GetBlue();
}

inline void BitmapColor::SetIndex( sal_uInt8 cIndex )
{
    SetBlue(cIndex);
}

Here:
https://git.libreoffice.org/core/+/refs/heads/libreoffice-7-5-3/include/vcl/BitmapColor.hxx#72

It is then used in:

    const sal_uInt8 cIndexFrom = aBmpColorFrom.GetIndex();

here:
https://git.libreoffice.org/core/+/refs/heads/libreoffice-7-5-3/vcl/source/graphic/UnoGraphic.cxx#204