Canvas globalAlpha for radial gradient doesn't work with hardware acceleration

RESOLVED FIXED

Status

()

Core
Graphics
RESOLVED FIXED
6 years ago
4 years ago

People

(Reporter: Matt Palmerlee, Unassigned)

Tracking

5 Branch
x86
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

6 years ago
Created attachment 550293 [details]
canvas-hw-accel-test.html

User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30

Steps to reproduce:

Use firefox 5 (or 6 beta) in hardware acceleration mode. Create an html5 canvas, call createRadialGradient on the canvas context, then call addColorStop for the radial gradient, set the globalAlpha before calling fillRect on the canvas context to draw the radial gradient.


Actual results:

When hardware acceleration is turned on, and globalAlpha is modified before drawing a radial gradient, Firefox 5 doesn't render the radial gradients or performance is very slow.


Expected results:

Radial gradients should be rendered to the canvas based on the globalAlpha setting.  IE 9 and Chrome seem to handle this scenario fine, Firefox 5 with hardware acceleration turned on doesn't, without hardware acceleration turned on Firefox 5 loads this page sucessfully.  Also without setting the globalAlpha on the canvas context with hardware acceleration Firefox 5 loads this page fine.
(Reporter)

Comment 1

6 years ago
I don't think that creating the radial gradients is necessary to show this issue, I believe that this issue can be reproduced using other drawing primitives and setting globalAlpha but I have not had time to create a test case for this.
(Reporter)

Updated

6 years ago
See Also: → bug 482751
(Reporter)

Updated

6 years ago
See Also: → bug 649924
Component: Canvas: 2D → Graphics
QA Contact: canvas.2d → thebes
Does this happen in FF4?
(Reporter)

Comment 3

6 years ago
I'm not sure, I tested this in FF 6 beta and it still seemed to be an issue.  I'll see if I can install FF 4 and check it out.
(Reporter)

Comment 4

6 years ago
I was able to test in FF 4.0.1 and I had the same behavior, with H/W acceleration turned on my test page doesn't render anything bug a black box, with H/W acceleration turned off it works (but it seems a bit slow).
Attachment #550293 - Attachment mime type: text/plain → text/html
This is fixed in Azure (so for 7). So this is most likely an issue in how the traditional canvas code (or the Cairo D2D backend) deals with the opacity.

Comment 6

6 years ago
(In reply to comment #5)
> This is fixed in Azure (so for 7). So this is most likely an issue in how
> the traditional canvas code (or the Cairo D2D backend) deals with the
> opacity.

You're right. The html test file works in Aurora (FX7) and Nightly (FX8):
 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0a1) Gecko/20110802 Firefox/8.0a1
 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0a2) Gecko/20110802 Firefox/7.0a2

and the issue is reproducible on Beta (FX6):
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0

So setting this as Resolved. But we'll watch this bug to verify that the issue is still resolved when FX7 is launched in the future (probably October)
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 7

6 years ago
Thanks for confirming that, I look forward to the version 7 release. In the meantime I'll just disable the hardware acceleration in version 5.
Created attachment 550716 [details] [diff] [review]
Properly revoke clip after having filled

There's a bug here in the Canvas code. On a codepath that only gets hit with D2D (non-d2d will use an intermediate surface in this function). It's clipping but not properly removing the clip when done.
Attachment #550716 - Flags: review?(jmuizelaar)
Comment on attachment 550716 [details] [diff] [review]
Properly revoke clip after having filled

Please add a reftest.
Attachment #550716 - Flags: review?(jmuizelaar) → review+
(Reporter)

Comment 10

6 years ago
Created attachment 550908 [details]
Deterministic version of globalAlpha problem without randomness

This attachment removes the randomness from the original bug attachment is so that a reftest can be created.
(Reporter)

Comment 11

6 years ago
I'm kinda a newb when it comes to bugzilla but it sounds like to create a reftest you need a repeatable test, I've uploaded a new testcase that doesn't generate a random starfield and just creates some radial gradients with different global alpha settings.
Hope this helps for creating the reftest for that patch posted.
Yeah, a much simpler testcase can be used to demonstrate this. I'm not sure if it warrants a reftest though. This is a very implementation-specific bug. It's unlikely the reftest would be of any use.
(Reporter)

Comment 13

6 years ago
Ok, thanks. Glad to hear you found the problem!
(Reporter)

Updated

6 years ago
Attachment #550908 - Attachment mime type: text/plain → text/html
(In reply to comment #12)
> Yeah, a much simpler testcase can be used to demonstrate this. I'm not sure
> if it warrants a reftest though. This is a very implementation-specific bug.
> It's unlikely the reftest would be of any use.

I think it's still worth having.
This was actually FIXED by the Azure landing.
Resolution: WORKSFORME → FIXED

Comment 16

4 years ago
The problem is still present in Firefox 22 on Windows (Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0). Disabling hardware acceleration through the Options window restores the correct rendering.
Stanislaw, can you paste the graphics section of your about:support here?

Comment 18

4 years ago
Here it is:


  Graphics

        Adapter Description
        Intel(R) HD Graphics Family

        Adapter Drivers
        igdumd64 igd10umd64 igd10umd64 igdumdx32 igd10umd32 igd10umd32

        Adapter RAM
        Unknown

        ClearType Parameters
        DISPLAY1 [ Gamma: 2200 Pixel Structure: RGB ClearType Level: 100 Enhanced Contrast: 50 ] DISPLAY2 [ Gamma: 2200 Pixel Structure: RGB ClearType Level: 100 Enhanced Contrast: 50 ]

        Device ID
        0x0122

        Direct2D Enabled
        true

        DirectWrite Enabled
        true (6.2.9200.16492)

        Driver Date
        8-31-2011

        Driver Version
        8.15.10.2509

        GPU #2 Active
        false

        GPU Accelerated Windows
        1/1 Direct3D 10

        Vendor ID
        0x8086

        WebGL Renderer
        Google Inc. -- ANGLE (Intel(R) HD Graphics Family)

        AzureCanvasBackend
        direct2d

        AzureContentBackend
        direct2d

        AzureFallbackCanvasBackend
        cairo
That's very surprising. Maybe we regressed this?

Comment 20

4 years ago
If you need any more details about my setup or the canvas code I'm running, let me know.
You need to log in before you can comment on or make changes to this bug.