From eb3664edf14c10d9f69b8f8d59ef909014f2a443 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 19 Apr 2018 08:29:33 +0000 Subject: Documentation: add doc for Fl_Graphics_Driver::cache_size() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12856 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Graphics_Driver.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index bdf9fc64b..9d5ea1a25 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -196,6 +196,20 @@ bool Fl_Graphics_Driver::overlay_rect_unscaled() return (scale() == int(scale())); } +/** Converts \p width and \p height from FLTK units to drawing units. + The conversion performed consists in multiplying \p width and \p height by + scale() and in slightly modifying that to help support tiled images. */ +void Fl_Graphics_Driver::cache_size(Fl_Image *img, int &width, int &height) +{ + if ( int(scale_) == scale_ ) { + width = width * scale_; + height = height * scale_; + } else { + width = (width+1) * scale_; + height = (height+1) * scale_; + } +} + #ifndef FL_DOXYGEN Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) { next = 0; @@ -299,17 +313,6 @@ void Fl_Scalable_Graphics_Driver::circle(double x, double y, double r) { ellipse_unscaled(xt*scale_, yt*scale_, rx*scale_, ry*scale_); } -// compute width & height of cached image so it can be tiled without undrawn gaps when scaling output -void Fl_Graphics_Driver::cache_size(Fl_Image *img, int &width, int &height) -{ - if ( int(scale_) == scale_ ) { - width = width * scale_; - height = height * scale_; - } else { - width = (width+1) * scale_; - height = (height+1) * scale_; - } -} void Fl_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) { -- cgit v1.2.3