summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrjohnson <rjohnson>1998-07-24 16:45:15 (GMT)
committerrjohnson <rjohnson>1998-07-24 16:45:15 (GMT)
commit0c6ab9f2b7a1bd0be31dd6dea710fe785186fe66 (patch)
tree8161967b4c1fdc61e0f6ed9463ba9a54f4e6cc6a
parentc479c8f0aedf94b562a60c2193d32d53180c9e61 (diff)
downloadtk-0c6ab9f2b7a1bd0be31dd6dea710fe785186fe66.zip
tk-0c6ab9f2b7a1bd0be31dd6dea710fe785186fe66.tar.gz
tk-0c6ab9f2b7a1bd0be31dd6dea710fe785186fe66.tar.bz2
made interp optional in TkGetBmapData
other changes to bitmap code
-rw-r--r--generic/tkImgBmap.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index f8a1d6e..03ebd1d 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -31,10 +31,10 @@ typedef struct BitmapMaster {
* deleted. */
int width, height; /* Dimensions of image. */
char *data; /* Data comprising bitmap (suitable for
- * input to XCreateBitmapFromData). May
+ * input to TkCreateBitmapFromData). May
* be NULL if no data. Malloc'ed. */
char *maskData; /* Data for bitmap's mask (suitable for
- * input to XCreateBitmapFromData).
+ * input to TkCreateBitmapFromData).
* Malloc'ed. */
Tk_Uid fgUid; /* Value of -foreground option (malloc'ed). */
Tk_Uid bgUid; /* Value of -background option (malloc'ed). */
@@ -375,7 +375,7 @@ ImgBmapConfigureInstance(instancePtr)
instancePtr->bitmap = None;
}
if (masterPtr->data != NULL) {
- instancePtr->bitmap = XCreateBitmapFromData(
+ instancePtr->bitmap = TkCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
masterPtr->data, (unsigned) masterPtr->width,
@@ -387,7 +387,7 @@ ImgBmapConfigureInstance(instancePtr)
instancePtr->mask = None;
}
if (masterPtr->maskData != NULL) {
- instancePtr->mask = XCreateBitmapFromData(
+ instancePtr->mask = TkCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
masterPtr->maskData, (unsigned) masterPtr->width,
@@ -462,7 +462,7 @@ ImgBmapConfigureInstance(instancePtr)
char *
TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
hotXPtr, hotYPtr)
- Tcl_Interp *interp; /* For reporting errors. */
+ Tcl_Interp *interp; /* For reporting errors, or NULL. */
char *string; /* String describing bitmap. May
* be NULL. */
char *fileName; /* Name of file containing bitmap
@@ -481,7 +481,7 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
pi.string = string;
if (string == NULL) {
- if (Tcl_IsSafe(interp)) {
+ if ((interp != NULL) && Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't get bitmap data from a file in a",
" safe interpreter", (char *) NULL);
return NULL;
@@ -493,9 +493,12 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
pi.chan = Tcl_OpenFileChannel(interp, expandedFileName, "r", 0);
Tcl_DStringFree(&buffer);
if (pi.chan == NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "couldn't read bitmap file \"",
- fileName, "\": ", Tcl_PosixError(interp), (char *) NULL);
+ if (interp != NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "couldn't read bitmap file \"",
+ fileName, "\": ", Tcl_PosixError(interp),
+ (char *) NULL);
+ }
return NULL;
}
} else {
@@ -573,9 +576,11 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
}
}
} else if ((pi.word[0] == '{') && (pi.word[1] == 0)) {
- Tcl_AppendResult(interp, "format error in bitmap data; ",
- "looks like it's an obsolete X10 bitmap file",
- (char *) NULL);
+ if (interp != NULL) {
+ Tcl_AppendResult(interp, "format error in bitmap data; ",
+ "looks like it's an obsolete X10 bitmap file",
+ (char *) NULL);
+ }
goto errorCleanup;
}
}
@@ -615,7 +620,9 @@ TkGetBitmapData(interp, string, fileName, widthPtr, heightPtr,
return data;
error:
- interp->result = "format error in bitmap data";
+ if (interp != NULL) {
+ interp->result = "format error in bitmap data";
+ }
errorCleanup:
if (data != NULL) {
ckfree(data);