From 13b47c55423c7282469968604ade2c07284a3f46 Mon Sep 17 00:00:00 2001 From: 5cript Date: Tue, 9 Jul 2019 17:37:32 +0200 Subject: [PATCH] Fixed wrong color for filling. --- draw_context.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/draw_context.cpp b/draw_context.cpp index d91f540..66b7b27 100644 --- a/draw_context.cpp +++ b/draw_context.cpp @@ -13,19 +13,21 @@ namespace Cairo } void DrawContext::fill(color_space r, color_space g, color_space b, color_space a) { - save(); - cairo_set_source_rgba (ctx_, r, g, b, a); + save(); + cairo_set_source_rgba( + ctx_, + static_cast (r) / colorMax, + static_cast (g) / colorMax, + static_cast (b) / colorMax, + static_cast (a) / colorMax + ); cairo_set_operator(ctx_, CAIRO_OPERATOR_SOURCE); cairo_paint(ctx_); restore(); } void DrawContext::fill(RGBA color) { - save(); - cairo_set_source_rgba (ctx_, color.r, color.g, color.b, color.a); - cairo_set_operator(ctx_, CAIRO_OPERATOR_SOURCE); - cairo_paint(ctx_); - restore(); + fill(color.r, color.g, color.b, color.a); } void DrawContext::save() {