1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-22 22:28:02 +01:00

WPrefs: changed renderTexture to always fallback to solid black when image can't be loaded

As raised by Carlos R. Mafra and Doug Torrance, when an image is used in a
texture but the image cannot be loaded, there are some case where WPrefs
misbehaves.
This patch display a warning in every case where the image could not be
loaded, and always switch to black texture as a fallback, which was not the
case previously.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-19 19:51:28 +02:00
committed by Carlos R. Mafra
parent 1a01ac103f
commit 8c6525a2b7

View File

@@ -512,12 +512,16 @@ static Pixmap renderTexture(WMScreen * scr, WMPropList * texture, int width, int
path = wfindfileinarray(GetObjectForKey("PixmapPath"), str);
if (path) {
timage = RLoadImage(rc, path, 0);
if (!timage) {
wwarning("could not load file '%s': %s", path ? path : str, RMessageForError(RErrorCode));
texture = WMCreatePropListFromDescription("(solid, black)");
type = "solid";
}
if (!timage)
wwarning("could not load file '%s': %s", path, RMessageForError(RErrorCode));
wfree(path);
} else {
wwarning("could not find file '%s' for %s of texture", str, type);
timage = NULL;
}
if (!timage) {
texture = WMCreatePropListFromDescription("(solid, black)");
type = "solid";
}
}