summaryrefslogtreecommitdiff
path: root/src/Fl_SVG_Image.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-12-18 08:52:55 +0000
committerManolo Gouy <Manolo>2017-12-18 08:52:55 +0000
commit3f9f4debbba0527658ce09044fbff90e332235cc (patch)
treea3a4852ab786012432666a1fe07fdca9f05387dc /src/Fl_SVG_Image.cxx
parent31f16205cb31d724ee93444f5b9b17e7fa3ae3b1 (diff)
STR#3444: Add MacOS support for application rescaling (not quite complete)
With this, most MacOS FLTK app can be scaled with command/+/-/0/ keystrokes. A scaling problem remains, visible in test/cube, where the "Test" string is not positioned correctly. GLUT apps can also be scaled (across platforms). SVG images are re-rasterized after app scaling for optimal drawing. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12594 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_SVG_Image.cxx')
-rw-r--r--src/Fl_SVG_Image.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Fl_SVG_Image.cxx b/src/Fl_SVG_Image.cxx
index d7eb8c83c..fd941d49a 100644
--- a/src/Fl_SVG_Image.cxx
+++ b/src/Fl_SVG_Image.cxx
@@ -193,6 +193,7 @@ void Fl_SVG_Image::rasterize_(int W, int H) {
rasterized_ = true;
raster_w_ = W;
raster_h_ = H;
+//printf("rasterize to %dx%d\n",W, H);
}
@@ -234,10 +235,14 @@ 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) {
- static float f = Fl::screen_driver()->retina_factor();
+ float f = 1;
+ if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) {
+ f = Fl::screen_driver()->retina_factor() * fl_graphics_driver->scale();
+ }
int w1 = w(), h1 = h();
/* When f > 1, there may be several pixels per drawing unit in an area
- of size w() x h() of the display. This occurs, e.g., with Apple retina displays.
+ 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 drawing units. With this procedure,
the SVG image is drawn using the full resolution of the display.
@@ -269,9 +274,6 @@ void Fl_SVG_Image::color_average(Fl_Color c, float i) {
int Fl_SVG_Image::draw_scaled(int X, int Y, int W, int H) {
- if (rasterized_ && raster_w_ >= W && raster_h_ >= H) {
- return fl_graphics_driver->draw_scaled(this, X, Y, W, H);
- }
w(W);
h(H);
draw(X, Y, W, H, 0, 0);