Backport fix for issue #185 "Shared Image reload() loses initial dimensions" from branch 1.4
This commit is contained in:
parent
02e4b8f980
commit
eda03f0f88
@ -291,7 +291,11 @@ void Fl_Shared_Image::reload() {
|
||||
if (alloc_image_) delete image_;
|
||||
|
||||
alloc_image_ = 1;
|
||||
|
||||
#if FLTK_ABI_VERSION >= 10304
|
||||
image_ = img;
|
||||
int W = w();
|
||||
int H = h();
|
||||
#else
|
||||
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());
|
||||
@ -300,8 +304,13 @@ void Fl_Shared_Image::reload() {
|
||||
} else {
|
||||
image_ = img;
|
||||
}
|
||||
|
||||
#endif
|
||||
update();
|
||||
#if FLTK_ABI_VERSION >= 10304
|
||||
// Make sure the reloaded image gets the same drawing size as the existing one.
|
||||
if (W)
|
||||
scale(W, H, 0, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user