Changeset 69505 in webkit


Ignore:
Timestamp:
Oct 11, 2010 10:27:30 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

2010-10-11 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Andreas Kling.

Kill Path::debugString()
https://bugs.webkit.org/show_bug.cgi?id=47493

Remove the obsolete Path::debugString() method. DRT now dumps paths in a platform independant way.

  • platform/graphics/Path.h:
  • platform/graphics/cairo/PathCairo.cpp:
  • platform/graphics/cg/PathCG.cpp:
  • platform/graphics/haiku/PathHaiku.cpp:
  • platform/graphics/openvg/PathOpenVG.cpp:
  • platform/graphics/qt/PathQt.cpp:
  • platform/graphics/skia/PathSkia.cpp:
  • platform/graphics/wince/PathWinCE.cpp:
  • platform/graphics/wince/PlatformPathWinCE.cpp:
  • platform/graphics/wince/PlatformPathWinCE.h:
  • platform/graphics/wx/PathWx.cpp:
  • svg/SVGGlyphElement.h: (WebCore::SVGGlyphIdentifier::operator==):
Location:
trunk/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69495 r69505  
     12010-10-11  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        Kill Path::debugString()
     6        https://bugs.webkit.org/show_bug.cgi?id=47493
     7
     8        Remove the obsolete Path::debugString() method. DRT now dumps paths in a platform independant way.
     9
     10        * platform/graphics/Path.h:
     11        * platform/graphics/cairo/PathCairo.cpp:
     12        * platform/graphics/cg/PathCG.cpp:
     13        * platform/graphics/haiku/PathHaiku.cpp:
     14        * platform/graphics/openvg/PathOpenVG.cpp:
     15        * platform/graphics/qt/PathQt.cpp:
     16        * platform/graphics/skia/PathSkia.cpp:
     17        * platform/graphics/wince/PathWinCE.cpp:
     18        * platform/graphics/wince/PlatformPathWinCE.cpp:
     19        * platform/graphics/wince/PlatformPathWinCE.h:
     20        * platform/graphics/wx/PathWx.cpp:
     21        * svg/SVGGlyphElement.h:
     22        (WebCore::SVGGlyphIdentifier::operator==):
     23
    1242010-10-11  Martin Robinson  <mrobinson@igalia.com>
    225
  • trunk/WebCore/platform/graphics/Path.h

    r67808 r69505  
    141141        void translate(const FloatSize&);
    142142
    143         String debugString() const;
    144 
    145143        PlatformPathPtr platformPath() const { return m_path; }
    146144
  • trunk/WebCore/platform/graphics/cairo/PathCairo.cpp

    r68050 r69505  
    338338}
    339339
    340 String Path::debugString() const
    341 {
    342     if (isEmpty())
    343         return String();
    344 
    345     String pathString;
    346     OwnPtr<cairo_path_t> path(cairo_copy_path(platformPath()->context()));
    347     cairo_path_data_t* data;
    348 
    349     for (int i = 0; i < path->num_data; i += path->data[i].header.length) {
    350         data = &path->data[i];
    351         switch (data->header.type) {
    352         case CAIRO_PATH_MOVE_TO:
    353             if (i < (path->num_data - path->data[i].header.length))
    354                 pathString += String::format("M%.2f,%.2f ",
    355                                       data[1].point.x, data[1].point.y);
    356             break;
    357         case CAIRO_PATH_LINE_TO:
    358             pathString += String::format("L%.2f,%.2f ",
    359                                       data[1].point.x, data[1].point.y);
    360             break;
    361         case CAIRO_PATH_CURVE_TO:
    362             pathString += String::format("C%.2f,%.2f,%.2f,%.2f,%.2f,%.2f ",
    363                                       data[1].point.x, data[1].point.y,
    364                                       data[2].point.x, data[2].point.y,
    365                                       data[3].point.x, data[3].point.y);
    366             break;
    367         case CAIRO_PATH_CLOSE_PATH:
    368             pathString += "Z ";
    369             break;
    370         }
    371     }
    372 
    373     return pathString.simplifyWhiteSpace();
    374 }
    375 
    376340} // namespace WebCore
  • trunk/WebCore/platform/graphics/cg/PathCG.cpp

    r63727 r69505  
    255255}
    256256
    257 static void CGPathToCFStringApplierFunction(void* info, const CGPathElement *element)
    258 {
    259     CFMutableStringRef string = static_cast<CFMutableStringRef>(info);
    260 
    261     CGPoint* points = element->points;
    262     switch (element->type) {
    263     case kCGPathElementMoveToPoint:
    264         CFStringAppendFormat(string, 0, CFSTR("M%.2f,%.2f "), points[0].x, points[0].y);
    265         break;
    266     case kCGPathElementAddLineToPoint:
    267         CFStringAppendFormat(string, 0, CFSTR("L%.2f,%.2f "), points[0].x, points[0].y);
    268         break;
    269     case kCGPathElementAddQuadCurveToPoint:
    270         CFStringAppendFormat(string, 0, CFSTR("Q%.2f,%.2f,%.2f,%.2f "),
    271                 points[0].x, points[0].y, points[1].x, points[1].y);
    272         break;
    273     case kCGPathElementAddCurveToPoint:
    274         CFStringAppendFormat(string, 0, CFSTR("C%.2f,%.2f,%.2f,%.2f,%.2f,%.2f "),
    275                 points[0].x, points[0].y, points[1].x, points[1].y,
    276                 points[2].x, points[2].y);
    277         break;
    278     case kCGPathElementCloseSubpath:
    279         CFStringAppendFormat(string, 0, CFSTR("Z "));
    280         break;
    281     }
    282 }
    283 
    284 static CFStringRef CFStringFromCGPath(CGPathRef path)
    285 {
    286     if (!path)
    287         return 0;
    288 
    289     CFMutableStringRef string = CFStringCreateMutable(NULL, 0);
    290     CGPathApply(path, string, CGPathToCFStringApplierFunction);
    291     CFStringTrimWhitespace(string);
    292 
    293 
    294     return string;
    295 }
    296 
    297 
    298257#pragma mark -
    299258#pragma mark Path Management
    300 
    301 String Path::debugString() const
    302 {
    303     String result;
    304     if (!isEmpty()) {
    305         CFStringRef pathString = CFStringFromCGPath(m_path);
    306         result = String(pathString);
    307         CFRelease(pathString);
    308     }
    309     return result;
    310 }
    311259
    312260struct PathApplierInfo {
  • trunk/WebCore/platform/graphics/haiku/PathHaiku.cpp

    r63599 r69505  
    145145}
    146146
    147 String Path::debugString() const
    148 {
    149     notImplemented();
    150     return String();
    151 }
    152 
    153147void Path::apply(void* info, PathApplierFunction function) const
    154148{
  • trunk/WebCore/platform/graphics/openvg/PathOpenVG.cpp

    r63599 r69505  
    437437}
    438438
    439 String Path::debugString() const
    440 {
    441     String debugString = "";
    442 
    443     // OpenVG provides no means to retrieve path segment information.
    444     // This is a bit unfortunate, we might need to store the segments in
    445     // memory if we want to implement this function properly.
    446     notImplemented();
    447 
    448     return debugString;
    449 }
    450 
    451439void Path::apply(void* info, PathApplierFunction function) const
    452440{
  • trunk/WebCore/platform/graphics/qt/PathQt.cpp

    r69462 r69505  
    358358}
    359359
    360 String Path::debugString() const
    361 {
    362     QString ret;
    363     for (int i = 0; i < m_path.elementCount(); ++i) {
    364         const QPainterPath::Element &cur = m_path.elementAt(i);
    365 
    366         switch (cur.type) {
    367             case QPainterPath::MoveToElement:
    368                 ret += QString(QLatin1String("M%1,%2 ")).arg(cur.x, 0, 'f', 2).arg(cur.y, 0, 'f', 2);
    369                 break;
    370             case QPainterPath::LineToElement:
    371                 ret += QString(QLatin1String("L%1,%2 ")).arg(cur.x, 0, 'f', 2).arg(cur.y, 0, 'f', 2);
    372                 break;
    373             case QPainterPath::CurveToElement:
    374             {
    375                 const QPainterPath::Element &c1 = m_path.elementAt(i + 1);
    376                 const QPainterPath::Element &c2 = m_path.elementAt(i + 2);
    377 
    378                 Q_ASSERT(c1.type == QPainterPath::CurveToDataElement);
    379                 Q_ASSERT(c2.type == QPainterPath::CurveToDataElement);
    380 
    381                 ret += QString(QLatin1String("C%1,%2,%3,%4,%5,%6 ")).arg(cur.x, 0, 'f', 2).arg(cur.y, 0, 'f', 2).arg(c1.x, 0, 'f', 2)
    382                                                                     .arg(c1.y, 0, 'f', 2).arg(c2.x, 0, 'f', 2).arg(c2.y, 0, 'f', 2);
    383                 i += 2;
    384                 break;
    385             }
    386             case QPainterPath::CurveToDataElement:
    387                 Q_ASSERT(false);
    388                 break;
    389         }
    390     }
    391 
    392     return ret.trimmed();
    393 }
    394 
    395360void Path::apply(void* info, PathApplierFunction function) const
    396361{
  • trunk/WebCore/platform/graphics/skia/PathSkia.cpp

    r63599 r69505  
    228228}
    229229
    230 String Path::debugString() const
    231 {
    232     String result;
    233 
    234     SkPath::Iter iter(*m_path, false);
    235     SkPoint pts[4];
    236 
    237     int numPoints = m_path->getPoints(0, 0);
    238     SkPath::Verb verb;
    239 
    240     do {
    241         verb = iter.next(pts);
    242         switch (verb) {
    243         case SkPath::kMove_Verb:
    244             result += String::format("M%.2f,%.2f ", pts[0].fX, pts[0].fY);
    245             numPoints -= 1;
    246             break;
    247         case SkPath::kLine_Verb:
    248           if (!iter.isCloseLine()) {
    249                 result += String::format("L%.2f,%.2f ", pts[1].fX, pts[1].fY);
    250                 numPoints -= 1;
    251             }
    252             break;
    253         case SkPath::kQuad_Verb:
    254             result += String::format("Q%.2f,%.2f,%.2f,%.2f ",
    255                 pts[1].fX, pts[1].fY,
    256                 pts[2].fX, pts[2].fY);
    257             numPoints -= 2;
    258             break;
    259         case SkPath::kCubic_Verb:
    260             result += String::format("C%.2f,%.2f,%.2f,%.2f,%.2f,%.2f ",
    261                 pts[1].fX, pts[1].fY,
    262                 pts[2].fX, pts[2].fY,
    263                 pts[3].fX, pts[3].fY);
    264             numPoints -= 3;
    265             break;
    266         case SkPath::kClose_Verb:
    267             result += "Z ";
    268             break;
    269         case SkPath::kDone_Verb:
    270             break;
    271         }
    272     } while (verb != SkPath::kDone_Verb);
    273 
    274     // If you have a path that ends with an M, Skia will not iterate the
    275     // trailing M. That's nice of it, but Apple's paths output the trailing M
    276     // and we want out layout dumps to look like theirs
    277     if (numPoints) {
    278         ASSERT(numPoints==1);
    279         m_path->getLastPt(pts);
    280         result += String::format("M%.2f,%.2f ", pts[0].fX, pts[0].fY);
    281     }
    282 
    283     return result.stripWhiteSpace();
    284 }
    285 
    286230// Computes the bounding box for the stroke and style currently selected into
    287231// the given bounding box. This also takes into account the stroke width.
  • trunk/WebCore/platform/graphics/wince/PathWinCE.cpp

    r67788 r69505  
    124124}
    125125
    126 String Path::debugString() const
    127 {
    128     return m_path->debugString();
    129 }
    130 
    131126void Path::apply(void* info, PathApplierFunction function) const
    132127{
  • trunk/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp

    r68135 r69505  
    755755}
    756756
    757 String PlatformPath::debugString() const
    758 {
    759     String ret;
    760     for (PlatformPathElements::const_iterator i(m_elements.begin()); i != m_elements.end(); ++i) {
    761         switch (i->platformType()) {
    762         case PlatformPathElement::PathMoveTo:
    763         case PlatformPathElement::PathLineTo:
    764             ret += String::format("M %f %f\n", i->pointAt(0).m_x, i->pointAt(0).m_y);
    765             break;
    766         case PlatformPathElement::PathArcTo:
    767             ret += String::format("A %f %f %f %f %f %f %c\n"
    768                 , i->arcTo().m_end.m_x, i->arcTo().m_end.m_y
    769                 , i->arcTo().m_center.m_x, i->arcTo().m_center.m_y
    770                 , i->arcTo().m_radius.m_x, i->arcTo().m_radius.m_y
    771                 , i->arcTo().m_clockwise? 'Y' : 'N');
    772             break;
    773         case PlatformPathElement::PathQuadCurveTo:
    774             ret += String::format("Q %f %f %f %f\n"
    775                 , i->pointAt(0).m_x, i->pointAt(0).m_y
    776                 , i->pointAt(1).m_x, i->pointAt(1).m_y);
    777             break;
    778         case PlatformPathElement::PathBezierCurveTo:
    779             ret += String::format("B %f %f %f %f %f %f\n"
    780                 , i->pointAt(0).m_x, i->pointAt(0).m_y
    781                 , i->pointAt(1).m_x, i->pointAt(1).m_y
    782                 , i->pointAt(2).m_x, i->pointAt(2).m_y);
    783             break;
    784         default:
    785             ASSERT(i->platformType() == PlatformPathElement::PathCloseSubpath);
    786             ret += "S\n";
    787             break;
    788         }
    789     }
    790 
    791     return ret;
    792 }
    793 
    794757void PlatformPath::apply(void* info, PathApplierFunction function) const
    795758{
  • trunk/WebCore/platform/graphics/wince/PlatformPathWinCE.h

    r67788 r69505  
    165165        void addRect(const FloatRect& r);
    166166        void addEllipse(const FloatRect& r);
    167         String debugString() const;
    168167        void apply(void* info, PathApplierFunction function) const;
    169168
  • trunk/WebCore/platform/graphics/wx/PathWx.cpp

    r63599 r69505  
    118118}
    119119
    120 String Path::debugString() const
    121 {
    122     notImplemented();
    123     return String();
    124 }
    125 
    126120Path& Path::operator=(const Path& path)
    127121{
  • trunk/WebCore/svg/SVGGlyphElement.h

    r66397 r69505  
    7373        bool operator==(const SVGGlyphIdentifier& other) const
    7474        {
    75             return isValid == other.isValid &&
    76                    orientation == other.orientation &&
    77                    arabicForm == other.arabicForm &&
    78                    glyphName == other.glyphName &&
    79                    horizontalAdvanceX == other.horizontalAdvanceX &&
    80                    verticalOriginX == other.verticalOriginX &&
    81                    verticalOriginY == other.verticalOriginY &&
    82                    verticalAdvanceY == other.verticalAdvanceY &&
    83                    pathData.debugString() == other.pathData.debugString() &&
    84                    languages == other.languages;
     75            return isValid == other.isValid
     76                && orientation == other.orientation
     77                && arabicForm == other.arabicForm
     78                && glyphName == other.glyphName
     79                && horizontalAdvanceX == other.horizontalAdvanceX
     80                && verticalOriginX == other.verticalOriginX
     81                && verticalOriginY == other.verticalOriginY
     82                && verticalAdvanceY == other.verticalAdvanceY
     83                && languages == other.languages;
    8584        }
    8685
Note: See TracChangeset for help on using the changeset viewer.