From: Fridrich S. <str...@us...> - 2008-12-05 00:14:39
|
Update of /cvsroot/libwpg/perfectspot/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18793/src Modified Files: renderer.cpp Log Message: adapting to the current state of libwpg api Index: renderer.cpp =================================================================== RCS file: /cvsroot/libwpg/perfectspot/src/renderer.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- renderer.cpp 28 Nov 2008 15:09:15 -0000 1.15 +++ renderer.cpp 5 Dec 2008 00:14:35 -0000 1.16 @@ -76,8 +76,8 @@ void Painter::startGraphics(const ::WPXPropertyList &propList) { - width = propList["svg:width"]->getFloat(); - height = propList["svg:height"]->getFloat(); + width = propList["svg:width"]->getDouble(); + height = propList["svg:height"]->getDouble(); m_zoomX = m_target->viewport().width() / width; m_zoomY = m_target->viewport().height() / height; @@ -91,7 +91,7 @@ if(pen.width == 0) ppen.setStyle(Qt::NoPen); - QColor cPen(pen.foreColor.red, pen.foreColor.green, pen.foreColor.blue); + QColor cPen(pen.foreColor.cstr()); ppen.setColor(cPen); if(!pen.solid) @@ -106,25 +106,22 @@ QBrush pbrush(Qt::SolidPattern); - QColor cBrush(brush.foreColor.red, brush.foreColor.green, brush.foreColor.blue); + QColor cBrush(brush.foreColor.cstr()); pbrush.setColor(cBrush); - if(brush.style == WPGBrush::NoBrush) + if(brush.style == "none") pbrush.setStyle(Qt::NoBrush); - if(brush.style == WPGBrush::Solid) + if(brush.style == "solid") pbrush.setStyle(Qt::SolidPattern); - if(brush.style == WPGBrush::Gradient) + if(brush.style == "gradient") { WPGGradient gradient = brush.gradient; QLinearGradient pgradient(0, 0, 0, 1); for(unsigned c = 0; c < gradient.count(); c++) - { - WPGColor cc = gradient.stopColor(c); - pgradient.setColorAt(gradient.stopOffset(c), QColor(cc.red, cc.green, cc. blue)); - } + pgradient.setColorAt(gradient.stopOffset(c), QColor(gradient.stopColor(c).cstr())); #if QT_VERSION >= 0x040300 pgradient.setCoordinateMode(QLinearGradient::ObjectBoundingMode); #endif @@ -156,24 +153,24 @@ void Painter::drawRectangle(const ::WPXPropertyList &propList) { - m_target->drawRoundRect((int)(m_zoomX*propList["svg:x"]->getFloat()), (int)(m_zoomY*propList["svg:y"]->getFloat()), - (int)(m_zoomX*propList["svg:width"]->getFloat()), (int)(m_zoomY*propList["svg:height"]->getFloat()), - (int)(propList["svg:rx"]->getFloat() * 200 / propList["svg:width"]->getFloat()), - (int)(propList["svg:ry"]->getFloat() * 200 / propList["svg:height"]->getFloat())); + m_target->drawRoundRect((int)(m_zoomX*propList["svg:x"]->getDouble()), (int)(m_zoomY*propList["svg:y"]->getDouble()), + (int)(m_zoomX*propList["svg:width"]->getDouble()), (int)(m_zoomY*propList["svg:height"]->getDouble()), + (int)(propList["svg:rx"]->getDouble() * 200 / propList["svg:width"]->getDouble()), + (int)(propList["svg:ry"]->getDouble() * 200 / propList["svg:height"]->getDouble())); } void Painter::drawEllipse(const ::WPXPropertyList &propList) { - m_target->drawEllipse((int)(m_zoomX*(propList["svg:cx"]->getFloat() - propList["svg:rx"]->getFloat())), - (int)(m_zoomY*(propList["svg:cy"]->getFloat() - propList["svg:ry"]->getFloat())), - (int)(2*m_zoomX*propList["svg:rx"]->getFloat()), (int)(2*m_zoomY*propList["svg:ry"]->getFloat())); + m_target->drawEllipse((int)(m_zoomX*(propList["svg:cx"]->getDouble() - propList["svg:rx"]->getDouble())), + (int)(m_zoomY*(propList["svg:cy"]->getDouble() - propList["svg:ry"]->getDouble())), + (int)(2*m_zoomX*propList["svg:rx"]->getDouble()), (int)(2*m_zoomY*propList["svg:ry"]->getDouble())); } void Painter::drawPolygon(const ::WPXPropertyListVector& vertices) { QPointF* points = new QPointF[vertices.count()]; for(unsigned i = 0; i < vertices.count(); i++) - points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getFloat(), m_zoomY*vertices[i]["svg:y"]->getFloat()); + points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getDouble(), m_zoomY*vertices[i]["svg:y"]->getDouble()); m_target->drawPolygon(points, vertices.count()); delete [] points; @@ -183,7 +180,7 @@ { QPointF* points = new QPointF[vertices.count()]; for(unsigned i = 0; i < vertices.count(); i++) - points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getFloat(), m_zoomY*vertices[i]["svg:y"]->getFloat()); + points[i] = QPointF(m_zoomX*vertices[i]["svg:x"]->getDouble(), m_zoomY*vertices[i]["svg:y"]->getDouble()); m_target->drawPolyline(points, vertices.count()); delete [] points; @@ -195,13 +192,13 @@ for(unsigned i = 0; i < path.count(); i++) { if (path[i]["libwpg:path-action"]->getStr() == "M") - p.moveTo(m_zoomX*path[i]["svg:x"]->getFloat(), m_zoomY*path[i]["svg:y"]->getFloat()); + p.moveTo(m_zoomX*path[i]["svg:x"]->getDouble(), m_zoomY*path[i]["svg:y"]->getDouble()); else if (path[i]["libwpg:path-action"]->getStr() == "L") - p.lineTo(m_zoomX*path[i]["svg:x"]->getFloat(), m_zoomY*path[i]["svg:y"]->getFloat()); + p.lineTo(m_zoomX*path[i]["svg:x"]->getDouble(), m_zoomY*path[i]["svg:y"]->getDouble()); else if (path[i]["libwpg:path-action"]->getStr() == "C") - p.cubicTo(m_zoomX*path[i]["svg:x1"]->getFloat(), m_zoomY*path[i]["svg:y1"]->getFloat(), - m_zoomX*path[i]["svg:x2"]->getFloat(), m_zoomY*path[i]["svg:y2"]->getFloat(), - m_zoomX*path[i]["svg:x"]->getFloat(), m_zoomY*path[i]["svg:y"]->getFloat()); + p.cubicTo(m_zoomX*path[i]["svg:x1"]->getDouble(), m_zoomY*path[i]["svg:y1"]->getDouble(), + m_zoomX*path[i]["svg:x2"]->getDouble(), m_zoomY*path[i]["svg:y2"]->getDouble(), + m_zoomX*path[i]["svg:x"]->getDouble(), m_zoomY*path[i]["svg:y"]->getDouble()); else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i == path.count()) p.closeSubpath(); } @@ -215,9 +212,9 @@ if (image.isNull()) return; QRectF target; - target.setTopLeft( QPointF(m_zoomX*propList["svg:x"]->getFloat(), m_zoomY*propList["svg:y"]->getFloat()) ); - target.setBottomRight( QPointF(m_zoomX*(propList["svg:x"]->getFloat() + propList["svg:width"]->getFloat()), - m_zoomY*(propList["svg:y"]->getFloat() + propList["svg:height"]->getFloat())) ); + target.setTopLeft( QPointF(m_zoomX*propList["svg:x"]->getDouble(), m_zoomY*propList["svg:y"]->getDouble()) ); + target.setBottomRight( QPointF(m_zoomX*(propList["svg:x"]->getDouble() + propList["svg:width"]->getDouble()), + m_zoomY*(propList["svg:y"]->getDouble() + propList["svg:height"]->getDouble())) ); m_target->drawImage(target, image); } |