summaryrefslogtreecommitdiff
path: root/src/Fl_SVG_Image.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2020-07-30 17:41:22 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2020-07-30 17:41:35 +0200
commit889acc7d74a8d5c79d4016900294246a9b04b9c2 (patch)
treec261b240934887ba2f720c8c3fe08b9dab301f16 /src/Fl_SVG_Image.cxx
parentf9bdb5a4db18a6641ba9d78d348fb521750a0fde (diff)
Fix use of an SVG image in Fl_Tiled_Image when display is rescaled.
Diffstat (limited to 'src/Fl_SVG_Image.cxx')
-rw-r--r--src/Fl_SVG_Image.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Fl_SVG_Image.cxx b/src/Fl_SVG_Image.cxx
index 06c3beb61..ca9644fe1 100644
--- a/src/Fl_SVG_Image.cxx
+++ b/src/Fl_SVG_Image.cxx
@@ -235,18 +235,18 @@ void Fl_SVG_Image::resize(int width, int height) {
void Fl_SVG_Image::draw(int X, int Y, int W, int H, int cx, int cy) {
- float f = fl_graphics_driver->scale();
- if (fl_graphics_driver->has_feature(Fl_Graphics_Driver::PRINTER)) f *= 2;
- else f *= Fl::screen_driver()->retina_factor();
- int w1 = w(), h1 = h();
- /* When f > 1, there may be several pixels per FLTK unit in an area
+ /* There may be several pixels per FLTK unit in an area
of size w() x h() of the display. This occurs, e.g., with Apple retina displays
and when the display is rescaled.
The SVG is rasterized to the area dimension in pixels. The image is then drawn
scaled to its size expressed in FLTK units. With this procedure,
the SVG image is drawn using the full resolution of the display.
*/
- resize(f*w(), f*h());
+ int w1 = w(), h1 = h();
+ int f = fl_graphics_driver->has_feature(Fl_Graphics_Driver::PRINTER) ? 2 : 1;
+ int w2 = f*w(), h2 = f*h();
+ fl_graphics_driver->cache_size(w2, h2);
+ resize(w2, h2);
scale(w1, h1, 0, 1);
Fl_RGB_Image::draw(X, Y, W, H, cx, cy);
}