[cairo-commit] cairo/src cairo-beos-surface.cpp,1.3,1.4

Christian Biesinger commit at pdx.freedesktop.org
Mon Dec 19 17:16:31 PST 2005


Committed by: biesi

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv16391/src

Modified Files:
	cairo-beos-surface.cpp 
Log Message:
2005-12-20  Christian Biesinger  <cbiesinger at web.de>

	* src/cairo-beos-surface.cpp: Use correct color when OPERATOR_SOURCE
	is used on a surface without alpha information.




Index: cairo-beos-surface.cpp
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-beos-surface.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-beos-surface.cpp	19 Dec 2005 19:01:43 -0000	1.3
+++ cairo-beos-surface.cpp	20 Dec 2005 01:16:28 -0000	1.4
@@ -567,6 +567,17 @@
     if (mode == B_OP_ALPHA && be_color.alpha == 0xFF)
 	mode = B_OP_COPY;
 
+    // For CAIRO_OPERATOR_SOURCE, cairo expects us to use the premultiplied
+    // color info. This is only relevant when drawing into an rgb24 buffer
+    // (as for others, we can convert when asked for the image)
+    if (mode == B_OP_COPY &&
+	(!surface->bitmap || surface->bitmap->ColorSpace() != B_RGBA32))
+    {
+	be_color.red = premultiply(be_color.red, be_color.alpha);
+	be_color.green = premultiply(be_color.green, be_color.alpha);
+	be_color.blue = premultiply(be_color.blue, be_color.alpha);
+    }
+
     surface->view->PushState();
 
 	surface->view->SetDrawingMode(mode);



More information about the cairo-commit mailing list