mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 15:46:52 +08:00
Fix Fl_Image::fail() that reported always failure for Fl_Bitmap's.
This commit is contained in:
+1
-1
@@ -202,7 +202,7 @@ void Fl_Image::label(Fl_Menu_Item* m) {
|
|||||||
*/
|
*/
|
||||||
int Fl_Image::fail() const {
|
int Fl_Image::fail() const {
|
||||||
// if no image exists, ld_ may contain a simple error code
|
// if no image exists, ld_ may contain a simple error code
|
||||||
if ((w_ <= 0) || (h_ <= 0) || (d_ <= 0)) {
|
if ((w_ <= 0) || (h_ <= 0) || (d_ <= 0 && count_ == 0)) {
|
||||||
if (ld_ == 0)
|
if (ld_ == 0)
|
||||||
return ERR_NO_IMAGE;
|
return ERR_NO_IMAGE;
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ void chooser_cb(Fl_Widget *, Gl_Image_Window *mainwin) {
|
|||||||
char *fname = fl_file_chooser("select image file", "*.{png,jpg,gif,svg,svgz,xbm,xpm,ico}", NULL, 0);
|
char *fname = fl_file_chooser("select image file", "*.{png,jpg,gif,svg,svgz,xbm,xpm,ico}", NULL, 0);
|
||||||
if (fname) {
|
if (fname) {
|
||||||
Fl_Shared_Image *shared = Fl_Shared_Image::get(fname);
|
Fl_Shared_Image *shared = Fl_Shared_Image::get(fname);
|
||||||
if (shared && shared->w() && shared->h()) {
|
if (shared && !shared->fail()) {
|
||||||
mainwin->copy_label(fname);
|
mainwin->copy_label(fname);
|
||||||
mainwin->set_image(shared);
|
mainwin->set_image(shared);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user