MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Tk_GetBitmapFromData

Function Tk_GetBitmapFromData

micropolis-activity/src/tk/tkbitmap.c:425–461  ·  view source on GitHub ↗

ARGSUSED */

(interp, tkwin, source, width, height)

Source from the content-addressed store, hash-verified

423 * For each call to this procedure, there should eventually be a call
424 * to Tk_FreeBitmap, so that the database can be cleaned up when bitmaps
425 * aren't needed anymore.
426 *
427 *----------------------------------------------------------------------
428 */
429
430 /* ARGSUSED */
431Pixmap
432Tk_GetBitmapFromData(interp, tkwin, source, width, height)
433 Tcl_Interp *interp; /* Interpreter to use for error reporting. */
434 Tk_Window tkwin; /* Window in which bitmap will be used. */
435 char *source; /* Bitmap data for bitmap shape. */
436 unsigned int width, height; /* Dimensions of bitmap. */
437{
438 DataKey key;
439 Tcl_HashEntry *dataHashPtr;
440 Tk_Uid name = NULL; /* Initialization need only to prevent
441 * compiler warning. */
442 int new;
443 static autoNumber = 0;
444 char string[20];
445
446 if (!initialized) {
447 BitmapInit();
448 }
449
450 key.source = source;
451 key.width = width;
452 key.height = height;
453 dataHashPtr = Tcl_CreateHashEntry(&dataTable, (char *) &key, &new);
454 if (!new) {
455 name = (Tk_Uid) Tcl_GetHashValue(dataHashPtr);
456 } else {
457 autoNumber++;
458 sprintf(string, "_tk%d", autoNumber);
459 name = Tk_GetUid(string);
460 Tcl_SetHashValue(dataHashPtr, name);
461 if (Tk_DefineBitmap(interp, name, source, width, height) != TCL_OK) {
462 Tcl_DeleteHashEntry(dataHashPtr);
463 return TCL_ERROR;
464 }

Callers

nothing calls this directly

Calls 5

BitmapInitFunction · 0.85
Tk_GetUidFunction · 0.85
Tk_DefineBitmapFunction · 0.85
Tcl_DeleteHashEntryFunction · 0.85
Tk_GetBitmapFunction · 0.85

Tested by

no test coverage detected