diff options
| author | Manolo Gouy <Manolo> | 2017-07-07 14:31:40 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-07-07 14:31:40 +0000 |
| commit | 7847c2d87ab85b54f846f8ab240b5e866e9a6593 (patch) | |
| tree | 88d7687b30eeaad6681fa28e27a8c70b95f9970a /examples | |
| parent | 22d90078bd81c94cc3b7dce4fd7ca000eed03087 (diff) | |
WIN32 HiDPI support: fix copy and paste of image data when rescaling is applied.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12297 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/clipboard.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/clipboard.cxx b/examples/clipboard.cxx index f21586367..156c520d2 100644 --- a/examples/clipboard.cxx +++ b/examples/clipboard.cxx @@ -37,6 +37,9 @@ Fl_Box *image_box; Fl_Box *image_size; Fl_Text_Display *display; +inline int fl_min(int a, int b) { return (a < b ? a : b); } + + class chess : public Fl_Box { // a box with a chess-like pattern below its image public: chess(int x, int y, int w, int h) : Fl_Box(FL_FLAT_BOX,x,y,w,h,0) { @@ -95,8 +98,11 @@ public: #endif Fl_Shared_Image *oldim = (Fl_Shared_Image*)image_box->image(); if (oldim) oldim->release(); + float scale = fl_graphics_driver->scale(); Fl_Shared_Image *shared = Fl_Shared_Image::get(im); - shared->scale(image_box->w(), image_box->h()); + int width = fl_min(image_box->w(), im->w()/scale); + int height = fl_min(image_box->h(), im->h()/scale); + shared->scale(width, height); image_box->image(shared); // show the scaled image image_size->copy_label(title); value(image_box->parent()); |
