From: Fridrich S. <str...@us...> - 2008-12-03 13:41:35
|
Update of /cvsroot/libwpg/libwpg/src/lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6482/src/lib Modified Files: WPG2Parser.cpp WPG2Parser.h Log Message: all float -> double (it does not take so much more space and saves big deal of precision) Index: WPG2Parser.cpp =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.cpp,v retrieving revision 1.90 retrieving revision 1.91 diff -u -d -r1.90 -r1.91 --- WPG2Parser.cpp 3 Dec 2008 12:51:21 -0000 1.90 +++ WPG2Parser.cpp 3 Dec 2008 13:41:29 -0000 1.91 @@ -519,8 +519,8 @@ WPG_DEBUG_MSG((" height : %li\n", m_height)); ::WPXPropertyList propList; - propList.insert("svg:width", (float)((TO_DOUBLE(m_width)) / m_xres)); - propList.insert("svg:height", (float)((TO_DOUBLE(m_height)) / m_yres)); + propList.insert("svg:width", ((TO_DOUBLE(m_width)) / m_xres)); + propList.insert("svg:height", ((TO_DOUBLE(m_height)) / m_yres)); m_painter->startGraphics(propList); @@ -828,8 +828,8 @@ // TODO: get gradient extent m_gradientAngle = angleInteger + (double)angleFraction/65536.0; - m_gradientRef.insert("svg:x", (float)xref); - m_gradientRef.insert("svg:y", (float)yref); + m_gradientRef.insert("svg:x", (double)xref); + m_gradientRef.insert("svg:y", (double)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -858,8 +858,8 @@ // TODO: get gradient extent (in double precision) m_gradientAngle = angleFraction + (double)angleInteger/65536.0; - m_gradientRef.insert("svg:x", (float)xref); - m_gradientRef.insert("svg:y", (float)yref); + m_gradientRef.insert("svg:x", (double)xref); + m_gradientRef.insert("svg:y", (double)yref); WPG_DEBUG_MSG((" Gradient angle : %d.%d\n", angleInteger, angleFraction)); WPG_DEBUG_MSG((" Gradient reference : %d.%d\n", xref, yref)); @@ -1164,8 +1164,8 @@ long x = (m_doublePrecision) ? readS32() : readS16(); long y = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(x,y); - point.insert("svg:x", (float)(TO_DOUBLE(x)/m_xres)); - point.insert("svg:y", (float)(TO_DOUBLE(y)/m_yres)); + point.insert("svg:x", (TO_DOUBLE(x)/m_xres)); + point.insert("svg:y", (TO_DOUBLE(y)/m_yres)); points.append(point); } @@ -1257,19 +1257,19 @@ long ty = (m_doublePrecision) ? readS32() : readS16(); TRANSFORM_XY(tx,ty); - element.insert("svg:x", (float)(TO_DOUBLE(ax)/m_xres)); - element.insert("svg:y", (float)(TO_DOUBLE(ay)/m_yres)); + element.insert("svg:x", (TO_DOUBLE(ax)/m_xres)); + element.insert("svg:y", (TO_DOUBLE(ay)/m_yres)); if (i == 0) element.insert("libwpg:path-action", "M"); else { - element.insert("svg:x2", (float)(TO_DOUBLE(ix)/m_xres)); - element.insert("svg:y2", (float)(TO_DOUBLE(iy)/m_yres)); + element.insert("svg:x2", (TO_DOUBLE(ix)/m_xres)); + element.insert("svg:y2", (TO_DOUBLE(iy)/m_yres)); element.insert("libwpg:path-action", "C"); } path.append(element); - element.insert("svg:x1", (float)(TO_DOUBLE(tx)/m_xres)); - element.insert("svg:y1", (float)(TO_DOUBLE(ty)/m_yres)); + element.insert("svg:x1", (TO_DOUBLE(tx)/m_xres)); + element.insert("svg:y1", (TO_DOUBLE(ty)/m_yres)); } element.clear(); @@ -1320,13 +1320,13 @@ long ry = (m_doublePrecision) ? readS32() : readS16(); ::WPXPropertyList propList; - propList.insert("svg:x", (float)(TO_DOUBLE(xs1) / m_xres)); - propList.insert("svg:width", (float)(TO_DOUBLE(xs2-xs1) / m_xres)); - propList.insert("svg:y", (float)(TO_DOUBLE(ys1) / m_yres)); - propList.insert("svg:height", (float)(TO_DOUBLE(ys2-ys1) / m_yres)); + propList.insert("svg:x", (TO_DOUBLE(xs1) / m_xres)); + propList.insert("svg:width", (TO_DOUBLE(xs2-xs1) / m_xres)); + propList.insert("svg:y", (TO_DOUBLE(ys1) / m_yres)); + propList.insert("svg:height", (TO_DOUBLE(ys2-ys1) / m_yres)); - propList.insert("svg:rx", (float)(TO_DOUBLE(rx)/m_xres)); - propList.insert("svg:ry", (float)(TO_DOUBLE(ry)/m_yres)); + propList.insert("svg:rx", (TO_DOUBLE(rx)/m_xres)); + propList.insert("svg:ry", (TO_DOUBLE(ry)/m_yres)); m_painter->setStyle( objCh.framed ? m_pen : libwpg::WPGPen(), objCh.filled ? m_brush : libwpg::WPGBrush(), ::WPXPropertyList() ); m_painter->drawRectangle(propList); @@ -1363,12 +1363,12 @@ TRANSFORM_XY(ex,ey); ::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)); + propList.insert("svg:cx", (TO_DOUBLE(cx) / m_xres)); + propList.insert("svg:cy", (TO_DOUBLE(cy) / m_xres)); + propList.insert("svg:rx", (TO_DOUBLE(radx) / m_xres)); + propList.insert("svg:ry", (TO_DOUBLE(rady) / m_xres)); if (objCh.rotate) - propList.insert("libwpg:rotate", (float)(objCh.rotationAngle)); + propList.insert("libwpg:rotate", (double)(objCh.rotationAngle)); 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), @@ -1629,10 +1629,10 @@ // prepare the bitmap structure for the listener libwpg::WPGBitmap bitmap(width, height, m_vFlipped, m_hFlipped); ::WPXPropertyList propList; - propList.insert("svg:x", (float)m_bitmap.x1); - propList.insert("svg:y", (float)m_bitmap.y1); - propList.insert("svg:width", (float)(m_bitmap.x2 - m_bitmap.x1)); - propList.insert("svg:height", (float)(m_bitmap.y2 - m_bitmap.y1)); + propList.insert("svg:x", (double)m_bitmap.x1); + propList.insert("svg:y", (double)m_bitmap.y1); + propList.insert("svg:width", (m_bitmap.x2 - m_bitmap.x1)); + propList.insert("svg:height", (m_bitmap.y2 - m_bitmap.y1)); propList.insert("libwpg:mime-type", "image/bmp"); // format 1: each byte represents 8 pixels, the color fetched from the palette @@ -1888,10 +1888,10 @@ m_input->seek(accessoryDataLength, WPX_SEEK_CUR); ::WPXPropertyList propList; - propList.insert("svg:x", (float)m_binaryData.x1); - propList.insert("svg:y", (float)m_binaryData.y1); - propList.insert("svg:width", (float)(m_binaryData.x2 - m_binaryData.x1)); - propList.insert("svg:height", (float)(m_binaryData.y2 - m_binaryData.y1)); + propList.insert("svg:x", (double)m_binaryData.x1); + propList.insert("svg:y", (double)m_binaryData.y1); + propList.insert("svg:width", (m_binaryData.x2 - m_binaryData.x1)); + propList.insert("svg:height", (m_binaryData.y2 - m_binaryData.y1)); propList.insert("libwpg:mime-type", m_binaryData.mimeTypes[m_binaryData.objectIndex]); WPG_DEBUG_MSG(("Image Object Mime Type : %s\n", binaryData.mimeType.cstr())); Index: WPG2Parser.h =================================================================== RCS file: /cvsroot/libwpg/libwpg/src/lib/WPG2Parser.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- WPG2Parser.h 3 Dec 2008 12:51:21 -0000 1.32 +++ WPG2Parser.h 3 Dec 2008 13:41:29 -0000 1.33 @@ -63,8 +63,8 @@ ::WPXPropertyList transformPoint(const ::WPXPropertyList& p) const { ::WPXPropertyList propList; - propList.insert("svg:x", (float)(element[0][0]*p["svg:x"]->getDouble() + element[1][0]*p["svg:y"]->getDouble() + element[2][0])); - propList.insert("svg:y", (float)(element[0][1]*p["svg:x"]->getDouble() + element[1][1]*p["svg:y"]->getDouble() + element[2][1])); + propList.insert("svg:x", (element[0][0]*p["svg:x"]->getDouble() + element[1][0]*p["svg:y"]->getDouble() + element[2][0])); + propList.insert("svg:y", (element[0][1]*p["svg:x"]->getDouble() + element[1][1]*p["svg:y"]->getDouble() + element[2][1])); return propList; } @@ -81,10 +81,10 @@ double newx2 = element[0][0]*oldx2 + element[1][0]*oldy2 + element[2][0]; double newy2 = element[0][1]*oldx2 + element[1][1]*oldy2 + element[2][1]; - propList.insert("svg:x", (float)newx1); - propList.insert("svg:y", (float)newy1); - propList.insert("svg:width", (float)(newx2-newx1)); - propList.insert("svg:height", (float)(newy2-newy1)); + propList.insert("svg:x", (double)newx1); + propList.insert("svg:y", (double)newy1); + propList.insert("svg:width", (newx2-newx1)); + propList.insert("svg:height", (newy2-newy1)); return propList; } |