Fix for issue #185 "Shared Image reload() loses initial dimensions"

This commit is contained in:
ManoloFLTK 2021-02-12 07:32:35 +01:00
parent c7dc112d2e
commit 5ade8fcb09

View File

@ -280,17 +280,13 @@ void Fl_Shared_Image::reload() {
if (alloc_image_) delete image_;
alloc_image_ = 1;
if ((img->w() != data_w() && data_w()) || (img->h() != data_h() && data_h())) {
// Make sure the reloaded image is the same size as the existing one.
Fl_Image *temp = img->copy(data_w(), data_h());
delete img;
image_ = temp;
} else {
image_ = img;
}
image_ = img;
int W = w();
int H = h();
update();
// Make sure the reloaded image gets the same drawing size as the existing one.
if (W)
scale(W, H, 0, 1);
}
}