diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-11-12 07:46:00 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-11-12 07:46:12 +0100 |
| commit | 231159e16c7bd8438f3e567507f5ad394d00c760 (patch) | |
| tree | 7f66a27cc68c3daa5274fa0c53803bf77e07199d /src/drivers | |
| parent | df9749e6a8a72da60d80d9f519377f3c12a9409e (diff) | |
Fix for issue #155 - continued
The issue lies in details how floating point scaled coordinates are converted
to integer values and its impact on the drawing of large SVG images.
This commit fixes the X11 platform.
The macOS platform is immune because drawing uses floating point
coordinates.
The Windows platform still needs fixing.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx | 8 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx | 10 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx index 37507b435..6bc9ad82d 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_image.cxx @@ -400,7 +400,7 @@ void Fl_GDI_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) { void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Bitmap *bm, int X, int Y, int W, int H, int cx, int cy) { X = X*scale(); Y = Y*scale(); - cache_size(W, H); + cache_size(bm, W, H); cx *= scale(); cy *= scale(); HDC tempdc = CreateCompatibleDC(gc_); @@ -500,7 +500,7 @@ void Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img) void Fl_GDI_Graphics_Driver::draw_fixed(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) { X = X*scale(); Y = Y*scale(); - cache_size(W, H); + cache_size(img, W, H); cx *= scale(); cy *= scale(); if (W + cx > img->data_w()) W = img->data_w() - cx; if (H + cy > img->data_h()) H = img->data_h() - cy; @@ -538,7 +538,7 @@ void Fl_GDI_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP, float scaleW = float(rgb->data_w())/rgb->w(); float scaleH = float(rgb->data_h())/rgb->h(); int W = WP, H = HP; - cache_size(W, H); + cache_size(rgb, W, H); HDC new_gc = CreateCompatibleDC(gc_); int save = SaveDC(new_gc); SelectObject(new_gc, (HBITMAP)*Fl_Graphics_Driver::id(rgb)); @@ -628,7 +628,7 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Bitmap *bm) { void Fl_GDI_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int H, int cx, int cy) { X = X*scale(); Y = Y*scale(); - cache_size(W, H); + cache_size(pxm, W, H); cx *= scale(); cy *= scale(); Fl_Region r2 = scale_clip(scale()); if (*Fl_Graphics_Driver::mask(pxm)) { diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H index 67265c304..76edc4134 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H @@ -59,7 +59,7 @@ protected: CGLineJoin quartz_line_join_; CGFloat *quartz_line_pattern; int quartz_line_pattern_size; - virtual void cache_size(int &width, int &height); + virtual void cache_size(Fl_Image* img, int &width, int &height); public: Fl_Quartz_Graphics_Driver(); virtual ~Fl_Quartz_Graphics_Driver() { if (p) free(p); } diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx index f8fab114e..1c5c7e977 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx @@ -154,7 +154,7 @@ void Fl_Quartz_Graphics_Driver::XDestroyRegion(Fl_Region r) { } } -void Fl_Quartz_Graphics_Driver::cache_size(int &width, int &height) { +void Fl_Quartz_Graphics_Driver::cache_size(Fl_Image *img, int &width, int &height) { width *= 2 * scale(); height *= 2 * scale(); } diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index c98cb546f..15ea319bc 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -86,7 +86,7 @@ void Fl_Xlib_Graphics_Driver::scale(float f) { Setting line_delta_ to 1 and offsetting all line, rectangle, text and clip coordinates by line_delta_ achieves what is wanted until scale_ <= 3.5. */ - line_delta_ = (scale() > 1.75 ? 1 : 0); + line_delta_ = (scale() > 1.9/*1.75*/ ? 1 : 0); } #endif } diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx index 2e0b4af50..b20a84cfe 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx @@ -625,7 +625,7 @@ void Fl_Xlib_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) { void Fl_Xlib_Graphics_Driver::draw_fixed(Fl_Bitmap *bm, int X, int Y, int W, int H, int cx, int cy) { X = (X+offset_x_)*scale(); Y = (Y+offset_y_)*scale(); - cache_size(W, H); + cache_size(bm, W, H); cx *= scale(); cy *= scale(); XSetStipple(fl_display, gc_, *Fl_Graphics_Driver::id(bm)); int ox = X-cx; if (ox < 0) ox += bm->w()*scale(); @@ -727,7 +727,7 @@ void Fl_Xlib_Graphics_Driver::cache(Fl_RGB_Image *img) { void Fl_Xlib_Graphics_Driver::draw_fixed(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) { X = (X+offset_x_)*scale(); Y = (Y+offset_y_)*scale(); - cache_size(W, H); + cache_size(img, W, H); cx *= scale(); cy *= scale(); if (img->d() == 1 || img->d() == 3) { XCopyArea(fl_display, *Fl_Graphics_Driver::id(img), fl_window, gc_, cx, cy, W, H, X, Y); @@ -764,9 +764,9 @@ void Fl_Xlib_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP if (!*Fl_Graphics_Driver::id(rgb)) { cache(rgb); } - cache_size(W, H); + cache_size(rgb, W, H); int Wfull = rgb->w(), Hfull = rgb->h(); - cache_size(Wfull, Hfull); + cache_size(rgb, Wfull, Hfull); scale_and_render_pixmap( *Fl_Graphics_Driver::id(rgb), rgb->d(), rgb->data_w() / double(Wfull), rgb->data_h() / double(Hfull), cx*scale(), cy*scale(), (X + offset_x_)*scale(), (Y + offset_y_)*scale(), W, H); @@ -829,7 +829,7 @@ void Fl_Xlib_Graphics_Driver::cache(Fl_Bitmap *bm) { void Fl_Xlib_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm, int X, int Y, int W, int H, int cx, int cy) { X = (X+offset_x_)*scale(); Y = (Y+offset_y_)*scale(); - cache_size(W, H); + cache_size(pxm, W, H); cx *= scale(); cy *= scale(); Fl_Region r2 = scale_clip(scale()); if (*Fl_Graphics_Driver::mask(pxm)) { |
