Premultiplied alpha handle for driver
Huang, FrankR
FrankR.Huang at amd.com
Thu Jun 3 02:02:03 PDT 2010
Morton,
I have fix the OVER opearion on geode.
For current bug, explain my solve method. I use two steps to finish the OVER rendering, the first step is to do the SRC*(alpha of MASK),the result is SRC'
that is to say:
SRC'r = SRCr * alpha of MASK
SRC'g = SRCg * alpha of MASK
SRC'b = SRCb * alpha of MASK
SRC'a = SRCa * alpha of MASK
I put the result to a off-screen FB regeion.The next step is to do SRC' + (1- SRC'a)DEST, because the screen is RGB565, so omit the SRC''a. that is to say:
SRC''r = SRC'r + (1- SRC'a)DEST
SRC''g = SRC'g + (1- SRC'a)DEST
SRC''b = SRC'b + (1- SRC'a)DEST
Taks an example:
SRC = ARGB(0x949c4e27) MASK = A8(0x75)
So SRC' = ARGB(0x43472311)
Then SRC'' = RGB565...
The bug before is that the driver does a a*A+ (1-a)*B for OVER opearation. It is absolutely wrong. The real OVER operation should be A+(1-a)*B.
Attach three pictures for comparison. Still I will correct other bugs on rendering.
Geodepro_old.PNG is the old driver result for progressbar.
Geodepro.PNG is the new driver result for progressbar.
X1200pro.png is the ATI X1200 result for progressbar.
Thanks,
Frank
-----Original Message-----
From: Jonathan Morton [mailto:jonathan.morton at movial.com]
Sent: 2010年6月2日 2:02
To: Siarhei Siamashka
Cc: xorg-devel at lists.x.org; Huang, FrankR
Subject: Re: Premultiplied alpha handle for driver
On Tue, 2010-06-01 at 19:26 +0300, Siarhei Siamashka wrote:
> On Tuesday 01 June 2010, Jonathan Morton wrote:
> > On Mon, 2010-05-31 at 10:42 +0800, Huang, FrankR wrote:
> > > We know the premultiplied alpha will be used sometimes in blend. Is
> > > that used in the graphics driver?
> >
> > XRender always expects premultiplied alpha in images. Your previous
> > example, with ARGB values of (100,255,0,0) is therefore an invalid pixel
> > vector, since the R channel is greater than the A channel.
>
> This is not necessarily invalid. It's more like "additive blending" feature
> which is even used by some people:
> http://home.comcast.net/~tom_forsyth/blog.wiki.html#[[Premultiplied%20alpha]]
Well, that's a corner case, but I was trying to get a conceptual point
across.
--
------
From: Jonathan Morton
jonathan.morton at movial.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x1200pro.png
Type: image/png
Size: 3452 bytes
Desc: x1200pro.png
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100603/cb553fb6/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geodepro.png
Type: image/png
Size: 4226 bytes
Desc: geodepro.png
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100603/cb553fb6/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geodepro_old.PNG
Type: image/png
Size: 8411 bytes
Desc: geodepro_old.PNG
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100603/cb553fb6/attachment-0002.png>
More information about the xorg-devel
mailing list