[goocanvas/goocanvas-2.0] fixed bug painting images with alpha < 1
- From: Damon Chaplin <damon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goocanvas/goocanvas-2.0] fixed bug painting images with alpha < 1
- Date: Fri, 16 Dec 2016 15:16:32 +0000 (UTC)
commit 5f5470f9a5dfcbcfbc6623592ec2f2f5cbb5472e
Author: Damon Chaplin <Damon A Chaplin gmail com>
Date: Fri Dec 16 15:06:17 2016 +0000
fixed bug painting images with alpha < 1
ChangeLog | 6 ++++++
src/goocanvasimage.c | 20 +++++++-------------
2 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d042e78..1db84c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-16 Damon Chaplin <damon gnome org>
+
+ * src/goocanvasimage.c (goo_canvas_image_paint): use cairo_clip() when
+ calling cairo_paint_with_alpha() otherwise it gets messed up.
+ (the flowers in the demo were sometimes painted incorrectly.)
+
2016-12-15 Damon Chaplin <damon gnome org>
* src/goocanvastext.c (goo_canvas_text_get_natural_extents):
diff --git a/src/goocanvasimage.c b/src/goocanvasimage.c
index e470126..28c948f 100644
--- a/src/goocanvasimage.c
+++ b/src/goocanvasimage.c
@@ -502,8 +502,6 @@ goo_canvas_image_paint (GooCanvasItemSimple *simple,
if (!image_data->pattern)
return;
-#if 1
-
/* scale-to-fit means a simple scale, not keeping the aspect ratio.
This does not need to consider the units used. */
if (priv->scale_to_fit)
@@ -541,18 +539,14 @@ goo_canvas_image_paint (GooCanvasItemSimple *simple,
/* To have better performance, we don't use cairo_paint_with_alpha if
* the image is not transparent at all. */
if (priv->alpha != 1.0)
- cairo_paint_with_alpha (cr, priv->alpha);
+ {
+ cairo_clip (cr);
+ cairo_paint_with_alpha (cr, priv->alpha);
+ }
else
- cairo_fill (cr);
-#else
- /* Using cairo_paint() used to be much slower than cairo_fill(), though
- they seem similar now. I'm not sure if it matters which we use. */
- cairo_matrix_init_translate (&matrix, -image_data->x, -image_data->y);
- cairo_pattern_set_matrix (image_data->pattern, &matrix);
- goo_canvas_style_set_fill_options (simple->simple_data->style, cr);
- cairo_set_source (cr, image_data->pattern);
- cairo_paint (cr);
-#endif
+ {
+ cairo_fill (cr);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]