Fix "Cairo: Rect with negative dimensions is still drawn" (#1379)

This commit is contained in:
ManoloFLTK 2026-03-16 12:08:21 +01:00
parent f2fb8eb6bf
commit d28ded0cd5

View File

@ -143,20 +143,20 @@ void Fl_Cairo_Graphics_Driver::set_cairo(cairo_t *cr, float s) {
void Fl_Cairo_Graphics_Driver::rectf(int x, int y, int w, int h) {
if (w < 1 || h < 1) return;
cairo_rectangle(cairo_, x-0.5, y-0.5, w, h);
cairo_set_antialias(cairo_, CAIRO_ANTIALIAS_NONE);
cairo_fill(cairo_);
cairo_set_antialias(cairo_, CAIRO_ANTIALIAS_DEFAULT);
check_status();
surface_needs_commit();
}
void Fl_Cairo_Graphics_Driver::rect(int x, int y, int w, int h) {
if (w <= 1 || h <= 1) return;
cairo_rectangle(cairo_, x, y, w-1, h-1);
if (linestyle_ == FL_SOLID) cairo_set_antialias(cairo_, CAIRO_ANTIALIAS_NONE);
cairo_stroke(cairo_);
if (linestyle_ == FL_SOLID) cairo_set_antialias(cairo_, CAIRO_ANTIALIAS_DEFAULT);
check_status();
surface_needs_commit();
}