Changeset 117528 in webkit


Ignore:
Timestamp:
May 17, 2012 7:14:17 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Floor y coordinate in Chromium's GraphicsContext::drawLineForText to avoid anti-aliasing
https://bugs.webkit.org/show_bug.cgi?id=86775

Reviewed by Eric Seidel.

Despite operating in floats, we always want to draw lines for text aligned to pixel boundaries.
There are similar functions to do this in other platforms, but to get proper results, we only
need to floor the y value, as we always draw these lines horizontally.

No tests. No change in behavior prior to sub-pixel change.

  • platform/graphics/skia/GraphicsContextSkia.cpp:

(WebCore::GraphicsContext::drawLineForText):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117524 r117528  
     12012-05-17  Levi Weintraub  <leviw@chromium.org>
     2
     3        Floor y coordinate in Chromium's GraphicsContext::drawLineForText to avoid anti-aliasing
     4        https://bugs.webkit.org/show_bug.cgi?id=86775
     5
     6        Reviewed by Eric Seidel.
     7
     8        Despite operating in floats, we always want to draw lines for text aligned to pixel boundaries.
     9        There are similar functions to do this in other platforms, but to get proper results, we only
     10        need to floor the y value, as we always draw these lines horizontally.
     11
     12        No tests. No change in behavior prior to sub-pixel change.
     13
     14        * platform/graphics/skia/GraphicsContextSkia.cpp:
     15        (WebCore::GraphicsContext::drawLineForText):
     16
    1172012-05-17  Michael Moss  <mmoss@chromium.org>
    218
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r113059 r117528  
    630630    SkRect r;
    631631    r.fLeft = WebCoreFloatToSkScalar(pt.x());
    632     r.fTop = WebCoreFloatToSkScalar(pt.y());
     632    // Avoid anti-aliasing lines. Currently, these are always horizontal.
     633    r.fTop = WebCoreFloatToSkScalar(floorf(pt.y()));
    633634    r.fRight = r.fLeft + WebCoreFloatToSkScalar(width);
    634635    r.fBottom = r.fTop + SkIntToScalar(thickness);
Note: See TracChangeset for help on using the changeset viewer.