Changeset 83216 in webkit
- Timestamp:
- Apr 7, 2011 3:15:32 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r83214 r83216 1 2011-04-07 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 <rdar://problem/9018212> Underline thickness is not uniform under non-integral scale factor 6 https://bugs.webkit.org/show_bug.cgi?id=58083 7 8 * fast/text/decorations-transformed.html: Added. 9 * platform/mac/fast/text/decorations-transformed-expected.checksum: Added. 10 * platform/mac/fast/text/decorations-transformed-expected.png: Added. 11 * platform/mac/fast/text/decorations-transformed-expected.txt: Added. 12 1 13 2011-04-07 Jer Noble <jer.noble@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r83213 r83216 1 2011-04-07 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 <rdar://problem/9018212> Underline thickness is not uniform under non-integral scale factor 6 https://bugs.webkit.org/show_bug.cgi?id=58083 7 8 Test: fast/text/decorations-transformed.html 9 10 * platform/graphics/GraphicsContext.h: Added a RoundingMode enum with two values. RoundAllSides 11 is the existing rounding mode, where each side of the rectangle snaps to the nearest pixel 12 gridline. RoundOriginAndDimensions snaps the origin to the nearest pixel gridpoint and rounds 13 the width and the height. In this new mode, translating a rectangle in user space never changes 14 its dimensions in device pixels. 15 * platform/graphics/cg/GraphicsContextCG.cpp: 16 (WebCore::GraphicsContext::roundToDevicePixels): Implemented RoundOriginAndDimensions. 17 (WebCore::GraphicsContext::drawLineForText): Use RoundOriginAndDimensions, thus ensuring that 18 all underlines have the same thickness in device pixels. 19 * platform/graphics/openvg/GraphicsContextOpenVG.cpp: 20 (WebCore::GraphicsContext::roundToDevicePixels): Added RoundingMode parameter, but did not implement it. 21 * platform/graphics/qt/GraphicsContextQt.cpp: 22 (WebCore::GraphicsContext::roundToDevicePixels): Ditto. 23 * platform/graphics/skia/GraphicsContextSkia.cpp: 24 (WebCore::GraphicsContext::roundToDevicePixels): Ditto. 25 * platform/graphics/wince/GraphicsContextWinCE.cpp: 26 (WebCore::GraphicsContext::roundToDevicePixels): Ditto. 27 * platform/graphics/wx/GraphicsContextWx.cpp: 28 (WebCore::GraphicsContext::roundToDevicePixels): Ditto. 29 * rendering/InlineTextBox.cpp: 30 (WebCore::InlineTextBox::paintDecoration): 31 1 32 2011-04-06 Vitaly Repeshko <vitalyr@chromium.org> 2 33 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r83044 r83216 350 350 void drawHighlightForText(const Font&, const TextRun&, const FloatPoint&, int h, const Color& backgroundColor, ColorSpace, int from = 0, int to = -1); 351 351 352 FloatRect roundToDevicePixels(const FloatRect&); 352 enum RoundingMode { 353 RoundAllSides, 354 RoundOriginAndDimensions 355 }; 356 FloatRect roundToDevicePixels(const FloatRect&, RoundingMode = RoundAllSides); 353 357 354 358 void drawLineForText(const FloatPoint&, float width, bool printing); -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r81161 r83216 1168 1168 } 1169 1169 1170 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect )1170 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode roundingMode) 1171 1171 { 1172 1172 // It is not enough just to round to pixels in device space. The rotation part of the … … 1193 1193 deviceOrigin.x = roundf(deviceOrigin.x); 1194 1194 deviceOrigin.y = roundf(deviceOrigin.y); 1195 deviceLowerRight.x = roundf(deviceLowerRight.x); 1196 deviceLowerRight.y = roundf(deviceLowerRight.y); 1195 if (roundingMode == RoundAllSides) { 1196 deviceLowerRight.x = roundf(deviceLowerRight.x); 1197 deviceLowerRight.y = roundf(deviceLowerRight.y); 1198 } else { 1199 deviceLowerRight.x = deviceOrigin.x + roundf(rect.width() * deviceScaleX); 1200 deviceLowerRight.y = deviceOrigin.y + roundf(rect.height() * deviceScaleY); 1201 } 1197 1202 1198 1203 // Don't let the height or width round to 0 unless either was originally 0 … … 1233 1238 // makes our thickness more than double, then there must be a shrinking-scale factor and rounding to pixels 1234 1239 // in device space will make the underlines too thick. 1235 CGRect lineRect = roundToDevicePixels(FloatRect(x, y, lineLength, adjustedThickness) );1240 CGRect lineRect = roundToDevicePixels(FloatRect(x, y, lineLength, adjustedThickness), RoundOriginAndDimensions); 1236 1241 if (lineRect.size.height < thickness * 2.0) { 1237 1242 x = lineRect.origin.x; -
trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp
r78704 r83216 258 258 } 259 259 260 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect )260 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode) 261 261 { 262 262 if (paintingDisabled()) -
trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r82462 r83216 901 901 } 902 902 903 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect )903 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect, RoundingMode) 904 904 { 905 905 // It is not enough just to round to pixels in device space. The rotation part of the -
trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r83002 r83216 869 869 } 870 870 871 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect )871 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode) 872 872 { 873 873 return rect; -
trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
r79052 r83216 1301 1301 1302 1302 1303 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect )1303 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect, RoundingMode) 1304 1304 { 1305 1305 notImplemented(); -
trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
r78852 r83216 417 417 418 418 419 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect )419 FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect, RoundingMode) 420 420 { 421 421 FloatRect result;
Note: See TracChangeset
for help on using the changeset viewer.