Closed Bug 913999 Opened 11 years ago Closed 10 years ago

Canvas globalAlpha does not apply to drawWindow

Categories

(Core :: Graphics: Canvas2D, defect)

23 Branch
Other
Other
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: pjs.nl, Assigned: wlitwinczyk)

Details

(Keywords: testcase)

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (masking-agent; rv:17.0) Gecko/17.0 Firefox/17.0 (Nightly/Aurora) Build ID: 20130908004001 Steps to reproduce: I used the canvas drawWindow method after setting the canvas globalAlpha to a value lower than one. (The canvas was contained in a XUL document and the window drawn was a HTML document). Actual results: The drawWindow output was opaque. Expected results: The drawWindow output should have been drawn using the specified opacity level, according to the following source: http://doxygen.db48x.net/mozilla/html/interfacensIDOMCanvasRenderingContext2D.html: "Of course, the rendering obeys the current scale, transform and globalAlpha values."
Could you attach a minimal testcase to the bug, please.
Flags: needinfo?(pjs.nl)
The simplest approach for testing is to modify an existing add-on, such as "Tab Scope". Several of my own restart-less add-ons use drawWindow as well (Monitor Master, Perfect View and Column Reader). In the code, insert e.g. "ctx.globalAlpha = .2;" prior to "ctx.drawWindow(", then re-install. In Firefox 19 up to 25 on Windows 7, setting globalAlpha never has any effect on the output of drawWindow.
Flags: needinfo?(pjs.nl)
Could you attach a minimal extension showing this extension, no need to write someting complex, just a reduced testcase. Or a HTML page.
Keywords: testcase-wanted
Don't be silly, drawWindow cannot be used in HTML. It really is easiest to insert the mentioned line of code into the mentioned extension. Then improve the relevant C++ code and hover the current tab for testing. In case you would rather like me to do it, I am available, and I would love to solve all those bugs with the -moz-element implementation as well (serious offer).
(In reply to pjs.nl from comment #4) > ... > would rather like me to do it, I am available, and I would love to solve all > those bugs with the -moz-element implementation as well (serious offer). Absolutely - that'd be great. If you get something going, just attach the patch to this bug, needinfo me and I will make sure it gets reviewed.
(In reply to Milan Sreckovic [:milan] from comment #5) > Absolutely - that'd be great. If you get something going, just attach the > patch to this bug, needinfo me and I will make sure it gets reviewed. I was thinking of a few months of paid work in someone else's office - but seriously, the mentioned features (drawWindow and -moz-element) are important, especially to extension developers, because they enable truly distinctive functionality. Please fix those outstanding bugs. I myself probably shouldn't do any more C++ coding in my own time :|
Could you attach a simple demo extension showing the issue? It would help to test and debug, especially when hundred bugs are created every day...
Flags: needinfo?(pjs.nl)
This attachment contains a bootstrapped extension that simplifies testing whether canvas drawWindow respects globalAlpha. After installation, hover a tab to see whether the window content is drawn translucently (right) or opaque (wrong) on top of the blue background.
Flags: needinfo?(pjs.nl)
Attachment #805024 - Attachment mime type: application/octet-stream → application/x-xpinstall
I tested with FF26 (and FF23), the result is: http://i.imgur.com/oLsba7X.png It looks fine, no?
No, that image shows the bug -- it's wrong. The blue background, should be bleeding through the entire thing, not just showing through the border.
Status: UNCONFIRMED → NEW
Ever confirmed: true
(In reply to Loic from comment #9) > I tested with FF26 (and FF23), the result is: http://i.imgur.com/oLsba7X.png > It looks fine, no? Looks fine but is wrong - you CONFIRMED the bug ;)
Could someone please update the status of this bug?
Assignee: nobody → wlitwinczyk
Attached patch global_alpha (obsolete) — Splinter Review
Attachment #8448989 - Flags: review?(jgilbert)
Shows the correct blending
Comment on attachment 8448989 [details] [diff] [review] global_alpha Review of attachment 8448989 [details] [diff] [review]: ----------------------------------------------------------------- This is not my code to review.
Attachment #8448989 - Flags: review?(jgilbert) → review?(matt.woodrow)
Comment on attachment 8448989 [details] [diff] [review] global_alpha Review of attachment 8448989 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/canvas/src/CanvasRenderingContext2D.cpp @@ +3658,5 @@ > RefPtr<DrawTarget> drawDT; > + // Rendering directly is faster and can be done if mTarget supports Azure > + // and does not need alpha blending. > + if (gfxPlatform::GetPlatform()->SupportsAzureContentForDrawTarget(mTarget) && > + GlobalAlpha() == 1.0f && NS_GET_A(backgroundColor) == 255) Why do we need to check the background color?
I suppose it's not needed since only RenderDocument() uses backgroundColor.
Attachment #8448989 - Attachment is obsolete: true
Attachment #8448989 - Flags: review?(matt.woodrow)
Attachment #8449565 - Flags: review?(matt.woodrow)
Attachment #8449565 - Flags: review?(matt.woodrow) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Thanks for fixing this! This makes it much easier to do layer composition with drawWindow results :) And hopefully drawWindow will remain fully functional in multi-process Firefox ...
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: