Changeset 69505 in webkit
- Timestamp:
- Oct 11, 2010 10:27:30 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69495 r69505 1 2010-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 1 24 2010-10-11 Martin Robinson <mrobinson@igalia.com> 2 25 -
trunk/WebCore/platform/graphics/Path.h
r67808 r69505 141 141 void translate(const FloatSize&); 142 142 143 String debugString() const;144 145 143 PlatformPathPtr platformPath() const { return m_path; } 146 144 -
trunk/WebCore/platform/graphics/cairo/PathCairo.cpp
r68050 r69505 338 338 } 339 339 340 String Path::debugString() const341 {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 376 340 } // namespace WebCore -
trunk/WebCore/platform/graphics/cg/PathCG.cpp
r63727 r69505 255 255 } 256 256 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 298 257 #pragma mark - 299 258 #pragma mark Path Management 300 301 String Path::debugString() const302 {303 String result;304 if (!isEmpty()) {305 CFStringRef pathString = CFStringFromCGPath(m_path);306 result = String(pathString);307 CFRelease(pathString);308 }309 return result;310 }311 259 312 260 struct PathApplierInfo { -
trunk/WebCore/platform/graphics/haiku/PathHaiku.cpp
r63599 r69505 145 145 } 146 146 147 String Path::debugString() const148 {149 notImplemented();150 return String();151 }152 153 147 void Path::apply(void* info, PathApplierFunction function) const 154 148 { -
trunk/WebCore/platform/graphics/openvg/PathOpenVG.cpp
r63599 r69505 437 437 } 438 438 439 String Path::debugString() const440 {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 in445 // memory if we want to implement this function properly.446 notImplemented();447 448 return debugString;449 }450 451 439 void Path::apply(void* info, PathApplierFunction function) const 452 440 { -
trunk/WebCore/platform/graphics/qt/PathQt.cpp
r69462 r69505 358 358 } 359 359 360 String Path::debugString() const361 {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 395 360 void Path::apply(void* info, PathApplierFunction function) const 396 361 { -
trunk/WebCore/platform/graphics/skia/PathSkia.cpp
r63599 r69505 228 228 } 229 229 230 String Path::debugString() const231 {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 the275 // trailing M. That's nice of it, but Apple's paths output the trailing M276 // and we want out layout dumps to look like theirs277 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 286 230 // Computes the bounding box for the stroke and style currently selected into 287 231 // the given bounding box. This also takes into account the stroke width. -
trunk/WebCore/platform/graphics/wince/PathWinCE.cpp
r67788 r69505 124 124 } 125 125 126 String Path::debugString() const127 {128 return m_path->debugString();129 }130 131 126 void Path::apply(void* info, PathApplierFunction function) const 132 127 { -
trunk/WebCore/platform/graphics/wince/PlatformPathWinCE.cpp
r68135 r69505 755 755 } 756 756 757 String PlatformPath::debugString() const758 {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_y769 , i->arcTo().m_center.m_x, i->arcTo().m_center.m_y770 , i->arcTo().m_radius.m_x, i->arcTo().m_radius.m_y771 , 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_y776 , 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_y781 , i->pointAt(1).m_x, i->pointAt(1).m_y782 , 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 794 757 void PlatformPath::apply(void* info, PathApplierFunction function) const 795 758 { -
trunk/WebCore/platform/graphics/wince/PlatformPathWinCE.h
r67788 r69505 165 165 void addRect(const FloatRect& r); 166 166 void addEllipse(const FloatRect& r); 167 String debugString() const;168 167 void apply(void* info, PathApplierFunction function) const; 169 168 -
trunk/WebCore/platform/graphics/wx/PathWx.cpp
r63599 r69505 118 118 } 119 119 120 String Path::debugString() const121 {122 notImplemented();123 return String();124 }125 126 120 Path& Path::operator=(const Path& path) 127 121 { -
trunk/WebCore/svg/SVGGlyphElement.h
r66397 r69505 73 73 bool operator==(const SVGGlyphIdentifier& other) const 74 74 { 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; 85 84 } 86 85
Note: See TracChangeset
for help on using the changeset viewer.