double rendering of borders ...

Ivan Timofeev timofeev.i.s at gmail.com
Wed Aug 1 08:56:40 PDT 2012


Hi Michael,

On 01.08.2012 13:24, Michael Meeks wrote:
> 	I was at GUADEC just now, and trying to get toolbar rendering sorted
> out for gtk3 - which turned out to be quite 'fun' ;-) it seems that the
> toolbar items we have have a WB_BORDER style set which appears to create
> a strange border rendering widget; which renders the entire toolbar
> combo-box (eg. the font selector) twice at least. Quite apart from the
> wastefulness there, with the new alpha transparent borders - we get a
> double compositing which over-darkens the pretty alpha effects there :-)

With gtk3 I see similar effect for normal (not toolbar) buttons, edits 
etc. Why do you think this is related to toolbars?

I solved the problem by the following change in renderAreaToPix: 
cairo_data[x*4+0] * alpha

@@ -972,9 +972,9 @@ void GtkSalGraphics::renderAreaToPix( cairo_t *cr,
          for (int x = 0; x < awidth && y < aheight; ++x)
          {
              double alpha = ((float)cairo_data[x*4 + 3])/255.0;
-            src[x*3 + 0] = src[x*3 + 0] * (1.0 - alpha) + 
cairo_data[x*4+0] * alpha;
-            src[x*3 + 1] = src[x*3 + 1] * (1.0 - alpha) + 
cairo_data[x*4+1] * alpha;
-            src[x*3 + 2] = src[x*3 + 2] * (1.0 - alpha) + 
cairo_data[x*4+2] * alpha;
+            src[x*3 + 0] = src[x*3 + 0] * (1.0 - alpha) + 
cairo_data[x*4+0];
+            src[x*3 + 1] = src[x*3 + 1] * (1.0 - alpha) + 
cairo_data[x*4+1];
+            src[x*3 + 2] = src[x*3 + 2] * (1.0 - alpha) + 
cairo_data[x*4+2];
          }
          src += nStride;
          cairo_data += cairo_stride;

no idea of what's going on though, because I'm not familiar with alpha 
blending.

HTH,

Ivan


More information about the LibreOffice mailing list