Deprecate Fl_Image_Surface::highres_image() because Fl_Image_Surface::image() is enough now images are scalable.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12905 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2018-05-06 15:59:08 +00:00
parent 41eb376060
commit c6109d9a18
2 changed files with 7 additions and 6 deletions
+6 -5
View File
@@ -37,7 +37,6 @@ Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, i
the value of the display scale factor (see Fl_Graphics_Driver::scale()): the value of the display scale factor (see Fl_Graphics_Driver::scale()):
the resulting image has the same number of pixels as an area of the display of size the resulting image has the same number of pixels as an area of the display of size
\p w x \p h expressed in FLTK units. \p w x \p h expressed in FLTK units.
If \p highres is non-zero, always use Fl_Image_Surface::highres_image() to get the image data.
\param off If not null, the image surface is constructed around a pre-existing \param off If not null, the image surface is constructed around a pre-existing
Fl_Offscreen. The caller is responsible for both construction and destruction of this Fl_Offscreen object. Fl_Offscreen. The caller is responsible for both construction and destruction of this Fl_Offscreen object.
@@ -91,6 +90,7 @@ Fl_RGB_Image *Fl_Image_Surface::image() {
if (need_push) Fl_Surface_Device::push_current(platform_surface); if (need_push) Fl_Surface_Device::push_current(platform_surface);
Fl_RGB_Image *img = platform_surface->image(); Fl_RGB_Image *img = platform_surface->image();
if (need_push) Fl_Surface_Device::pop_current(); if (need_push) Fl_Surface_Device::pop_current();
img->scale(platform_surface->width, platform_surface->height, 1, 1);
return img; return img;
} }
@@ -99,7 +99,8 @@ Fl_RGB_Image *Fl_Image_Surface::image() {
The returned Fl_Shared_Image object is scaled to a size of WxH FLTK units and may have a The returned Fl_Shared_Image object is scaled to a size of WxH FLTK units and may have a
pixel size larger than these values. pixel size larger than these values.
The returned object should be deallocated with Fl_Shared_Image::release() after use. The returned object should be deallocated with Fl_Shared_Image::release() after use.
\version 1.3.4 Deprecated: use image() instead.
\version 1.4 (1.3.4 for MacOS platform only)
*/ */
Fl_Shared_Image* Fl_Image_Surface::highres_image() Fl_Shared_Image* Fl_Image_Surface::highres_image()
{ {
@@ -203,14 +204,14 @@ void fl_scale_offscreen(Fl_Offscreen &ctx) {
} }
} }
if (i >= count_offscreens) return; if (i >= count_offscreens) return;
Fl_Shared_Image *shared = offscreen_api_surface[i]->highres_image(); Fl_RGB_Image *rgb = offscreen_api_surface[i]->image();
offscreen_api_surface[i]->printable_rect(&w, &h); offscreen_api_surface[i]->printable_rect(&w, &h);
fl_delete_offscreen(ctx); fl_delete_offscreen(ctx);
ctx = fl_create_offscreen(w, h); ctx = fl_create_offscreen(w, h);
fl_begin_offscreen(ctx); fl_begin_offscreen(ctx);
shared->draw(0, 0); rgb->draw(0, 0);
fl_end_offscreen(); fl_end_offscreen();
shared->release(); delete rgb;
} }
/** @} */ /** @} */
+1 -1
View File
@@ -576,7 +576,7 @@ void copy(Fl_Widget *, void *data) {
rgb_surf->draw_decorated_window(target->as_window()); rgb_surf->draw_decorated_window(target->as_window());
else else
rgb_surf->draw(target); rgb_surf->draw(target);
Fl_Image *img = rgb_surf->highres_image(); Fl_Image *img = rgb_surf->image();
delete rgb_surf; delete rgb_surf;
Fl_Surface_Device::pop_current(); Fl_Surface_Device::pop_current();
if (img) { if (img) {