Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: webkit/port/platform/graphics/PathSkia.cpp

Issue 13756: Fix issue 3620... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 oval.set(cx - radius, cy - radius, cx + radius, cy + radius); 136 oval.set(cx - radius, cy - radius, cx + radius, cy + radius);
137 137
138 float sweep = ea - sa; 138 float sweep = ea - sa;
139 // check for a circle 139 // check for a circle
140 if (sweep >= 2*gPI || sweep <= -2*gPI) { 140 if (sweep >= 2*gPI || sweep <= -2*gPI) {
141 m_path->addOval(oval); 141 m_path->addOval(oval);
142 } else { 142 } else {
143 SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / gPI); 143 SkScalar startDegrees = WebCoreFloatToSkScalar(sa * 180 / gPI);
144 SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / gPI); 144 SkScalar sweepDegrees = WebCoreFloatToSkScalar(sweep * 180 / gPI);
145 145
146 // Counterclockwise arcs should be drawn with negative sweeps, while
147 // clockwise arcs should be drawn with positive sweeps. Check to see
148 // if the situation is reversed and correct it by adding or subtracting
149 // a full circle
146 if (anticlockwise && sweepDegrees > 0) { 150 if (anticlockwise && sweepDegrees > 0) {
147 sweepDegrees -= SkIntToScalar(360); 151 sweepDegrees -= SkIntToScalar(360);
148 } else if (!anticlockwise && sweepDegrees < 0) { 152 } else if (!anticlockwise && sweepDegrees < 0) {
149 sweepDegrees = SkIntToScalar(360) - sweepDegrees; 153 sweepDegrees += SkIntToScalar(360);
150 } 154 }
151 155
152 // SkDebugf("addArc sa=%g ea=%g cw=%d start=%g sweep=%g\n", sa, ea, clock wise, 156 // SkDebugf("addArc sa=%g ea=%g cw=%d start=%g sweep=%g\n", sa, ea, clock wise,
153 // SkScalarToFloat(startDegrees), SkScalarToFloat(sweepDegrees)) ; 157 // SkScalarToFloat(startDegrees), SkScalarToFloat(sweepDegrees)) ;
154 158
155 m_path->arcTo(oval, startDegrees, sweepDegrees, false); 159 m_path->arcTo(oval, startDegrees, sweepDegrees, false);
156 } 160 }
157 } 161 }
158 162
159 void Path::addRect(const FloatRect& rect) 163 void Path::addRect(const FloatRect& rect)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 if (numPoints) { 277 if (numPoints) {
274 ASSERT(numPoints==1); 278 ASSERT(numPoints==1);
275 m_path->getLastPt(pts); 279 m_path->getLastPt(pts);
276 result += String::format("M%.2f,%.2f ", pts[0].fX, pts[0].fY); 280 result += String::format("M%.2f,%.2f ", pts[0].fX, pts[0].fY);
277 } 281 }
278 282
279 return result.stripWhiteSpace(); 283 return result.stripWhiteSpace();
280 } 284 }
281 285
282 } // namespace WebCore 286 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698