Closed Bug 1276996 Opened 8 years ago Closed 8 years ago

a text placed on a transparent canvas via fillText has wrong color on its edge

Categories

(Core :: Graphics: Canvas2D, defect)

46 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: nederland074, Unassigned)

Details

(Keywords: regression, regressionwindow-wanted, Whiteboard: [gfx-noted])

Attachments

(2 files)

Attached file working_example.html
If a text is placed on a transparent canvas, it has its edge colored, which is probably not the expected result. 

Steps to reproduce:
1) create an html file with a white background and a canvas
2) set fillStyle to "#fff"
3) draw some text on the canvas via fillText

What happened:
The text is slightly visible and has light blue and light yellow color.

What should have happened:
Nothing should be visible - a white text on a white background.

Where it's reproduced:
This is reproduced on Ubuntu 14.04/15.04/15.10/16.04 regardless of the GPU used. This doesn't happen on Windows 7, Windows 8.1 and OS X 10.10.3. The issue appears since 46.0.1 version, but in 45.0.2 and 45.1.1esr it works as expected.

Details:
* This is the most noticeable when drawing a white text (see the "firefox_canvas_filltext.html" attachment). 
* Clearing the canvas via fillRect() with an opaque color before drawing the text fixes this issue.
Comment on attachment 8758353 [details]
working_example.html

><!DOCTYPE html>
><html>
>
><head>
>    <script>
>        function test() {
>            var canvas = document.getElementById("canvas");
>
>            var ctx = canvas.getContext("2d");
>            ctx.font = "50px Arial";
>            ctx.fillStyle = "#fff";
>            ctx.fillText("Lorem ipsum", 5, 50);
>        }
>    </script>
></head>
>
><body onload="test();" style="background-color: #fff;">
>    <canvas id="canvas" style="width:500px;height:300px;border:3px solid red;"></canvas>
></body>
>
></html>
Attachment #8758353 - Attachment description: firefox_canvas_filltext.html → working_example.html
Attachment #8758353 - Attachment filename: firefox_canvas_filltext.html → working_example.html
Attached file wrong_colors.html
Fixed attachments:
"attachment 8758355 [details]" - the file where the issue is reproduced
"attachment 8758353 [details]" - a test case with clearing the canvas before drawing the text
Milan, graphics or canvas issue?

Reporter, any chance you could check when exactly this broke using mozregression? ( http://mozilla.github.io/mozregression/ )
Component: General → Canvas: 2D
Flags: needinfo?(nederland074)
Flags: needinfo?(milan)
Product: Firefox → Core
I can reproduce this issue with canvas cairo backend but can't reproduce this with canvas skia backend. This should be related to 2D backend issue. I will check this bug.
Assignee: nobody → howareyou322
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(milan)
Whiteboard: [gfx-noted]
I can reproduce this on OSX by switch gfx.canvas.azure.backends to cairo.
(In reply to nederland074 from comment #0)
> Where it's reproduced:
> This is reproduced on Ubuntu 14.04/15.04/15.10/16.04 regardless of the GPU
> used. This doesn't happen on Windows 7, Windows 8.1 and OS X 10.10.3. The
> issue appears since 46.0.1 version, but in 45.0.2 and 45.1.1esr it works as
> expected.
I can reproduce this issue in FF40/41 with canvas cairo.

nederland074, about the workable version, which backend(gfx.canvas.azure.backends) do you see from about:config page?
Now skia canvas is on by default on Linux after bug 1244754(FF 48).
Therefore, now I don't see the value to fix this issue in cairo, un-assigned the bug.

nederland074, maybe you can switch this bug to workforme if FF48 works for you.
Assignee: howareyou322 → nobody
Status: ASSIGNED → NEW
(In reply to Peter Chang[:pchang] from comment #7)
> I can reproduce this issue in FF40/41 with canvas cairo.
> 
> nederland074, about the workable version, which
> backend(gfx.canvas.azure.backends) do you see from about:config page?


OS X 10.10.3 - "skia"
Win7/Win8.1 - "direct2d1.1,direct2d,skia,cairo"
Linux - "cairo" in 45.0.2 (but in non-workable 46.0.1 it's also "cairo")


(In reply to Peter Chang[:pchang] from comment #8)
> Now skia canvas is on by default on Linux after bug 1244754(FF 48).
> Therefore, now I don't see the value to fix this issue in cairo, un-assigned
> the bug.
> 
> nederland074, maybe you can switch this bug to workforme if FF48 works for
> you.

Yes, FF48 works for me, moreover switching to "skia" removes this issue in other versions. 
Thank you, Peter, will wait for the stable FF48.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
This is what I've found with mozregression:


15:41.65 INFO: Narrowed inbound regression window from [16bb246d, 082d9636] (3 revisions) to [16bb246d, 8cd99e9b] (2 revisions) (~1 steps left)
15:41.65 INFO: Oh noes, no (more) inbound revisions :(
15:41.65 INFO: Last good revision: 16bb246db6427c4131383beb1f71076ffedefc23
15:41.65 INFO: First bad revision: 8cd99e9b6034a6417ba17b426e6537ccb8aa9bf2
15:41.65 INFO: Pushlog:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=16bb246db6427c4131383beb1f71076ffedefc23&tochange=8cd99e9b6034a6417ba17b426e6537ccb8aa9bf2

15:42.98 INFO: Looks like the following bug has the changes which introduced the regression:
https://bugzilla.mozilla.org/show_bug.cgi?id=1180942
Flags: needinfo?(nederland074)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: