From 15daac26e7b6280dd02f7f2e3ca7171db297bac1 Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Mon, 29 Aug 2016 15:24:49 +0000 Subject: [PATCH] cairo support for layer level comp-op and opacity --- src/cairo/cairo_renderer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cairo/cairo_renderer.cpp b/src/cairo/cairo_renderer.cpp index 0fbb00972..43c3ffef4 100644 --- a/src/cairo/cairo_renderer.cpp +++ b/src/cairo/cairo_renderer.cpp @@ -188,12 +188,25 @@ void cairo_renderer::start_layer_processing(layer const& lay, box2d c common_.detector_->clear(); } common_.query_extent_ = query_extent; + + if (lay.comp_op() || lay.get_opacity() < 1.0) + { + context_.push_group(); + } } template -void cairo_renderer::end_layer_processing(layer const&) +void cairo_renderer::end_layer_processing(layer const& lay) { MAPNIK_LOG_DEBUG(cairo_renderer) << "cairo_renderer: End layer processing"; + + if (lay.comp_op() || lay.get_opacity() < 1.0) + { + context_.pop_group(); + composite_mode_e comp_op = lay.comp_op() ? *lay.comp_op() : src_over; + context_.set_operator(comp_op); + context_.paint(lay.get_opacity()); + } } template