FLTK logo

STR #632

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.1 | SVN ⇄ GIT ]

STR #632

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Image Support
Summary:Fl_Shared_Image::reload does not work proper if image size are changed
Version:1.1.6
Created By:geis.iap.uni-frankfurt
Assigned To:mike
Fix Version:1.1.7
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text  
 
#1 geis.iap.uni-frankfurt
09:17 Nov 25, 2004
Hello
First I would like to say that fltk is a nice GUI Toolkit.
But I think I found a small bug in fltk 1.1.6 and older versions in the file Fl_Shered_Image.cxx.
The funtion Fl_Shared_Image::reload() seems not to do the right thing.

Juste befor the end of the function there is a "if" statement:

if (img) {
    if (alloc_image_) delete image_;

    image_       = img;
    alloc_image_ = 1;

    if ((img->w() != w() && w()) || (img->h() != h() && h())) {
      // Make sure the reloaded image is the same size as the existing one.
      Fl_Image *temp = img->copy(w(), h());
      delete img;
      img = temp;
    }

    update();
  }

I think it should be:


if (img) {
    if (alloc_image_) delete image_;

    if ((img->w() != w() && w()) || (img->h() != h() && h())) {
      // Make sure the reloaded image is the same size as the existing one.
      Fl_Image *temp = img->copy(w(), h());
      delete img;
      img = temp;
    }
    image_       = img;
    alloc_image_ = 1;

    update();
  }

because in the first version the image_ member is not set to the right image data if the witdh and the hights of the image are changed in the inner "if" statement. Simple changing the order of the inner "if" statement and the assignement to image_ =img;  and setting alloc_imange_=1 after the inner if statement should fix it.
Right?
Alternativly you can also change only one line:
        .
        .
       delete img;
       img = temp;
        .
        .

to:
        .
        .
        delete img;
->      image_ = temp;
        .
        .
Gunter

 
 
#2 mike
18:51 Dec 02, 2004
Fixed in CVS - the anonymous CVS repository will be updated at midnight PST.  
     

Return to Bugs & Features ]

 
 

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