From: Fridrich S. <str...@us...> - 2008-11-27 14:15:28
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3768/src/lib Modified Files: Makefile.am WPG1Parser.cpp WPG2Parser.cpp WPG2Parser.h WPGPaintInterface.h WPGSVGGenerator.cpp WPGSVGGenerator.h libwpg.h.in Removed Files: WPGPoint.cpp WPGPoint.h Log Message: removing another libwpg type: WPGPoint Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- WPG2Parser.h 25 Nov 2008 11:58:28 -0000 1.27 +++ WPG2Parser.h 27 Nov 2008 14:15:17 -0000 1.28 @@ -31,6 +31,7 @@ #include "WPGXParser.h" #include "WPGBrush.h" #include "WPGPen.h" +#include <libwpd/libwpd.h> #include <map> #include <stack> @@ -58,12 +59,12 @@ y = ry; } - libwpg::WPGPoint transform(const libwpg::WPGPoint& p) const + ::WPXPropertyList transformPoint(const ::WPXPropertyList& p) const { - libwpg::WPGPoint point; - point.x = element[0][0]*p.x + element[1][0]*p.y + element[2][0]; - point.y = element[0][1]*p.x + element[1][1]*p.y + element[2][1]; - return point; + ::WPXPropertyList propList; + propList.insert("svg:x", (float)(element[0][0]*p["svg:x"]->getFloat() + element[1][0]*p["svg:y"]->getFloat() + element[2][0])); + propList.insert("svg:y", (float)(element[0][1]*p["svg:x"]->getFloat() + element[1][1]*p["svg:y"]->getFloat() + element[2][1])); + return propList; } libwpg::WPGRect transform(const libwpg::WPGRect& r) const @@ -209,7 +210,7 @@ unsigned int m_layerId; WPG2TransformMatrix m_matrix; double m_gradientAngle; - libwpg::WPGPoint m_gradientRef; + ::WPXPropertyList m_gradientRef; std::stack<WPGGroupContext> m_groupStack; WPG2TransformMatrix m_compoundMatrix; bool m_compoundWindingRule; --- WPGPoint.h DELETED --- Index: WPG1Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG1Parser.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- WPG1Parser.cpp 25 Nov 2008 11:58:28 -0000 1.49 +++ WPG1Parser.cpp 27 Nov 2008 14:15:17 -0000 1.50 @@ -462,26 +462,22 @@ { if (!m_graphicsStarted) return; - int cx = readS16(); - int cy = readS16(); - int rx = readS16(); - int ry = readS16(); - double rotation = (double)readS16(); + + ::WPXPropertyList propList; + propList.insert("svg:cx", (float)((double)readS16()/1200.0)); + propList.insert("svg:cy", (float)((double)(m_height-readS16())/1200.0)); + propList.insert("svg:rx", (float)((double)readS16()/1200.0)); + propList.insert("svg:ry", (float)((double)readS16()/1200.0)); + propList.insert("libwpg:rotate", (float)readS16()); + #if 0 int beginAngle = readS16(); int endAngle = readS16(); unsigned flags = readU16(); #endif - libwpg::WPGPoint center; - center.x = (double)cx/1200.0; - center.y = (double)(m_height-cy)/1200.0; - - double radx = (double)rx/1200.0; - double rady = (double)ry/1200.0; - m_painter->setBrush(m_brush); m_painter->setPen(m_pen); - m_painter->drawEllipse(center, radx, rady, (double)rotation, libwpg::WPGPoint(), libwpg::WPGPoint()); + m_painter->drawEllipse(propList); WPG_DEBUG_MSG(("Ellipse\n")); WPG_DEBUG_MSG((" Center point: %d,%d\n", cx, cy)); Index: WPGSVGGenerator.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPGSVGGenerator.h 25 Nov 2008 11:58:28 -0000 1.12 +++ WPGSVGGenerator.h 27 Nov 2008 14:15:17 -0000 1.13 @@ -42,8 +42,8 @@ void startGraphics(const ::WPXPropertyList &propList); void endGraphics(); - void startLayer(unsigned int id); - void endLayer(unsigned int id); + void startLayer(const ::WPXPropertyList& propList); + void endLayer(); void startEmbeddedGraphics(const ::WPXPropertyList & /*propList*/) {} void endEmbeddedGraphics() {} @@ -52,7 +52,7 @@ void setFillRule(FillRule rule); void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry); - void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to); + void drawEllipse(const ::WPXPropertyList& propList); void drawPolyline(const ::WPXPropertyListVector& vertices); void drawPolygon(const ::WPXPropertyListVector& vertices); void drawPath(const ::WPXPropertyListVector& path); Index: WPGSVGGenerator.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGSVGGenerator.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- WPGSVGGenerator.cpp 25 Nov 2008 11:58:28 -0000 1.18 +++ WPGSVGGenerator.cpp 27 Nov 2008 14:15:17 -0000 1.19 @@ -136,12 +136,12 @@ m_fillRule = rule; } -void libwpg::WPGSVGGenerator::startLayer(unsigned int id) +void libwpg::WPGSVGGenerator::startLayer(const ::WPXPropertyList& propList) { - m_outputSink << "<g id=\"Layer" << id << "\" >\n"; + m_outputSink << "<g id=\"Layer" << propList["svg:id"]->getInt() << "\" >\n"; } -void libwpg::WPGSVGGenerator::endLayer(unsigned int) +void libwpg::WPGSVGGenerator::endLayer() { m_outputSink << "</g>\n"; } @@ -157,15 +157,17 @@ m_outputSink << "/>\n"; } -void libwpg::WPGSVGGenerator::drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& /* from */, const WPGPoint& /* to */) +void libwpg::WPGSVGGenerator::drawEllipse(const WPXPropertyList& propList) { m_outputSink << "<ellipse "; - m_outputSink << "cx=\"" << doubleToString(72*center.x) << "\" cy=\"" << doubleToString(72*center.y) << "\" "; - m_outputSink << "rx=\"" << doubleToString(72*rx) << "\" ry=\"" << doubleToString(72*ry) << "\" "; + m_outputSink << "cx=\"" << doubleToString(72*propList["svg:cx"]->getFloat()) << "\" cy=\"" << doubleToString(72*propList["svg:cy"]->getFloat()) << "\" "; + m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getFloat()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getFloat()) << "\" "; writeStyle(); - if (rotation != 0.0) - m_outputSink << " transform=\" translate(" << doubleToString(72*center.x) << ", " << doubleToString(72*center.y) - << ") rotate(" << doubleToString(-rotation) << ") translate(" << doubleToString(-72*center.x) << ", " << doubleToString(-72*center.y) + if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getFloat() != 0.0) + m_outputSink << " transform=\" translate(" << doubleToString(72*propList["svg:cx"]->getFloat()) << ", " << doubleToString(72*propList["svg:cy"]->getFloat()) + << ") rotate(" << doubleToString(-propList["libwpg:rotate"]->getFloat()) + << ") translate(" << doubleToString(-72*propList["svg:cx"]->getFloat()) + << ", " << doubleToString(-72*propList["svg:cy"]->getFloat()) << ")\" "; m_outputSink << "/>\n"; } Index: WPGPaintInterface.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPGPaintInterface.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- WPGPaintInterface.h 25 Nov 2008 11:58:28 -0000 1.12 +++ WPGPaintInterface.h 27 Nov 2008 14:15:17 -0000 1.13 @@ -31,7 +31,6 @@ #include <libwpd/libwpd.h> #include "WPGBrush.h" #include "WPGPen.h" -#include "WPGPoint.h" #include "WPGRect.h" namespace libwpg @@ -51,9 +50,9 @@ typedef enum { AlternatingFill, WindingFill } FillRule; virtual void setFillRule(FillRule rule ) = 0; - virtual void startLayer(unsigned int id) = 0; + virtual void startLayer(const ::WPXPropertyList& propList) = 0; - virtual void endLayer(unsigned int id) = 0; + virtual void endLayer() = 0; virtual void startEmbeddedGraphics(const ::WPXPropertyList &propList) = 0; @@ -61,7 +60,7 @@ virtual void drawRectangle(const WPGRect& rect, double rx, double ry) = 0; - virtual void drawEllipse(const WPGPoint& center, double rx, double ry, double rotation, const WPGPoint& from, const WPGPoint& to) = 0; + virtual void drawEllipse(const ::WPXPropertyList& propList) = 0; virtual void drawPolygon(const ::WPXPropertyListVector& vertices) = 0; Index: Makefile.am =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/Makefile.am,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Makefile.am 25 Nov 2008 11:58:28 -0000 1.29 +++ Makefile.am 27 Nov 2008 14:15:17 -0000 1.30 @@ -27,14 +27,13 @@ WPGPen.h \ WPGBrush.h \ WPGGradient.h \ - WPGPoint.h \ WPGRect.h \ WPGBitmap.h \ WPGPaintInterface.h AM_CXXFLAGS = $(LIBWPG_CXXFLAGS) $(DEBUG_CXXFLAGS) -libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LIBADD = @LIBWPG_WIN32_RESOURCE@ +libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LIBADD = $(LIBWPG_LIBS) @LIBWPG_WIN32_RESOURCE@ libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_DEPENDENCIES = @LIBWPG_WIN32_RESOURCE@ libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic $(no_undefined) libwpg_@WPG_MAJOR_VERSION@_@WPG_MINOR_VERSION@_la_SOURCES = \ @@ -43,7 +42,6 @@ WPGPen.cpp \ WPGColor.cpp \ WPGGradient.cpp \ - WPGPoint.cpp \ WPGRect.cpp \ WPGHeader.cpp \ WPGSVGGenerator.cpp \ --- WPGPoint.cpp DELETED --- Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- WPG2Parser.cpp 25 Nov 2008 11:58:28 -0000 1.84 +++ WPG2Parser.cpp 27 Nov 2008 14:15:17 -0000 1.85 @@ -565,7 +565,7 @@ return; // sentinel if(m_layerOpened) - m_painter->endLayer(m_layerId); + m_painter->endLayer(); m_painter->endGraphics(); m_exit = true; @@ -575,13 +575,14 @@ { if (!m_graphicsStarted) return; - m_layerId = readU16(); + WPXPropertyList propList; + propList.insert("svg:id", (int)readU16()); // close previous one if(m_layerOpened) - m_painter->endLayer(m_layerId); + m_painter->endLayer(); - m_painter->startLayer(m_layerId); + m_painter->startLayer(propList); m_layerOpened = true; WPG_DEBUG_MSG((" Layer Id: %d\n", m_layerId)); @@ -823,8 +824,8 @@ // TODO: get gradient extent m_gradientAngle = angleInteger + (double)angleFraction/65536.0; - m_gradientRef.x = xref; - m_gradientRef.y = yref; + m_gradientRef.insert("svg:x", (float)xref); + m_gradientRef.insert("svg:y", (float)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -853,8 +854,8 @@ // TODO: get gradient extent (in double precision) m_gradientAngle = angleFraction + (double)angleInteger/65536.0; - m_gradientRef.x = xref; - m_gradientRef.y = yref; + m_gradientRef.insert("svg:x", (float)xref); + m_gradientRef.insert("svg:y", (float)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -915,8 +916,8 @@ // and they are actually in reverse order if(count == 2) { - double xref = (double)m_gradientRef.x/65536.0; - double yref = (double)m_gradientRef.y/65536.0; + double xref = (double)(m_gradientRef["svg:x"]->getFloat())/65536.0; + double yref = (double)(m_gradientRef["svg:y"]->getFloat())/65536.0; double angle = m_gradientAngle*M_PI/180.0; double tanangle = tan(angle); double ref = (tanangle < 1e2 && tanangle > -1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; @@ -924,7 +925,7 @@ gradient.setAngle(-m_gradientAngle); // upside down gradient.addStop(0, colors[1]); gradient.addStop(ref, colors[0]); - if((m_gradientRef.x != 65535) && (m_gradientRef.y != 65535)) + if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65535)) gradient.addStop(1, colors[1]); m_brush.gradient = gradient; m_brush.style = libwpg::WPGBrush::Gradient; @@ -982,8 +983,8 @@ // and they are actually in reverse order if(count == 2) { - double xref = (double)m_gradientRef.x/65536.0; - double yref = (double)m_gradientRef.y/65536.0; + double xref = (double)(m_gradientRef["svg:x"]->getFloat())/65536.0; + double yref = (double)(m_gradientRef["svg:y"]->getFloat())/65536.0; double angle = m_gradientAngle*M_PI/180.0; double tanangle = tan(angle); double ref = (tanangle<1e2) ? (yref+xref*tanangle)/(1+tanangle) : xref; @@ -991,7 +992,7 @@ gradient.setAngle(-m_gradientAngle); // upside down gradient.addStop(0, colors[1]); gradient.addStop(ref, colors[0]); - if((m_gradientRef.x != 65535) && (m_gradientRef.y != 65536)) + if((m_gradientRef["svg:x"]->getInt() != 65535) && (m_gradientRef["svg:y"]->getInt() != 65536)) gradient.addStop(1, colors[1]); m_brush.gradient = gradient; m_brush.style = libwpg::WPGBrush::Gradient; @@ -1252,10 +1253,6 @@ long ty = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(tx,ty); - libwpg::WPGPoint initialPoint( TO_DOUBLE(ix)/m_xres, TO_DOUBLE(iy)/m_yres ); - libwpg::WPGPoint terminalPoint( TO_DOUBLE(tx)/m_xres, TO_DOUBLE(ty)/m_yres ); - libwpg::WPGPoint anchorPoint( TO_DOUBLE(ax)/m_xres, TO_DOUBLE(ay)/m_yres ); - element.insert("svg:x", (float)(TO_DOUBLE(ax)/m_xres)); element.insert("svg:y", (float)(TO_DOUBLE(ay)/m_yres)); if (i == 0) @@ -1362,16 +1359,18 @@ long ey = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(ex,ey); - libwpg::WPGPoint center; - center.x = TO_DOUBLE(cx) / m_xres; - center.y = TO_DOUBLE(cy) / m_xres; - double rx = TO_DOUBLE(radx) / m_xres; - double ry = TO_DOUBLE(rady) / m_xres; + ::WPXPropertyList propList; + propList.insert("svg:cx", (float)(TO_DOUBLE(cx) / m_xres)); + propList.insert("svg:cy", (float)(TO_DOUBLE(cy) / m_xres)); + propList.insert("svg:rx", (float)(TO_DOUBLE(radx) / m_xres)); + propList.insert("svg:ry", (float)(TO_DOUBLE(rady) / m_xres)); + 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->drawEllipse(center, rx, ry, objCh.rotate ? objCh.rotationAngle : 0.0, - libwpg::WPGPoint((double)ix/m_xres, (double)iy/m_yres), libwpg::WPGPoint((double)ex/m_xres, (double)ey/m_yres)); + 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) */); WPG_DEBUG_MSG((" Center point x : %li\n", cx)); WPG_DEBUG_MSG((" Center point y : %li\n", cy)); Index: libwpg.h.in =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/libwpg.h.in,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- libwpg.h.in 25 Nov 2008 11:58:28 -0000 1.8 +++ libwpg.h.in 27 Nov 2008 14:15:17 -0000 1.9 @@ -39,7 +39,6 @@ #include "WPGPen.h" #include "WPGBrush.h" #include "WPGGradient.h" -#include "WPGPoint.h" #include "WPGRect.h" #include "WPGBitmap.h" |