summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-03-28 13:00:12 +0000
committerManolo Gouy <Manolo>2018-03-28 13:00:12 +0000
commit458d0636436b5f25e444dc285007dceac296c2ee (patch)
tree88510e081d4f4199db92879b4a1960ea22204769 /FL
parent29bda776bb78352b331771bd1169de31e4edc1be (diff)
Image classes: memorise the width and the height of the cached form of the image to support GUI scaling
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12811 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Bitmap.H6
-rw-r--r--FL/Fl_Graphics_Driver.H21
-rw-r--r--FL/Fl_Image.H4
-rw-r--r--FL/Fl_Pixmap.H2
4 files changed, 21 insertions, 12 deletions
diff --git a/FL/Fl_Bitmap.H b/FL/Fl_Bitmap.H
index 03f1a62e8..79eba0a4b 100644
--- a/FL/Fl_Bitmap.H
+++ b/FL/Fl_Bitmap.H
@@ -44,15 +44,15 @@ private:
int &X, int &Y, int &W, int &H);
/** for internal use */
fl_uintptr_t id_;
- float cache_scale_; // graphics scaling value when id_ was computed
+ int cache_w_, cache_h_; // size of bitmap when cached
public:
/** The constructors create a new bitmap from the specified bitmap data */
Fl_Bitmap(const uchar *bits, int W, int H) :
- Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0), cache_scale_(1) {data((const char **)&array, 1);}
+ Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0), cache_w_(0),cache_h_(0) {data((const char **)&array, 1);}
/** The constructors create a new bitmap from the specified bitmap data */
Fl_Bitmap(const char *bits, int W, int H) :
- Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_scale_(1) {data((const char **)&array, 1);}
+ Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_w_(0),cache_h_(0) {data((const char **)&array, 1);}
virtual ~Fl_Bitmap();
virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return Fl_Image::copy(); }
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H
index c1588703b..fbd1b71ed 100644
--- a/FL/Fl_Graphics_Driver.H
+++ b/FL/Fl_Graphics_Driver.H
@@ -199,12 +199,21 @@ protected:
static fl_uintptr_t* mask(Fl_RGB_Image *rgb) {return &(rgb->mask_);}
/** Accessor to a private member variable of Fl_Pixmap */
static fl_uintptr_t* mask(Fl_Pixmap *pm) {return &(pm->mask_);}
- /** Accessor to a private member variable of Fl_Pixmap */
- static float* cache_scale(Fl_Pixmap *pm) {return &(pm->cache_scale_);}
- /** Accessor to a private member variable of Fl_Bitmap */
- static float* cache_scale(Fl_Bitmap *bm) {return &(bm->cache_scale_);}
- /** Accessor to a private member variable of Fl_RGB_Image */
- static float* cache_scale(Fl_RGB_Image *rgb) {return &(rgb->cache_scale_);}
+ /** Accessor to private member variables of Fl_Pixmap */
+ static void cache_w_h(Fl_Pixmap *pm, int*& pwidth, int*& pheight) {
+ pwidth = &(pm->cache_w_);
+ pheight = &(pm->cache_h_);
+ }
+ /** Accessor to private member variables of Fl_Bitmap */
+ static void cache_w_h(Fl_Bitmap *bm, int*& pwidth, int*& pheight) {
+ pwidth = &(bm->cache_w_);
+ pheight = &(bm->cache_h_);
+ }
+ /** Accessor to private member variables of Fl_RGB_Image */
+ static void cache_w_h(Fl_RGB_Image *rgb, int*& pwidth, int*& pheight) {
+ pwidth = &(rgb->cache_w_);
+ pheight = &(rgb->cache_h_);
+ }
/** Accessor to a private member variable of Fl_Pixmap */
static Fl_Color* pixmap_bg_color(Fl_Pixmap *pm) {return &(pm->pixmap_bg_color);}
/** For internal library use only */
diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H
index 41783639d..0a590a1af 100644
--- a/FL/Fl_Image.H
+++ b/FL/Fl_Image.H
@@ -262,8 +262,8 @@ private:
// These two variables are used to cache the image and mask for the main display graphics driver
fl_uintptr_t id_;
fl_uintptr_t mask_;
- float cache_scale_; // graphics scaling value when id_ was computed
-
+ int cache_w_, cache_h_; // size of image when cached
+
public:
Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0);
diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H
index fa45b3fbb..d5c0612db 100644
--- a/FL/Fl_Pixmap.H
+++ b/FL/Fl_Pixmap.H
@@ -55,7 +55,7 @@ private:
fl_uintptr_t id_;
fl_uintptr_t mask_;
Fl_Color pixmap_bg_color;
- float cache_scale_; // graphics scaling value when id_ was computed
+ int cache_w_, cache_h_; // size of pixmap when cached
public: