summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2011-01-11 01:45:43 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-01-11 01:45:43 +0100
commit9c97fb5cca80ea7597368b3115962ee7d41bdcda (patch)
treea97cc5d1a4e157d6ea5aeabfd4e4c5b4d2ee4e3d
parent144d5f96cdf90d3b2197bbe36ef3258728ba53f1 (diff)
Remove some cruft in PictImage class that came from libwpg
-rw-r--r--src/lib/PictImage.cpp21
-rw-r--r--src/lib/PictImage.h6
2 files changed, 10 insertions, 17 deletions
diff --git a/src/lib/PictImage.cpp b/src/lib/PictImage.cpp
index f23a475..58ca465 100644
--- a/src/lib/PictImage.cpp
+++ b/src/lib/PictImage.cpp
@@ -38,7 +38,7 @@
Analyzes the content of an input stream to see if it can be parsed
\param input The input stream
\return A value that indicates whether the content from the input
-stream is a WordPerfect Graphics that libpict is able to parse
+stream is a Macintosh Pict Image that libpict is able to parse
*/
bool libpict::PictImage::isSupported(WPXInputStream* input)
{
@@ -53,34 +53,29 @@ bool libpict::PictImage::isSupported(WPXInputStream* input)
/**
Parses the input stream content. It will make callbacks to the functions provided by a
-PictPaintInterface class implementation when needed. This is often commonly called the
+WPGPaintInterface class implementation when needed. This is often commonly called the
'main parsing routine'.
\param input The input stream
-\param painter A PictPainterInterface implementation
+\param painter A WPGPainterInterface implementation
\return A value that indicates whether the parsing was successful
*/
-bool libpict::PictImage::parse(::WPXInputStream* input, libwpg::WPGPaintInterface* painter, libpict::PictFileFormat fileFormat)
+bool libpict::PictImage::parse(::WPXInputStream* input, libwpg::WPGPaintInterface* painter)
{
PictXParser *parser = 0;
input->seek(0, WPX_SEEK_SET);
PICT_DEBUG_MSG(("Loading header...\n"));
- unsigned char tmpMajorVersion = 0x00;
- if (fileFormat == Pict_Pict1)
- tmpMajorVersion = 0x01;
- else if (fileFormat == Pict_Pict2)
- tmpMajorVersion = 0x02;
PictHeader header;
if(!header.load(input))
return false;
// seek to the start of document
input->seek(header.startOfDocument(), WPX_SEEK_SET);
- tmpMajorVersion = (unsigned char)(header.getVersion());
+ tmpVersion = header.getVersion();
bool retval;
- switch (tmpMajorVersion) {
+ switch (tmpVersion) {
case 0x01: // Pict1
PICT_DEBUG_MSG(("Parsing Pict1\n"));
parser = new Pict1Parser(input, painter);
@@ -109,11 +104,11 @@ Provided as a convenience function for applications that support SVG internally.
\param output The output string whose content is the resulting SVG
\return A value that indicates whether the SVG generation was successful.
*/
-bool libpict::PictImage::generateSVG(::WPXInputStream* input, WPXString& output, libpict::PictFileFormat fileFormat)
+bool libpict::PictImage::generateSVG(::WPXInputStream* input, WPXString& output)
{
std::ostringstream tmpOutputStream;
libpict::PictSVGGenerator generator(tmpOutputStream);
- bool result = libpict::PictImage::parse(input, &generator, fileFormat);
+ bool result = libpict::PictImage::parse(input, &generator);
if (result)
output = WPXString(tmpOutputStream.str().c_str());
else
diff --git a/src/lib/PictImage.h b/src/lib/PictImage.h
index 56d6f1b..56bdcd7 100644
--- a/src/lib/PictImage.h
+++ b/src/lib/PictImage.h
@@ -33,17 +33,15 @@
namespace libpict
{
-enum PictFileFormat { Pict_AUTODETECT = 0, Pict_Pict1, Pict_Pict2 };
-
class PictImage
{
public:
static bool isSupported(WPXInputStream* input);
- static bool parse(WPXInputStream* input, libwpg::WPGPaintInterface* painter, PictFileFormat fileFormat = Pict_AUTODETECT);
+ static bool parse(WPXInputStream* input, libwpg::WPGPaintInterface* painter);
- static bool generateSVG(WPXInputStream* input, WPXString& output, PictFileFormat fileFormat = Pict_AUTODETECT);
+ static bool generateSVG(WPXInputStream* input, WPXString& output);
};
} // namespace libpict