summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-09-01 16:11:31 +0200
committerMatthias Melcher <github@matthiasm.com>2024-09-01 16:11:31 +0200
commitaa6ce6b9f1f8462af1fae64a6def10a117053df1 (patch)
tree55a65e4fdcd376e6577a06ed95960c69b9a0cadc
parent634ce805e5de4663fc9efdb288ed5b726af96005 (diff)
Cairo image drawing improvements
-rw-r--r--src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
index e60643c10..113713c46 100644
--- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
+++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx
@@ -802,8 +802,10 @@ void Fl_Cairo_Graphics_Driver::draw_cached_pattern_(Fl_Image *img, cairo_pattern
cairo_save(cairo_);
bool need_extend = (cache_w != Ws || cache_h != Hs || (W >= 2 && H >= 2));
if (need_extend || cx || cy || W < img->w() || H < img->h()) { // clip when necessary
+ cairo_set_antialias(cairo_, CAIRO_ANTIALIAS_NONE);
cairo_rectangle(cairo_, X - 0.5, Y - 0.5, W, H);
cairo_clip(cairo_);
+ cairo_set_antialias(cairo_, CAIRO_ANTIALIAS_DEFAULT);
}
// remove any scaling and the current "0.5" translation useful for lines but bad for images
matrix.xx = matrix.yy = 1;
@@ -814,7 +816,7 @@ void Fl_Cairo_Graphics_Driver::draw_cached_pattern_(Fl_Image *img, cairo_pattern
bool condition = Fl_RGB_Image::scaling_algorithm() == FL_RGB_SCALING_BILINEAR &&
(fabs(Ws/float(cache_w) - 1) > 0.02 || fabs(Hs/float(cache_h) - 1) > 0.02);
cairo_pattern_set_filter(pat, condition ? CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST);
- cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
+ cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
}
cairo_matrix_init_scale(&matrix, double(cache_w)/Ws, double(cache_h)/Hs);
cairo_matrix_translate(&matrix, -Xs , -Ys );