[libshumate] vector: Calculate correct opacity



commit 2c36bb3f0b65dfabc9820937f43c0ddac050eb11
Author: James Westman <james jwestman net>
Date:   Mon Feb 28 18:14:25 2022 -0600

    vector: Calculate correct opacity

 shumate/vector/shumate-vector-background-layer.c | 4 ++--
 shumate/vector/shumate-vector-fill-layer.c       | 2 +-
 shumate/vector/shumate-vector-line-layer.c       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/shumate/vector/shumate-vector-background-layer.c 
b/shumate/vector/shumate-vector-background-layer.c
index a1b0f7c..d5f3e7e 100644
--- a/shumate/vector/shumate-vector-background-layer.c
+++ b/shumate/vector/shumate-vector-background-layer.c
@@ -77,8 +77,8 @@ shumate_vector_background_layer_render (ShumateVectorLayer *layer, ShumateVector
   shumate_vector_expression_eval_color (self->color, scope, &color);
   opacity = shumate_vector_expression_eval_number (self->opacity, scope, 1.0);
 
-  gdk_cairo_set_source_rgba (scope->cr, &color);
-  cairo_paint_with_alpha (scope->cr, opacity);
+  cairo_set_source_rgba (scope->cr, color.red, color.green, color.blue, color.alpha * opacity);
+  cairo_paint (scope->cr);
 }
 
 
diff --git a/shumate/vector/shumate-vector-fill-layer.c b/shumate/vector/shumate-vector-fill-layer.c
index 080bb7f..2e49ecd 100644
--- a/shumate/vector/shumate-vector-fill-layer.c
+++ b/shumate/vector/shumate-vector-fill-layer.c
@@ -68,7 +68,7 @@ shumate_vector_fill_layer_render (ShumateVectorLayer *layer, ShumateVectorRender
 
   shumate_vector_render_scope_exec_geometry (scope);
 
-  cairo_set_source_rgba (scope->cr, color.red, color.green, color.blue, opacity);
+  cairo_set_source_rgba (scope->cr, color.red, color.green, color.blue, color.alpha * opacity);
   cairo_fill (scope->cr);
 }
 
diff --git a/shumate/vector/shumate-vector-line-layer.c b/shumate/vector/shumate-vector-line-layer.c
index 18fae4b..8e519f4 100644
--- a/shumate/vector/shumate-vector-line-layer.c
+++ b/shumate/vector/shumate-vector-line-layer.c
@@ -87,7 +87,7 @@ shumate_vector_line_layer_render (ShumateVectorLayer *layer, ShumateVectorRender
 
   shumate_vector_render_scope_exec_geometry (scope);
 
-  cairo_set_source_rgba (scope->cr, color.red, color.green, color.blue, opacity);
+  cairo_set_source_rgba (scope->cr, color.red, color.green, color.blue, color.alpha * opacity);
   cairo_set_line_width (scope->cr, width * scope->scale);
   cairo_stroke (scope->cr);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]