[Libreoffice-commits] libmspub.git: 3 commits - src/lib
David Tardon
dtardon at redhat.com
Sat Jul 6 04:22:48 PDT 2013
src/lib/MSPUBCollector.cpp | 42 +++++++++++++++++++++---------------------
src/lib/MSPUBDocument.cpp | 13 +++----------
src/lib/MSPUBParser.cpp | 11 ++++++-----
3 files changed, 30 insertions(+), 36 deletions(-)
New commits:
commit 7a6889b490ca80db4115612b9e441d698374cac0
Author: David Tardon <dtardon at redhat.com>
Date: Sat Jul 6 12:55:25 2013 +0200
astyle
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index e002f93..6cad408 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -606,7 +606,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
writeImage(x, y, borderImgWidth, borderImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
if (iOffset + 1 != ba.m_offsets.end())
{
@@ -614,7 +614,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// top
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
@@ -624,8 +624,8 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
x + borderImgWidth + (iTop - 1) * stretchedImgWidth :
x + iTop * (borderImgWidth + borderHorizPadding);
writeImage(imgX, y,
- borderImgWidth, stretchedImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ borderImgWidth, stretchedImgWidth,
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
}
if (iOffset + 1 != ba.m_offsets.end())
@@ -634,13 +634,13 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// top right
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
writeImage(x + width - borderImgWidth, y,
- borderImgWidth, borderImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ borderImgWidth, borderImgWidth,
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
if (iOffset + 1 != ba.m_offsets.end())
{
@@ -648,7 +648,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// right
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
@@ -658,9 +658,9 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
y + borderImgWidth + (iRight - 1) * stretchedImgHeight :
y + iRight * (borderImgWidth + borderVertPadding);
writeImage(x + width - borderImgWidth,
- imgY,
- stretchedImgHeight, borderImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ imgY,
+ stretchedImgHeight, borderImgWidth,
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
}
if (iOffset + 1 != ba.m_offsets.end())
@@ -669,14 +669,14 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// bottom right
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
writeImage(x + width - borderImgWidth,
- y + height - borderImgWidth,
- borderImgWidth, borderImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ y + height - borderImgWidth,
+ borderImgWidth, borderImgWidth,
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
if (iOffset + 1 != ba.m_offsets.end())
{
@@ -684,7 +684,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// bottom
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
@@ -705,13 +705,13 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// bottom left
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
writeImage(x, y + height - borderImgWidth,
- borderImgWidth, borderImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ borderImgWidth, borderImgWidth,
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
if (iOffset + 1 != ba.m_offsets.end())
{
@@ -719,7 +719,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
// left
iOrdOff = find(ba.m_offsetsOrdered.begin(),
- ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
+ ba.m_offsetsOrdered.end(), *iOffset) - ba.m_offsetsOrdered.begin();
if (iOrdOff < ba.m_images.size())
{
const BorderImgInfo &bi = ba.m_images[iOrdOff];
@@ -730,7 +730,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
y + height - borderImgWidth -
iLeft * (borderImgWidth + borderVertPadding);
writeImage(x, imgY, stretchedImgHeight, borderImgWidth,
- bi.m_type, bi.m_imgBlob, oneBitColor);
+ bi.m_type, bi.m_imgBlob, oneBitColor);
}
}
}
commit fad540e1d43c95b7173c8ddb7bb81e4ab5c9f21a
Author: David Tardon <dtardon at redhat.com>
Date: Sat Jul 6 12:54:29 2013 +0200
the extra variable is not needed
diff --git a/src/lib/MSPUBDocument.cpp b/src/lib/MSPUBDocument.cpp
index f2f8668..e4ed768 100644
--- a/src/lib/MSPUBDocument.cpp
+++ b/src/lib/MSPUBDocument.cpp
@@ -145,21 +145,14 @@ bool libmspub::MSPUBDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInt
{
boost::scoped_ptr<WPXInputStream> quillStream(input->getDocumentOLEStream("Quill/QuillSub/CONTENTS"));
if (!quillStream)
- {
- boost::scoped_ptr<MSPUBParser> tmp(new MSPUBParser97(input, &collector));
- parser.swap(tmp);
- }
+ parser.reset(new MSPUBParser97(input, &collector));
else
- {
- boost::scoped_ptr<MSPUBParser> tmp(new MSPUBParser2k(input, &collector));
- parser.swap(tmp);
- }
+ parser.reset(new MSPUBParser2k(input, &collector));
break;
}
case MSPUB_2K2:
{
- boost::scoped_ptr<MSPUBParser> tmp(new MSPUBParser(input, &collector));
- parser.swap(tmp);
+ parser.reset(new MSPUBParser(input, &collector));
break;
}
default:
commit d0a51bca47dd4b4c23c17dcf332f9f3831dd049f
Author: David Tardon <dtardon at redhat.com>
Date: Sat Jul 6 12:34:36 2013 +0200
only compute image type once
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 73a2c40..a812ea9 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -250,11 +250,12 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
while (stillReading (input, (unsigned long)-1))
{
EscherContainerInfo info = parseEscherContainer(input);
- if (imgTypeByBlipType(info.type) != UNKNOWN)
+ const ImgType imgType = imgTypeByBlipType(info.type);
+ if (imgType != UNKNOWN)
{
WPXBinaryData img;
unsigned long toRead = info.contentsLength;
- input->seek(input->tell() + getStartOffset(imgTypeByBlipType(info.type), info.initial), WPX_SEEK_SET);
+ input->seek(input->tell() + getStartOffset(imgType, info.initial), WPX_SEEK_SET);
while (toRead > 0 && stillReading(input, (unsigned long)-1))
{
unsigned long howManyRead = 0;
@@ -262,11 +263,11 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
img.append(buf, howManyRead);
toRead -= howManyRead;
}
- if (imgTypeByBlipType(info.type) == WMF || imgTypeByBlipType(info.type) == EMF)
+ if (imgType == WMF || imgType == EMF)
{
img = inflateData(img);
}
- else if (imgTypeByBlipType(info.type) == DIB)
+ else if (imgType == DIB)
{
// Reconstruct BMP header
// cf. http://en.wikipedia.org/wiki/BMP_file_format , accessed 2012-5-31
@@ -312,7 +313,7 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
tmpImg.append(img);
img = tmpImg;
}
- m_collector->addImage(++m_lastAddedImage, imgTypeByBlipType(info.type), img);
+ m_collector->addImage(++m_lastAddedImage, imgType, img);
}
else
{
More information about the Libreoffice-commits
mailing list