WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
65365
Alpha value of 0.5 results in fully transparent pixel in ARGB1555 format
https://bugs.webkit.org/show_bug.cgi?id=65365
Summary
Alpha value of 0.5 results in fully transparent pixel in ARGB1555 format
Denis Oliver Kropp
Reported
2011-07-29 03:53:36 PDT
The following code shows a canvas with a rectangle filled using 0.5 for alpha. The CSS Parser converts 0.5 to 127 which leads to a fully transparent pixel on ARGB1555 surfaces, while one would expect that everything >= 0.5 would result in fully opaque pixel. To fix this the static translation in CSSParser.cpp needs to be changed. <html> <head> <title>HTML5 Test</title> <script type="text/javascript"> function draw() { var canvas = document.getElementById("can"); var style = canvas.style; style.left = 200; style.top = 200; if (canvas.getContext) { var context = canvas.getContext("2d"); context.fillStyle = "rgb(255,0,0)"; context.fillRect (0,0,50,50); context.fillStyle = "rgba(0,200,200,0.5)"; //context.fillStyle = "rgb(0,200,200)"; context.fillRect (25,25,75,75); context.fillStyle = "rgb(0,0,0)"; context.fillRect (0,75,50,25); } } </script> <style type="text/css"> #can { border: 1px solid white; position: absolute; } </style> </head> <body bgcolor="#1a1a1a" onload="draw();"> <p> <span style="color:#a717a1; font-size:30px"> HTML5 Canvas Over Video Test </span> </p> <div id="vid_div" style="border:1px solid white;width:400;height:400;" > <video id="1" src="" width=400 height=400 controls> </video> </div> <div id="d"> <canvas id="can" width="100" height="100"> </canvas> </div> </body> </html>
Attachments
Proposed bug fix
(1.30 KB, patch)
2011-07-29 04:03 PDT
,
Denis Oliver Kropp
simon.fraser
: review-
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Denis Oliver Kropp
Comment 1
2011-07-29 04:03:34 PDT
Created
attachment 102342
[details]
Proposed bug fix
Denis Oliver Kropp
Comment 2
2011-07-29 04:08:18 PDT
I need to add that in this case the video player implementation (element below canvas) just fills the area with transparent pixels, so the 0.5 alpha rectangle is supposed to change transparency from 0 to 128 based on SrcOver composition.
WebKit Review Bot
Comment 3
2011-07-29 04:25:35 PDT
Comment on
attachment 102342
[details]
Proposed bug fix
Attachment 102342
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/9265446
New failing tests: fast/canvas/rgba-parsing.html fast/canvas/canvas-bg.html fast/canvas/canvas-as-image.html fast/canvas/canvas-bg-zoom.html fast/canvas/canvas-strokePath-shadow.html
Simon Fraser (smfr)
Comment 4
2011-07-29 16:05:29 PDT
Comment on
attachment 102342
[details]
Proposed bug fix View in context:
https://bugs.webkit.org/attachment.cgi?id=102342&action=review
> Source/WebCore/ChangeLog:8 > + Reviewed by NOBODY (OOPS!). > + > + No new tests.
This needs some explanation of what you changed and why, and you need a test.
Shane Stephens
Comment 5
2011-11-23 19:52:25 PST
The tenth alpha values that Denis' patch modifies are all truncated when they should probably be rounded.
Brent Fulgham
Comment 6
2022-07-12 15:02:02 PDT
This seems to work fine in modern Safari 15.5. Please REOPEN if you can provide further details.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug