summaryrefslogtreecommitdiff
path: root/src/cairo-beos-surface.cpp
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@web.de>2005-12-19 17:16:28 +0000
committerChristian Biesinger <cbiesinger@web.de>2005-12-19 17:16:28 +0000
commit606d23b2874288c18f7373ffa47b0fb6b63b3451 (patch)
tree66eef6039a9851830f43f9711fabfa0189c7b06a /src/cairo-beos-surface.cpp
parentd0eaab305c69b386fde72fb0a325df2c5d62385d (diff)
Use correct color when OPERATOR_SOURCE is used on a surface without alpha information.
Diffstat (limited to 'src/cairo-beos-surface.cpp')
-rw-r--r--src/cairo-beos-surface.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cairo-beos-surface.cpp b/src/cairo-beos-surface.cpp
index d9c3a953..03abd11b 100644
--- a/src/cairo-beos-surface.cpp
+++ b/src/cairo-beos-surface.cpp
@@ -567,6 +567,17 @@ _cairo_beos_fill_rectangles (void *abstract_surface,
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);