Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21256/src/lib Modified Files: WPG1Parser.cpp WPG1Parser.h WPG2Parser.cpp WPG2Parser.h WPGBrush.cpp WPGBrush.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: moving the brush style information out from the WPGBrush class (making the class meager so that it can be removed at one point) Index: WPGBrush.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- WPGBrush.h 4 Dec 2008 23:17:39 -0000 1.9 +++ WPGBrush.h 5 Dec 2008 00:53:49 -0000 1.10 @@ -35,7 +35,6 @@ class WPGBrush { public: - ::WPXString style; ::WPXString foreColor; ::WPXString backColor; double foreOpacity; @@ -45,8 +44,6 @@ WPGBrush(); - WPGBrush(const ::WPXString& brushStyle); - WPGBrush(const WPGBrush& brush); WPGBrush& operator=(const WPGBrush& brush); Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- WPG2Parser.h 3 Dec 2008 13:41:29 -0000 1.33 +++ WPG2Parser.h 5 Dec 2008 00:53:49 -0000 1.34 @@ -214,6 +214,7 @@ long m_width; long m_height; bool m_doublePrecision; + ::WPXPropertyList m_style; libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; std::map<unsigned int,libwpg::WPGDashArray> m_penStyles; Index: WPGBrush.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGBrush.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WPGBrush.cpp 4 Dec 2008 23:17:39 -0000 1.6 +++ WPGBrush.cpp 5 Dec 2008 00:53:49 -0000 1.7 @@ -26,16 +26,6 @@ #include "WPGBrush.h" libwpg::WPGBrush::WPGBrush(): - style("none"), - foreColor("#000000"), - backColor("#ffffff"), - foreOpacity(1.0), - backOpacity(1.0), - gradient() -{} - -libwpg::WPGBrush::WPGBrush(const ::WPXString& brushStyle): - style(brushStyle), foreColor("#000000"), backColor("#ffffff"), foreOpacity(1.0), @@ -44,7 +34,6 @@ {} libwpg::WPGBrush::WPGBrush(const WPGBrush& brush): - style(brush.style), foreColor(brush.foreColor), backColor(brush.backColor), foreOpacity(brush.foreOpacity), @@ -54,7 +43,6 @@ libwpg::WPGBrush& libwpg::WPGBrush::operator=(const libwpg::WPGBrush& brush) { - style = brush.style; foreColor = brush.foreColor; backColor = brush.backColor; foreOpacity = brush.foreOpacity; Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- WPGSVGGenerator.h 4 Dec 2008 10:16:18 -0000 1.18 +++ WPGSVGGenerator.h 5 Dec 2008 00:53:49 -0000 1.19 @@ -59,7 +59,7 @@ private: libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; - ::WPXPropertyList m_fillRule; + ::WPXPropertyList m_style; int m_gradientIndex; void writeStyle(bool isClosed=true); void drawPolySomething(const ::WPXPropertyListVector& vertices, bool isClosed); Index: WPG1Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- WPG1Parser.h 28 Nov 2008 11:53:03 -0000 1.20 +++ WPG1Parser.h 5 Dec 2008 00:53:49 -0000 1.21 @@ -73,6 +73,7 @@ bool m_graphicsStarted; int m_width; int m_height; + ::WPXPropertyList m_style; libwpg::WPGPen m_pen; libwpg::WPGBrush m_brush; }; Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- WPGSVGGenerator.cpp 4 Dec 2008 23:17:39 -0000 1.28 +++ WPGSVGGenerator.cpp 5 Dec 2008 00:53:49 -0000 1.29 @@ -47,7 +47,7 @@ } -libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_fillRule(), m_gradientIndex(1), m_outputSink(output_sink) +libwpg::WPGSVGGenerator::WPGSVGGenerator(std::ostream & output_sink): m_pen(libwpg::WPGPen()), m_brush(libwpg::WPGBrush()), m_style(), m_gradientIndex(1), m_outputSink(output_sink) { } @@ -85,7 +85,7 @@ m_brush = brush; - if(m_brush.style == "gradient") + if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient") { double angle = m_brush.gradient.angle(); @@ -129,7 +129,7 @@ m_outputSink << "</defs>\n"; } - m_fillRule = propList; + m_style = propList; } @@ -292,17 +292,17 @@ m_outputSink << "; "; } - if(!isClosed || m_brush.style == "none") + if(!isClosed || (m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none")) m_outputSink << "fill: none; "; else { - if(m_fillRule["svg:fill-rule"]) - m_outputSink << "fill-rule: " << m_fillRule["svg:fill-rule"]->getStr().cstr() << "; "; + if(m_style["svg:fill-rule"]) + m_outputSink << "fill-rule: " << m_style["svg:fill-rule"]->getStr().cstr() << "; "; - if(m_brush.style == "gradient") + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "gradient") m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - if(m_brush.style == "solid") + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "solid") m_outputSink << "fill: " << m_brush.foreColor.cstr() << "; "; } Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- WPG2Parser.cpp 4 Dec 2008 23:17:39 -0000 1.94 +++ WPG2Parser.cpp 5 Dec 2008 00:53:49 -0000 1.95 @@ -217,8 +217,9 @@ m_xofs(0), m_yofs(0), m_width(0), m_height(0), m_doublePrecision(false), + m_style(), m_pen(), - m_brush("solid"), + m_brush(), m_penStyles(), m_layerOpened(false), m_layerId(0), m_matrix(), @@ -247,6 +248,7 @@ m_brush.foreColor = "#000000"; m_brush.backColor = "#ffffff"; resetPalette(); + m_style.insert("draw:fill", "solid"); } bool WPG2Parser::parse() @@ -890,8 +892,8 @@ m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(!(m_brush.style == "gradient")) - m_brush.style = "solid"; + if(!m_style["draw:fill"] || m_style["draw:fill"]->getStr() != "gradient") + m_style.insert("draw:fill", "solid"); } else { @@ -937,7 +939,7 @@ if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; - m_brush.style = "gradient"; + m_style.insert("draw:fill", "gradient"); } } } @@ -961,8 +963,8 @@ m_brush.foreColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.foreOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(!(m_brush.style == "none")) - m_brush.style = "solid"; + if(!m_style["draw:fill"] || m_style["draw:fill"]->getStr() != "none") + m_style.insert("draw:fill", "solid"); } else { @@ -1005,7 +1007,7 @@ if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) gradient.addStop(1, colors[1].getColorString(), colors[1].getOpacity()); m_brush.gradient = gradient; - m_brush.style = "gradient"; + m_style.insert("draw:fill", "gradient"); } } } @@ -1023,8 +1025,8 @@ m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(m_brush.style == "none") - m_brush.style = "solid"; + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") + m_style.insert("draw:fill", "solid"); WPG_DEBUG_MSG((" Backround color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } @@ -1043,8 +1045,8 @@ m_brush.backColor = libwpg::WPGColor(red, green, blue, alpha).getColorString(); m_brush.backOpacity = libwpg::WPGColor(red, green, blue, alpha).getOpacity(); - if(m_brush.style == "none") - m_brush.style = "solid"; + if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") + m_style.insert("draw:fill", "solid"); WPG_DEBUG_MSG((" Background color (RGBA): %d %d %d %d\n", red, green, blue, alpha)); } Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- WPG1Parser.cpp 4 Dec 2008 23:17:39 -0000 1.56 +++ WPG1Parser.cpp 5 Dec 2008 00:53:49 -0000 1.57 @@ -141,9 +141,10 @@ WPGXParser(input, painter), m_recordLength(0), m_recordEnd(0), m_success(true), m_exit(false), m_graphicsStarted(false), - m_width(0), m_height(0), - m_pen(), m_brush("solid") + m_width(0), m_height(0), m_style(), + m_pen(), m_brush() { + m_style.insert("draw:fill", "solid"); } bool WPG1Parser::parse() @@ -322,9 +323,9 @@ unsigned char color = readU8(); if(style == 0) - m_brush.style = "none"; + m_style.insert("draw:fill", "none"); if(style == 1) - m_brush.style = "solid"; + m_style.insert("draw:fill", "solid"); m_brush.foreColor = m_colorPalette[color].getColorString(); m_brush.foreOpacity = m_colorPalette[color].getOpacity() |