bugGnash - The GNU Flash player - Bugs: bug #23365, Agg renders linear gradient...

 
 

bug #23365: Agg renders linear gradient incorrectly

Submitted by:  Bastiaan Jacques <bjacques>
Submitted on:  Mon 26 May 2008 07:44:33 PM UTC  
 
Category: render-aggSeverity: 3 - Normal
Release: NoneStatus: Fixed
Privacy: PublicAssigned to: Udo Giacomozzi <udog>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 28 Nov 2008 09:31:02 AM UTC, comment #13:

No discussion going on...

Benjamin Wolsey <bwy>
Project Member
Thu 29 May 2008 03:20:58 PM UTC, comment #12:

I've already tested it, the bug is fixed. I'm just keeping this open in case Udo wants to discuss any different solutions he comes up with.

Bastiaan Jacques <bjacques>
Project Member
Wed 28 May 2008 02:54:53 PM UTC, comment #11:

Committed a simple patch. Please test.
Trying to optimize it, though.

Udo Giacomozzi <udog>
Project MemberIn charge of this item.
Wed 28 May 2008 09:40:09 AM UTC, comment #10:

span_gradient_alpha only manipulates the alpha channel of the scanline (not R/G/B). probably it's used to set the transparency of a already present buffer.

Udo Giacomozzi <udog>
Project MemberIn charge of this item.
Wed 28 May 2008 08:49:59 AM UTC, comment #9:

span_gradient_alpha, perhaps?

Bastiaan Jacques <bjacques>
Project Member
Wed 28 May 2008 08:38:30 AM UTC, comment #8:

Okay, I found a solution but I'm not happy with it since I think it is not optimal performance-wise.

It needs to premultipy() each pixel in the shape (like bitmap does). I think I'm missing some AGG way to get to the same result... :-/

Index: backend/render_handler_agg_style.h
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_agg_style.h,v
retrieving revision 1.30
diff -r1.30 render_handler_agg_style.h
234c234
< m_gradient_lut.add_color(gr.m_ratio/255.0, agg::rgba8_pre(trans_color.m_r,
---

> m_gradient_lut.add_color(gr.m_ratio/255.0, agg::rgba8(trans_color.m_r,

251a252,255

> for (unsigned int i=0; i<len; i++) {
> span->premultiply();
> span++;
> }

(file #15756)

Udo Giacomozzi <udog>
Project MemberIn charge of this item.
Tue 27 May 2008 09:59:40 PM UTC, comment #7:

The OpenGL renderer also has an extra alpha blending step to force premultiplication. When I remove this step, the OpenGL renderering is identical to the proprietary player. See attached.

So my guess is that premultiplication should not be done for gradient fills; only for bitmap fills.

(file #15753)

Bastiaan Jacques <bjacques>
Project Member
Tue 27 May 2008 09:53:30 PM UTC, comment #6:

I've enabled premultiplication and the result is identical to AGG (see screenshot). So I'm certain the problem lies in that area.

(file #15752)

Bastiaan Jacques <bjacques>
Project Member
Tue 27 May 2008 08:50:35 PM UTC, comment #5:

OpenGL does use Gnash's bitmaps to render gradient, and here's what it looks like (see attached):

(file #15751)

Bastiaan Jacques <bjacques>
Project Member
Tue 27 May 2008 11:40:06 AM UTC, comment #4:

Cairo doesn't use bitmaps for gradients (nor does it use sample_gradient()).

Omitting premultiplication from the gradient might give you a hint as to what's going on.

Bastiaan Jacques <bjacques>
Project Member
Tue 27 May 2008 10:00:07 AM UTC, comment #3:

Anyone familiar with Cairo can tell me if it uses Gnash' fill style bitmaps (fill styles converted to a 256x1 bitmap) or at least fill_style::sample_gradient() in some way?

sample_gradient() should produce the same output as AGG does, but perhaps Cairo has a different (correct) gradient function?

Udo Giacomozzi <udog>
Project MemberIn charge of this item.
Tue 27 May 2008 09:52:35 AM UTC, comment #2:

AGG does a linear interpolation between the color stops. Flash however seems to play with hue/sat/lum or something (the green component has a higher GREEN component than both color stops).

Udo Giacomozzi <udog>
Project MemberIn charge of this item.
Tue 27 May 2008 09:44:09 AM UTC, comment #1:

There is a green, but apparently AGG uses a different gradient function...

Udo Giacomozzi <udog>
Project MemberIn charge of this item.
Mon 26 May 2008 07:44:33 PM UTC, original submission:

See the attachments of bug #20085. The pp rendering is shown in that bug. I'm attaching a screenshot of the current Agg rendering to this bug. Note that it does not have any green.

Cairo renders correctly.

Bastiaan Jacques <bjacques>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #15756:  gradient4bb.swf added by udog (172B - application/x-shockwave-flash)
file #15752:  opengl-screenshot-premultiplied.png added by bjacques (21KiB - image/png - screenshot with OpenGL, with premultiplication)
file #15751:  opengl-screenshot.png added by bjacques (22KiB - image/png - screenshot with OpenGL, incorrectly rendered.)
file #15737:  agg-rendering.png added by bjacques (19KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bwy (Posted a comment)
  • -unavailable- added by strk (Updated the item)
  • -unavailable- added by udog (Updated the item)
  • -unavailable- added by bjacques (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 28 Nov 2008 09:31:02 AM UTCbwyOpen/ClosedOpen=>Closed
    Thu 29 May 2008 03:20:58 PM UTCbjacquesStatusReady For Test=>Fixed
    Thu 29 May 2008 02:50:45 PM UTCstrkStatusFixed=>Ready For Test
    Wed 28 May 2008 08:56:36 PM UTCbjacquesStatusReady For Test=>Fixed
    Wed 28 May 2008 02:54:53 PM UTCudogStatusConfirmed=>Ready For Test
    Wed 28 May 2008 08:38:30 AM UTCudogAttached File-=>Added gradient4bb.swf, #15756
    Tue 27 May 2008 09:59:40 PM UTCbjacquesAttached File-=>Added opengl-screenshot-premultiplied-noalphablend.png, #15753
    Tue 27 May 2008 09:53:29 PM UTCbjacquesAttached File-=>Added opengl-screenshot-premultiplied.png, #15752
    Tue 27 May 2008 08:50:35 PM UTCbjacquesAttached File-=>Added opengl-screenshot.png, #15751
    Tue 27 May 2008 09:12:10 AM UTCudogStatusNone=>Confirmed
    Mon 26 May 2008 07:44:33 PM UTCbjacquesAttached File-=>Added agg-rendering.png, #15737

    Back to the top


    Powered by Savane 3.1-cleanup1