Status: Untriaged
Owner: [email protected]
CC: [email protected]
Labels: Type-Bug Pri-2 OS-All Area-Misc

New issue 6398 by [email protected]: Even width dotted border antialiasing  
looks bad
http://code.google.com/p/chromium/issues/detail?id=6398

In trunk, we must have picked up changes in Skia as to how dashed styles
are drawn.  If you have something that looks like:

<div style="width: 80px; border-bottom: 1px dotted red">a</div>

You will see the line starts out dotted, and then gets more solid in the
middle, then goes dotted again.  The problem is:

PlatformContextSkia::setupPaintForStroking:

   // Determine about how many dashes or dots we should have.
   int numDashes = length / roundf(width);
   if (!(numDashes & 1))
       numDashes++;    // Make it odd so we end on a dash/dot.
   // Use the number of dashes to determine the length of a
   // dash/dot, which will be approximately width
   dashLength = SkScalarDiv(SkIntToScalar(length),
SkIntToScalar(numDashes));

So we try to end on a dot, probably so that the corners look better.
However, for the dotted case, where length = 0 and width = 80, we wend up
with a dashLength of ~0.987, which Skia is trying to antialias, spreading
the error to the next pixels, causing this sort of error interference
pattern.

Other browsers don't anti alias the line, they just double up on the final
corner, which also sort of looks bad.  Basically, if they want the last
pixel to be on, they draw the line, and then always turn the last pixel on,
which means that in this case the last dot would be 2 pixels wide instead
of one.  This looks pretty bad in all browsers I tried (ie seems to draw
dashed when you ask for dotted, so I can't tell there).

I would personally just ignore the corner business, but maybe that makes
full borders look bad.  It seems like what we do in the stable release is
just keep up the error and eventually skip a pixel, in the middle of the
line, that also looks bad...

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---

Reply via email to