Skip to content

Commit

Permalink
Rewrite static function Fl_Image_Surface::rescale(Fl_Image_Surface*&)…
Browse files Browse the repository at this point in the history
… as member function Fl_Image_Surface::rescale().

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12936 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed May 25, 2018
1 parent b721f51 commit bbd5514
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion FL/Fl_Image_Surface.H
Expand Up @@ -86,7 +86,7 @@ public:
void origin(int x, int y);
int printable_rect(int *w, int *h);
Fl_Offscreen offscreen();
static void rescale(Fl_Image_Surface*& surf);
void rescale();
};


Expand Down
20 changes: 11 additions & 9 deletions src/Fl_Image_Surface.cxx
Expand Up @@ -118,16 +118,18 @@ Fl_Offscreen Fl_Image_Surface::get_offscreen_before_delete_() {
return keep;
}

/** Adapts an Fl_Image_Surface object to the new value of the GUI scale factor.
/** Adapts the Fl_Image_Surface object to the new value of the GUI scale factor.
The Fl_Image_Surface object must not be the current drawing surface.
This function is useful only for an object constructed with non-zero \p high_res parameter.
\version 1.4
*/
void Fl_Image_Surface::rescale(Fl_Image_Surface*& surface) {
Fl_RGB_Image *rgb = surface->image();
void Fl_Image_Surface::rescale() {
Fl_RGB_Image *rgb = image();
int w, h;
surface->printable_rect(&w, &h);
delete surface;
surface = new Fl_Image_Surface(w, h, 1);
Fl_Surface_Device::push_current(surface);
printable_rect(&w, &h);
delete platform_surface;
platform_surface = Fl_Image_Surface_Driver::newImageSurfaceDriver(w, h, 1, 0);
Fl_Surface_Device::push_current(this);
rgb->draw(0,0);
Fl_Surface_Device::pop_current();
delete rgb;
Expand Down Expand Up @@ -170,7 +172,7 @@ static int find_slot(void) { // return an available slot to memorize an Fl_Image
<tr> <td>fl_begin_offscreen(off)</td><td>Fl_Surface_Device::push_current(surface)</td> </tr>
<tr> <td>fl_end_offscreen()</td><td>Fl_Surface_Device::pop_current()</td> </tr>
<tr> <td>fl_copy_offscreen(x,y,w,h, off, sx,sy)</td><td>fl_copy_offscreen(x,y,w,h, surface->offscreen(), sx,sy)</td> </tr>
<tr> <td>fl_rescale_offscreen(off)</td><td>Fl_Image_Surface::rescale(surface)</td> </tr>
<tr> <td>fl_rescale_offscreen(off)</td><td>surface->rescale()</td> </tr>
<tr> <td>fl_delete_offscreen(off)</td><td>delete surface</td> </tr>
</table>
*/
Expand Down Expand Up @@ -229,7 +231,7 @@ void fl_rescale_offscreen(Fl_Offscreen &ctx) {
}
}
if (i >= count_offscreens) return;
Fl_Image_Surface::rescale(offscreen_api_surface[i]);
offscreen_api_surface[i]->rescale();
ctx = offscreen_api_surface[i]->offscreen();
}

Expand Down

0 comments on commit bbd5514

Please sign in to comment.