Changeset 163159 in webkit
- Timestamp:
- Jan 30, 2014 9:47:20 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r163158 r163159 1 2014-01-30 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Change drawRect()/drawLine() signature to support subpixel rendering. 4 https://bugs.webkit.org/show_bug.cgi?id=127961 5 6 Reviewed by Simon Fraser. 7 8 IntRect/IntPoint -> FloatRect/FloatPoint. 9 10 Covered by existing tests. No change in functionality. 11 12 * platform/graphics/GraphicsContext.h: 13 * platform/graphics/cairo/GraphicsContextCairo.cpp: 14 (WebCore::GraphicsContext::drawRect): 15 (WebCore::GraphicsContext::drawLine): 16 * platform/graphics/cg/GraphicsContextCG.cpp: 17 (WebCore::GraphicsContext::drawRect): 18 (WebCore::GraphicsContext::drawLine): Keep 'distance' int for DottedStroke and DashedStroke for now. 19 * platform/graphics/wince/GraphicsContextWinCE.cpp: 20 (WebCore::GraphicsContext::drawRect): 21 (WebCore::GraphicsContext::drawLine): 22 1 23 2014-01-30 Simon Fraser <simon.fraser@apple.com> 2 24 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r163156 r163159 271 271 // using a 1-pixel stroke inset from the rect borders (of the correct 272 272 // stroke color). 273 void drawRect(const IntRect&);274 void drawLine(const IntPoint&, const IntPoint&);273 void drawRect(const FloatRect&); 274 void drawLine(const FloatPoint&, const FloatPoint&); 275 275 276 276 #if PLATFORM(IOS) -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r163156 r163159 231 231 232 232 // Draws a filled rectangle with a stroked border. 233 void GraphicsContext::drawRect(const IntRect& rect)233 void GraphicsContext::drawRect(const FloatRect& rect) 234 234 { 235 235 if (paintingDisabled()) … … 333 333 334 334 // This is only used to draw borders, so we should not draw shadows. 335 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)335 void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2) 336 336 { 337 337 if (paintingDisabled()) -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r163156 r163159 281 281 282 282 // Draws a filled rectangle with a stroked border. 283 void GraphicsContext::drawRect(const IntRect& rect)283 void GraphicsContext::drawRect(const FloatRect& rect) 284 284 { 285 285 // FIXME: this function does not handle patterns and gradients … … 312 312 313 313 // This is only used to draw borders. 314 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)314 void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2) 315 315 { 316 316 if (paintingDisabled()) … … 328 328 // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic 329 329 // works out. For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g., 330 // (50+53)/2 = 103/2 = 51 when we want 51.5. 330 // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave 331 331 // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. 332 332 if (strokeStyle() == DottedStroke || strokeStyle() == DashedStroke) { … … 395 395 // Remainder is 20. The maximum pixels of line we could paint 396 396 // will be 50 pixels. 397 int distance = (isVerticalLine ? ( point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;397 int distance = (isVerticalLine ? (int)(point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width; 398 398 int remainder = distance % patWidth; 399 399 int coverage = distance - remainder; -
trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
r163156 r163159 625 625 } 626 626 627 void GraphicsContext::drawRect(const IntRect& rect)627 void GraphicsContext::drawRect(const FloatRect& rect) 628 628 { 629 629 if (!m_data->m_opacity || paintingDisabled() || rect.isEmpty()) … … 670 670 } 671 671 672 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)672 void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2) 673 673 { 674 674 if (!m_data->m_opacity || paintingDisabled() || strokeStyle() == NoStroke || !strokeColor().alpha())
Note: See TracChangeset
for help on using the changeset viewer.