New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 682074 link

Starred by 7 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Small canvases have poor text antialiasing

Reported by jes...@twitter.com, Jan 18 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Steps to reproduce the problem:
Reduced test case:
https://jsfiddle.net/neonsilk/s4zyz6y7/

1. Create a small canvas (e.g. 400x50px).
2. fillText

What is the expected behavior?
Text is legible

What went wrong?
Text is barely legible due to poor antialiasing

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 55.0.2883.95  Channel: stable
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 24.0 r0

- Increasing the canvas size fixes issue.
- Using fillText on white rect fixes issue.
 
small canvas text antialiasing.png
9.0 KB View Download
Components: Blink>Canvas
Labels: -Type-Bug -Pri-2 M-56 Pri-1 Type-Bug-Regression
Owner: robertphillips@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on mac 10.12.2 chrome version 56.0.2924.59 and canary 57.0.2984.0 - Text is barely legible as shown in the screenshot

This is a regression as this was working fine in stable 55.0.2883.87

This is working in win and linux OS

This issue is specific to mac retina


Manual Bisect Info:
Good build : 55.0.2883.105
Bad Build : 56.0.2884.0

Bisect tool is invoking all good builds though increased the  bad range. Hence giving the manual CL

CL : https://chromium.googlesource.com/chromium/src/+log/55.0.2883.0..56.0.2884.0?pretty=fuller&n=10000

Possible suspect : https://chromium.googlesource.com/skia.git/+/3786c7716c4796146835e60d7145cff252ed50bd

Please reassign if this is not related to your change.




Cc: fmalita@chromium.org bsalomon@chromium.org junov@chromium.org
Adding people who actually know things.

It appears that Skia is being asked to draw a textBlob that has a run with LCD text specified. Unfortunately, the surface it is being drawn into isn't opaque which winds up altering the pixels around the text.

AFAIK Skia always trusts the caller to only use LCD text when the destination is known to be opaque.

Note that this will repro on Linux if "--force-gpu-rasterization" is used.
I think we also look at the SkPixelGeometry on the SkSurface's SkSurfaceProps. But if the client specifies a SkPixelGeometry other than kUnknown and sets the blob to be LCD then we don't question it.
On Linux with force-gpu-rasterization, the SkGpuDevice is reporting a pixelGeometry of kRGB_H_SkPixelGeometry right before diving into the drawTextBlob method.
In general, we are supposed to disable LCD text for all non-opaque surfaces - e.g.: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/graphics/gpu/AcceleratedImageBufferSurface.cpp?rcl=70fb26c9646660021ce780f6e4849b22688975c9&l=58

Sounds like some surface factory is missing this logic?
It may have something to do with the new 'alpha' parameter to getContext

Comment 7 by junov@chromium.org, Mar 2 2017

Owner: junov@chromium.org
Labels: BugSource-User PaintTeamTriaged-20170428 OS-Android OS-Chrome OS-Linux OS-Windows
Can we get some action on this. Seem fairly simple to fix and we now have a 30-day SLA for P1 issues.

If you point me to the right surface creation method, I can try to fix it.

Comment 9 by junov@chromium.org, May 1 2017

Cc: e...@chromium.org xidac...@chromium.org kkaluri@chromium.org
 Issue 714428  has been merged into this issue.
Owner: fs...@chromium.org
According to duplicate issue, regression range is: https://chromium.googlesource.com/chromium/src/+log/52.0.2743.0..53.0.2744.0?pretty=fuller&n=10000

A narrower range would be useful.
I can get a narrower range.
Labels: -Pri-1 -M-56 -Type-Bug-Regression Pri-2 Type-Bug
I don't think this is a regression. On linux, when using --force-gpu-rasterization this reproduces all the way back to M-53. I suspect the test teams' bisects are just finding the time that their machine was whitelisted for GPU raster, or something like that.

I can't repro on my Mac at all.

Reducing the priority accordingly.

Comment 13 by fs...@chromium.org, May 11 2017

Status: Started (was: Assigned)
Disabling deferral for text rendering should fix this for now.
Project Member

Comment 14 by bugdroid1@chromium.org, May 15 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ee1c820d0133c0536a55b5a0aaf808a97c471bde

commit ee1c820d0133c0536a55b5a0aaf808a97c471bde
Author: fserb <fserb@chromium.org>
Date: Mon May 15 17:07:12 2017

Disable 2D canvas deferral on text rendering when compositing

SkPicture currently has a hard time realizing a surface change may mean
a LCD font rendering change. So we can't send deferred SkPicture when
drawing texts

BUG= 682074 

Review-Url: https://codereview.chromium.org/2877833002
Cr-Commit-Position: refs/heads/master@{#471808}

[modify] https://crrev.com/ee1c820d0133c0536a55b5a0aaf808a97c471bde/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/ee1c820d0133c0536a55b5a0aaf808a97c471bde/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
[modify] https://crrev.com/ee1c820d0133c0536a55b5a0aaf808a97c471bde/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp

Comment 15 by fs...@chromium.org, May 15 2017

Status: Fixed (was: Started)
Please double check on ToT, or on canary in a couple days.
It should be perfect. ;)
Reopen if anything seems weird. PEACE!
Cc: bruthig@chromium.org danakj@chromium.org ericrk@chromium.org sky@chromium.org wkorman@chromium.org
 Issue 729363  has been merged into this issue.
Cc: jvanverth@chromium.org vmi...@chromium.org reed@chromium.org bunge...@chromium.org
 Issue 718113  has been merged into this issue.
Cc: pbomm...@chromium.org
 Issue 737080  has been merged into this issue.

Sign in to add a comment