FLTK logo

[master] a4bacf8 - Fix for issue #155 - continued

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Library      Forums      Links      Apps     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] a4bacf8 - Fix for issue #155 - continued "ManoloFLTK" Nov 12, 2020  
 
commit a4bacf83c44cdad8161af80f55706a5326dd0c0a
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Nov 12 14:50:45 2020 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Nov 12 14:50:57 2020 +0100

    Fix for issue #155 - continued
    
    Restores proper separation of what is in libfltk and what is in libfltk_images

 FL/Fl_Image.H              | 2 +-
 FL/Fl_SVG_Image.H          | 2 +-
 src/Fl_Graphics_Driver.cxx | 7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git FL/Fl_Image.H FL/Fl_Image.H
index dc09ed7..9151977 100644
--- FL/Fl_Image.H
+++ FL/Fl_Image.H
@@ -302,7 +302,7 @@ private:
   fl_uintptr_t id_;
   fl_uintptr_t mask_;
   int cache_w_, cache_h_; // size of image when cached
-
+  virtual void cache_size(int &width, int &height) {}
 public:
 
   Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0);
diff --git FL/Fl_SVG_Image.H FL/Fl_SVG_Image.H
index 7ced23c..cf76de3 100644
--- FL/Fl_SVG_Image.H
+++ FL/Fl_SVG_Image.H
@@ -147,7 +147,7 @@ private:
   float average_weight_;
   float svg_scaling_(int W, int H);
   void rasterize_(int W, int H);
-  void cache_size(int &width, int &height);
+  virtual void cache_size(int &width, int &height);
   void init_(const char *filename, const char *filedata, Fl_SVG_Image *copy_source);
   Fl_SVG_Image(Fl_SVG_Image *source);
 public:
diff --git src/Fl_Graphics_Driver.cxx src/Fl_Graphics_Driver.cxx
index c5cd9d6..607d148 100644
--- src/Fl_Graphics_Driver.cxx
+++ src/Fl_Graphics_Driver.cxx
@@ -29,7 +29,6 @@
 #include <FL/Fl_Image_Surface.H>
 #include <FL/math.h>
 #include <FL/platform.H>
-#include <FL/Fl_SVG_Image.H>
 
 FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver; // the current driver of graphics operations
 
@@ -211,9 +210,9 @@ void Fl_Graphics_Driver::cache_size(Fl_Image *img, int &width, int &height)
     width  = (width+1) * scale();
     height = (height+1) * scale();
   }
-  if (img->d() == 4 && ((Fl_RGB_Image*)img)->as_svg_image()) { // check for SVG image
-    Fl_SVG_Image *svg = (Fl_SVG_Image*)img;
-    svg->cache_size(width, height);
+  if (img->d() == 4) { // check for depth-4 RGB image
+    Fl_RGB_Image *rgb = (Fl_RGB_Image*)img;
+    rgb->cache_size(width, height);
   }
 }
 
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.