From: Fridrich S. <str...@us...> - 2008-11-28 12:26:30
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28309/src/lib Modified Files: WPG1Parser.cpp WPG2Parser.cpp WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h Log Message: joining all the style related callback into one since we are calling them together Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- WPGPaintInterface.h 28 Nov 2008 11:53:03 -0000 1.16 +++ WPGPaintInterface.h 28 Nov 2008 12:25:45 -0000 1.17 @@ -41,11 +41,7 @@ // none of the other callback functions will be called before this function is called virtual void startGraphics(const ::WPXPropertyList &propList) = 0; - virtual void setPen(const WPGPen& pen) = 0; - - virtual void setBrush(const WPGBrush& brush) = 0; - - virtual void setFillRule(const ::WPXPropertyList &propList) = 0; + virtual void setStyle(const WPGPen& pen, const WPGBrush& brush, const ::WPXPropertyList &propList) = 0; virtual void startLayer(const ::WPXPropertyList& propList) = 0; Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -u -d -r1.88 -r1.89 --- WPG2Parser.cpp 28 Nov 2008 11:53:03 -0000 1.88 +++ WPG2Parser.cpp 28 Nov 2008 12:25:45 -0000 1.89 @@ -608,14 +608,14 @@ return; WPGGroupContext& context = m_groupStack.top(); - m_painter->setBrush( context.compoundFilled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( context.compoundFramed ? m_pen : libwpg::WPGPen() ); ::WPXPropertyList fillRule; if(context.compoundWindingRule) fillRule.insert("svg:fill-rule", "nonzero"); else fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setFillRule(fillRule); + + m_painter->setStyle( context.compoundFramed ? m_pen : libwpg::WPGPen(), context.compoundFilled ? m_brush : libwpg::WPGBrush(), fillRule ); + if (context.compoundClosed) { WPXPropertyList element; @@ -1192,14 +1192,12 @@ else { // otherwise draw directly - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); ::WPXPropertyList fillRule; if(objCh.windingRule) fillRule.insert("svg:fill-rule", "nonzero"); else fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setFillRule(fillRule); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); if (objCh.filled || objCh.closed) m_painter->drawPolygon(points); else @@ -1287,14 +1285,12 @@ else { // otherwise draw directly - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); ::WPXPropertyList fillRule; if(objCh.windingRule) fillRule.insert("svg:fill-rule", "nonzero"); else fillRule.insert("svg:fill-rule", "evenodd"); - m_painter->setFillRule(fillRule); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), fillRule ); m_painter->drawPath(path); } } @@ -1332,8 +1328,7 @@ propList.insert("svg:rx", (float)(TO_DOUBLE(rx)/m_xres)); propList.insert("svg:ry", (float)(TO_DOUBLE(ry)/m_yres)); - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::WPXPropertyList() ); m_painter->drawRectangle(propList); WPG_DEBUG_MSG((" X1 : %li\n", x1)); @@ -1375,8 +1370,7 @@ if (objCh.rotate) propList.insert("libwpg:rotate", (float)(objCh.rotationAngle)); - m_painter->setBrush( objCh.filled ? m_brush : libwpg::WPGBrush() ); - m_painter->setPen( objCh.framed ? m_pen : libwpg::WPGPen() ); + m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::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) */); Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- WPG1Parser.cpp 28 Nov 2008 11:53:03 -0000 1.52 +++ WPG1Parser.cpp 28 Nov 2008 12:25:45 -0000 1.53 @@ -373,8 +373,8 @@ point.insert("svg:y", (float)((double)(m_height-ey)/1200.0)); points.append(point); - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Line\n")); @@ -400,8 +400,8 @@ points.append(point); } - m_painter->setBrush(libwpg::WPGBrush()); // not filled - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, libwpg::WPGBrush(),::WPXPropertyList()); + m_painter->drawPolyline(points); WPG_DEBUG_MSG(("Polyline\n")); @@ -423,8 +423,8 @@ propList.insert("svg:width", (float)((double)w/1200.0)); propList.insert("svg:height",(float)((double)h/1200.0)); - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawRectangle(propList); WPG_DEBUG_MSG(("Line\n")); @@ -451,8 +451,8 @@ points.append(point); } - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawPolygon(points); WPG_DEBUG_MSG(("Polygon\n")); @@ -475,8 +475,8 @@ int endAngle = readS16(); unsigned flags = readU16(); #endif - m_painter->setBrush(m_brush); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawEllipse(propList); WPG_DEBUG_MSG(("Ellipse\n")); @@ -496,7 +496,6 @@ ::WPXPropertyListVector path; ::WPXPropertyList element; - bool path_closed = false; long xInitial = readS16(); long yInitial = readS16(); element.insert("libwpg:path-action", "M"); @@ -523,8 +522,8 @@ } - m_painter->setBrush(path_closed ? m_brush : libwpg::WPGBrush()); - m_painter->setPen(m_pen); + m_painter->setStyle(m_pen, m_brush,::WPXPropertyList()); + m_painter->drawPath(path); WPG_DEBUG_MSG(("Curved Polyline\n")); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- WPGSVGGenerator.h 28 Nov 2008 11:53:03 -0000 1.16 +++ WPGSVGGenerator.h 28 Nov 2008 12:25:45 -0000 1.17 @@ -47,9 +47,7 @@ void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} void endEmbeddedGraphics() {} - void setPen(const libwpg::WPGPen& pen); - void setBrush(const libwpg::WPGBrush& brush); - void setFillRule(const ::WPXPropertyList &propList); + void setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList); void drawRectangle(const ::WPXPropertyList& propList); void drawEllipse(const ::WPXPropertyList& propList); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- WPGSVGGenerator.cpp 28 Nov 2008 11:53:03 -0000 1.22 +++ WPGSVGGenerator.cpp 28 Nov 2008 12:25:45 -0000 1.23 @@ -79,13 +79,10 @@ m_outputSink << "</svg>\n"; } -void libwpg::WPGSVGGenerator::setPen(const libwpg::WPGPen& pen) +void libwpg::WPGSVGGenerator::setStyle(const libwpg::WPGPen& pen, const libwpg::WPGBrush& brush, const ::WPXPropertyList &propList) { m_pen = pen; -} -void libwpg::WPGSVGGenerator::setBrush(const libwpg::WPGBrush& brush) -{ m_brush = brush; if(m_brush.style == libwpg::WPGBrush::Gradient) @@ -129,11 +126,9 @@ m_outputSink << "</defs>\n"; } -} -void libwpg::WPGSVGGenerator::setFillRule(const ::WPXPropertyList &propList) -{ m_fillRule = propList; + } void libwpg::WPGSVGGenerator::startLayer(const ::WPXPropertyList& propList) |