summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/fillproperties.cxx30
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport7.cxx2
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--writerfilter/source/dmapper/GraphicImport.cxx5
4 files changed, 21 insertions, 18 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 1302a07e2a8c..6879896b6e1e 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -696,17 +696,29 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
{
sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 );
sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 );
+ ColorMode eColorMode = ColorMode_STANDARD;
+
+ switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) )
+ {
+ case XML_biLevel: eColorMode = ColorMode_MONO; break;
+ case XML_grayscl: eColorMode = ColorMode_GREYS; break;
+ }
+
if( maBlipProps.mxGraphic.is() )
{
// created transformed graphic
Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr );
xGraphic = lclCheckAndApplyChangeColorTransform( maBlipProps, xGraphic, rGraphicHelper, nPhClr );
- // MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness,
- // while MSO apparently applies half of brightness before contrast and half after. So if only
- // contrast or brightness need to be altered, the result is the same, but if both are involved,
- // there's no way to map that, so just force a conversion of the image.
- if( nBrightness != 0 && nContrast != 0 )
+
+ if (eColorMode == ColorMode_STANDARD && nBrightness == 70 && nContrast == -70)
+ // map MSO 'washout' to our Watermark colormode
+ eColorMode = ColorMode_WATERMARK;
+ else if( nBrightness != 0 && nContrast != 0 )
{
+ // MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness,
+ // while MSO apparently applies half of brightness before contrast and half after. So if only
+ // contrast or brightness need to be altered, the result is the same, but if both are involved,
+ // there's no way to map that, so just force a conversion of the image.
xGraphic = applyBrightnessContrast( xGraphic, nBrightness, nContrast );
nBrightness = 0;
nContrast = 0;
@@ -738,14 +750,6 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe
}
}
}
-
- // color effect
- ColorMode eColorMode = ColorMode_STANDARD;
- switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) )
- {
- case XML_biLevel: eColorMode = ColorMode_MONO; break;
- case XML_grayscl: eColorMode = ColorMode_GREYS; break;
- }
rPropMap.setProperty(PROP_GraphicColorMode, eColorMode);
// brightness and contrast
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 47b47b88837a..727d448102e8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -973,7 +973,7 @@ DECLARE_OOXMLEXPORT_TEST(testPictureColormodeWatermark, "picture_colormode_water
if (!pXmlDoc)
return;
- assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "bright", "50000");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "bright", "70000");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "contrast", "-70000");
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ddad77684409..710c862d75da 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4246,7 +4246,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
else if (nMode == GRAPHICDRAWMODE_MONO) //black/white has a 0,5 threshold in LibreOffice
m_pSerializer->singleElementNS (XML_a, XML_biLevel, XML_thresh, OString::number(50000), FSEND);
else if (nMode == GRAPHICDRAWMODE_WATERMARK) //watermark has a brightness/luminance of 0,5 and contrast of -0.7 in LibreOffice
- m_pSerializer->singleElementNS( XML_a, XML_lum, XML_bright, OString::number(50000), XML_contrast, OString::number(-70000), FSEND );
+ m_pSerializer->singleElementNS( XML_a, XML_lum, XML_bright, OString::number(70000), XML_contrast, OString::number(-70000), FSEND );
}
m_pSerializer->endElementNS( XML_a, XML_blip );
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 154b9e2bb137..1d9078d53270 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1286,14 +1286,13 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
m_pImpl->applyMargins(xGraphicObjectProperties);
}
- if( m_pImpl->eColorMode == drawing::ColorMode_STANDARD &&
+ if( m_pImpl->eColorMode == drawing::ColorMode_WATERMARK &&
m_pImpl->nContrast == -70 &&
m_pImpl->nBrightness == 70 )
{
- // strange definition of WATERMARK!
+ // watermark filter is already applied at this point, so reset Contrast and Brightness
m_pImpl->nContrast = 0;
m_pImpl->nBrightness = 0;
- m_pImpl->eColorMode = drawing::ColorMode_WATERMARK;
}
xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_ADJUST_CONTRAST ),