Kaydet (Commit) 6af1637d authored tarafından Miklos Vajna's avatar Miklos Vajna

sw HTML export: fix writing transparent images

It is possible ImpGraphic::ImplSetPrepared() should handle this
directly, though.

Change-Id: I1a020a45eaded140493d7207f8e0e0dfe551cc88
Reviewed-on: https://gerrit.libreoffice.org/57623
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 563fe608
...@@ -589,6 +589,17 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html") ...@@ -589,6 +589,17 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html")
CPPUNIT_ASSERT(aStream.indexOf("<li>") != -1); CPPUNIT_ASSERT(aStream.indexOf("<li>") != -1);
} }
DECLARE_HTMLEXPORT_TEST(testTransparentImage, "transparent-image.odt")
{
htmlDocPtr pDoc = parseHtml(maTempFile);
CPPUNIT_ASSERT(pDoc);
OUString aSource = getXPath(pDoc, "/html/body/p/img", "src");
OUString aMessage = "src attribute is: " + aSource;
// This was a jpeg, transparency was lost.
CPPUNIT_ASSERT_MESSAGE(aMessage.toUtf8().getStr(), aSource.endsWith(".gif"));
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -1840,7 +1840,13 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF ...@@ -1840,7 +1840,13 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF
aMimeType = "image/png"; aMimeType = "image/png";
} }
ErrCode nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), aGraphicURL, const Graphic& rGraphic = pGrfNd->GetGrf();
// So that Graphic::IsTransparent() can report true.
if (!rGraphic.isAvailable())
const_cast<Graphic&>(rGraphic).makeAvailable();
ErrCode nErr = XOutBitmap::WriteGraphic( rGraphic, aGraphicURL,
aFilterName, nFlags, &aMM100Size ); aFilterName, nFlags, &aMM100Size );
if( nErr ) if( nErr )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment