Closed Bug 293353 Opened 20 years ago Closed 19 years ago

Canvas - alpha transparency renders wrong colors

Categories

(Core :: Graphics: Canvas2D, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Peter6, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(4 files)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050508
Firefox/1.0+

See testcase
left to right is red - green - blue
top to bottom transparency 1 to 0 in 0.1 steps

related to bug 293304

testcase next
Attached file testcase
Another testcase I posted on IRC:
http://mozilla.doslash.org/stuff/canvas/test.xhtml
http://mozilla.doslash.org/stuff/canvas/test.png

* rgba(0, 0, 255, 0.5) is like rgba(127, 0, 127, 1), only lighter [because of
the white bgr]
* same for rgba(0, 255, 0, 0.5) / rgba(127, 127, 0, 1)
* rgba(255, 0, 0, 0.5) == rgba(0, 255, 0, 0.5)
So the root problem is that the code above on black bgr draws bright red square.
I.e. if fille style is partially transparent, 255 is added to the actual (BGR)
color before blending(?). This explains all of the above problems.
 ctx.fillStyle = "rgba(0, 0, 0, 0.1)";
 ctx.fillRect(0, 0, 100, 100);
Bug 294134 causes the transparent colors to render worse
This is what it should look like and what it does look like for me on windows
xp...
There is certainly something odd going on; what platform and what builds are
seeing the wrong colors?  If windows and a nightly build, can you post your
display settings? (video card, driver version, display depth)  It's a long shot,
but both stuart and I are having a hard time reproducing this...
(In reply to comment #6)
> There is certainly something odd going on; what platform and what builds are
> seeing the wrong colors?  If windows and a nightly build, can you post your
> display settings? (video card, driver version, display depth)  It's a long shot,
> but both stuart and I are having a hard time reproducing this...

Win2k (3 different machines)
Beast hourly builds
Geforce G200 32-bit color and Geforce G400 32-bit color
default Windows driver/Geforce driver/Nvidia driver (all tried)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050514
Firefox/1.0+ ID:2005051410

For me, the testcase renders the same as the right hand side of 'screensot
before/after Bug 294134 landing'

GeForce4 Ti4400, 1280x1024x32 @ 85Hz, Forceware v76.41
Ah ha, I can reproduce this now with the beast build.  Will take a look tonight.
I see the result from the right of the first screenshot attachment.

nVidia GeForce4 MX.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050514
Firefox/1.0+ ID:2005051409
I just did a local build with the same buildconfig that the nightlies/beast
build uses, and I don't see the wrong colors with this build.  I've zipped it up
at http://www.vlad1.com/~vladimir/misc/firefox-1.0+-vlad.zip -- can those of you
who are seeing the problem try this build and let me know what the test looks like?

The only difference that I'm aware of between my build and the nightly builds is
that mine is built with VC7.1, whereas the nightlies are VC6... that scares me a
little.
With vlad's build from comment 11, the testcase now renders properly, in that it
looks like https://bugzilla.mozilla.org/attachment.cgi?id=183591
(In reply to comment #11)
> I just did a local build with the same buildconfig that the nightlies/beast
> build uses, and I don't see the wrong colors with this build.  I've zipped it up
> at http://www.vlad1.com/~vladimir/misc/firefox-1.0+-vlad.zip -- can those of you
> who are seeing the problem try this build and let me know what the test looks
like?
> 
> The only difference that I'm aware of between my build and the nightly builds is
> that mine is built with VC7.1, whereas the nightlies are VC6... that scares me a
> little.
> 

your build WFM Vlad
I asked on forums if all windows user sees the wrong rendering.
Answer, yes, confirmed problem on ME/98/2k/XP
Ohboy, this will be exciting.  I'll talk to pav and chase tomorrow, see if we
can figure out what's going on.
So much is wrong here!
Vlad,

Bug 293226
Bug 293259
Bug 293304
Bug 293382

are also the result of this
pressed enter to soon.
The 4 bugs above look fine in your build but bad on beast builds
This has gotta block 1.1, at least the complete disaster that is the OS X result.
Flags: blocking-aviary1.1+
(In reply to comment #16)
> Created an attachment (id=183660) [edit]
> screenshot from OS X nightly (may 15)
> 
> So much is wrong here!

this may well have a different cause / need a different bug (Mac specific)

Mac bug is a different issue (I've got a patch for that).
Keywords: testcase
Flags: blocking1.8b3?
What's the status on this bug? It this going to be fixed in time for Firefox 1.1?
It will be fixed for 1.1; I just confirmed that the issue is still there since
the 0.5.0 update, so I'll be trying to figure out what's going on with VC6 this
week.
*** Bug 293304 has been marked as a duplicate of this bug. ***
*** Bug 296252 has been marked as a duplicate of this bug. ***
*** Bug 293226 has been marked as a duplicate of this bug. ***
*** Bug 293382 has been marked as a duplicate of this bug. ***
So; VC6 miscompiles more than a few bits in pixman, in both debug and opt
builds.  There are a lot of macros in use of the form `q = Foo(x,y,a,t);', which
expand out to something like `q = ((t) = ...., (t) = ... t ..., .... t ....;',
with a good amount of shifts and multiple-type casts (e.g. `(uint16_t)
(uint8_t)') happening.  I was able to fix IcOver() by using a few extra
temporary variables, but fixing that just revealed other problems.

I'm not really sure what a solution here is for 1.1/1.8b3; a sufficiently gross
but perhaps workable solution would be to use VC7.1 to generate assembly, and
only assemble with VC6.  The pixman code itself has no external dependencies, so
this shouldn't be difficult, if that ends up being the right way to go.

Flags: blocking1.8b4+
Flags: blocking1.8b3?
Flags: blocking1.8b3-
Blocks: 299019
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050706
Firefox/1.0+ ID:2005070602
This now WFM; since the landing of bug 299407
Per comment 28 and comment 29 this bug is fixed by the patch for bug 299407.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
*** Bug 306755 has been marked as a duplicate of this bug. ***
*** Bug 306755 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: