summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörgvin Ragnarsson <nifgraup@gmail.com>2013-10-04 01:21:56 +0300
committerCaolán McNamara <caolanm@redhat.com>2013-10-07 13:31:43 +0000
commitf3123d396c8f7f175551a9bab8bc232efe602083 (patch)
treef4b0f6be7615251cee5448222ef05e86a175bdcd
parentdf1076965f63eedc6cc104c96b993ab598b8b1d4 (diff)
EPS import: convert to BMP instead of PNG
This speeds up rendering of EPS figures by approximately 10% Change-Id: Ie7d39bab4a7ea5f9350f989c25364f70bd8b8453 Reviewed-on: https://gerrit.libreoffice.org/6124 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--filter/source/graphicfilter/ieps/ieps.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx
index a85294dabac2..61473f6925f8 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -245,7 +245,7 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r
return bRet;
}
-static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+static bool RenderAsBMPThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
Graphic &rGraphic, OUString &rProgName, rtl_uString *pArgs[], size_t nArgs)
{
oslProcess aProcess;
@@ -276,7 +276,7 @@ static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea
aMemStm.Seek(0);
if (
aMemStm.GetEndOfData() &&
- GraphicConverter::Import(aMemStm, rGraphic, CVT_PNG) == ERRCODE_NONE
+ GraphicConverter::Import(aMemStm, rGraphic, CVT_BMP) == ERRCODE_NONE
)
{
MakeAsMeta(rGraphic);
@@ -290,7 +290,7 @@ static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea
return bRet;
}
-static bool RenderAsPNGThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+static bool RenderAsBMPThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
Graphic &rGraphic)
{
OUString fileName("convert" EXESUFFIX);
@@ -301,17 +301,17 @@ static bool RenderAsPNGThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRe
OUString arg2("300x300");
// read eps from STDIN
OUString arg3("eps:-");
- // write png to STDOUT
- OUString arg4("png:-");
+ // write bmp to STDOUT
+ OUString arg4("bmp:-");
rtl_uString *args[] =
{
arg1.pData, arg2.pData, arg3.pData, arg4.pData
};
- return RenderAsPNGThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args,
+ return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args,
sizeof(args)/sizeof(rtl_uString *));
}
-static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
+static bool RenderAsBMPThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
Graphic &rGraphic)
{
#ifdef WNT
@@ -327,7 +327,7 @@ static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
OUString arg6("-dTextAlphaBits=4");
OUString arg7("-dGraphicsAlphaBits=4");
OUString arg8("-r300x300");
- OUString arg9("-sDEVICE=png256");
+ OUString arg9("-sDEVICE=bmp256");
OUString arg10("-sOutputFile=-");
OUString arg11("-");
rtl_uString *args[] =
@@ -336,16 +336,16 @@ static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
arg6.pData, arg7.pData, arg8.pData, arg9.pData, arg10.pData,
arg11.pData
};
- return RenderAsPNGThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args,
+ return RenderAsBMPThroughHelper(pBuf, nBytesRead, rGraphic, fileName, args,
sizeof(args)/sizeof(rtl_uString *));
}
-static bool RenderAsPNG(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic)
+static bool RenderAsBMP(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic)
{
- if (RenderAsPNGThroughGS(pBuf, nBytesRead, rGraphic))
+ if (RenderAsBMPThroughGS(pBuf, nBytesRead, rGraphic))
return true;
else
- return RenderAsPNGThroughConvert(pBuf, nBytesRead, rGraphic);
+ return RenderAsBMPThroughConvert(pBuf, nBytesRead, rGraphic);
}
// this method adds a replacement action containing the original wmf or tiff replacement,
@@ -679,7 +679,7 @@ GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConfigItem*, sal_Boo
{
bHasPreview = RenderAsEMF(pBuf, nBytesRead, aGraphic);
if (!bHasPreview)
- bHasPreview = RenderAsPNG(pBuf, nBytesRead, aGraphic);
+ bHasPreview = RenderAsBMP(pBuf, nBytesRead, aGraphic);
}
// if there is no preview -> make a red box