Update of /cvsroot/libwpg/libwpg/src/lib
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv27434/src/lib
Modified Files:
WPG2Parser.cpp
Log Message:
Fix some issues with styles output
Index: WPG2Parser.cpp
===================================================================
RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- WPG2Parser.cpp 3 Jun 2010 08:02:03 -0000 1.101
+++ WPG2Parser.cpp 4 Jun 2010 09:01:38 -0000 1.102
@@ -1012,7 +1012,7 @@
std::vector<double> positions;
WPG_DEBUG_MSG((" Gradient colors : %d\n", count));
- if (count > 0) // try not to run into signedness/unsignedness issues in second for cycle
+ if (count > 0)
{
for(unsigned i = 0; i < count; i++)
{
@@ -1105,22 +1105,25 @@
std::vector<double> positions;
WPG_DEBUG_MSG((" Gradient colors : %d\n", count));
- for(unsigned i = 0; i < count; i++)
+ if (count > 0)
{
- unsigned char red = (m_doublePrecision) ? readU16()>>8 : readU8();
- unsigned char green = (m_doublePrecision) ? readU16()>>8 : readU8();
- unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8();
- unsigned char alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8();
- libwpg::WPGColor color(red, green, blue, alpha);
- colors.push_back(color);
- WPG_DEBUG_MSG((" Color #%d (RGBA): %d %d %d %d\n", i+1, red, green, blue, alpha));
- }
+ for(unsigned i = 0; i < count; i++)
+ {
+ unsigned char red = (m_doublePrecision) ? readU16()>>8 : readU8();
+ unsigned char green = (m_doublePrecision) ? readU16()>>8 : readU8();
+ unsigned char blue = (m_doublePrecision) ? readU16()>>8 : readU8();
+ unsigned char alpha = 0xff - (m_doublePrecision) ? readU16()>>8 : readU8();
+ libwpg::WPGColor color(red, green, blue, alpha);
+ colors.push_back(color);
+ WPG_DEBUG_MSG((" Color #%d (RGBA): %d %d %d %d\n", i+1, red, green, blue, alpha));
+ }
- for(unsigned j = 0; j < count-1; j++)
- {
- unsigned pos = readU16();
- positions.push_back(TO_DOUBLE(pos));
- WPG_DEBUG_MSG((" Position #%d : %d\n", j+1, pos));
+ for(unsigned j = 0; j < count-1; j++)
+ {
+ unsigned pos = readU16();
+ positions.push_back(TO_DOUBLE(pos));
+ WPG_DEBUG_MSG((" Position #%d : %d\n", j+1, pos));
+ }
}
// looks like Corel Presentations only create 2 colors gradient
@@ -1507,7 +1510,7 @@
propList.insert("svg:rx", (TO_DOUBLE(rx)/m_xres));
propList.insert("svg:ry", (TO_DOUBLE(ry)/m_yres));
- m_painter->setStyle( objCh.filled ? m_gradient : ::WPXPropertyListVector(), ::WPXPropertyList() );
+ m_painter->setStyle( objCh.filled ? m_gradient : ::WPXPropertyListVector(), m_style );
m_painter->drawRectangle(propList);
WPG_DEBUG_MSG((" X1 : %li\n", x1));
@@ -1549,9 +1552,8 @@
if (objCh.rotate)
propList.insert("libwpg:rotate", (double)(objCh.rotationAngle));
- m_painter->setStyle( objCh.filled ? m_gradient : ::WPXPropertyListVector(), ::WPXPropertyList() );
- m_painter->drawEllipse(propList /* TODO: fix this: libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres),
- libwpg::WPGPoint((double)ex/m_xres, (double)ey/m_yres) */);
+ m_painter->setStyle( objCh.filled ? m_gradient : ::WPXPropertyListVector(), m_style );
+ m_painter->drawEllipse(propList);
WPG_DEBUG_MSG((" Center point x : %li\n", cx));
WPG_DEBUG_MSG((" Center point y : %li\n", cy));
|