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

Function Tk_GetPixmapFromData

micropolis-activity/src/tk/tkpixmap.c:506–543  ·  view source on GitHub ↗

ARGSUSED */

(interp, tkwin, source, width, height)

Source from the content-addressed store, hash-verified

504 * For each call to this procedure, there should eventually be a call
505 * to Tk_FreePixmap, so that the database can be cleaned up when pixmaps
506 * aren't needed anymore.
507 *
508 *----------------------------------------------------------------------
509 */
510
511 /* ARGSUSED */
512Pixmap
513Tk_GetPixmapFromData(interp, tkwin, source, width, height)
514 Tcl_Interp *interp; /* Interpreter to use for error reporting. */
515 Tk_Window tkwin; /* Window in which bitmap will be used. */
516 char *source; /* Bitmap data for bitmap shape. */
517 unsigned int width, height; /* Dimensions of bitmap. */
518{
519 DataKey key;
520 Tcl_HashEntry *dataHashPtr;
521 Tk_Uid name = NULL; /* Initialization need only to prevent
522 * compiler warning. */
523 int new;
524 static autoNumber = 0;
525 char string[20];
526
527 if (!initialized) {
528 PixmapInit(tkwin);
529 }
530
531 key.source = source;
532 key.width = width;
533 key.height = height;
534 dataHashPtr = Tcl_CreateHashEntry(&dataTable, (char *) &key, &new);
535 if (!new) {
536 name = (Tk_Uid) Tcl_GetHashValue(dataHashPtr);
537 } else {
538 autoNumber++;
539 sprintf(string, "_tk%d", autoNumber);
540 name = Tk_GetUid(string);
541 Tcl_SetHashValue(dataHashPtr, name);
542 if (Tk_DefinePixmap(interp, name, tkwin, None, source, width,
543 height) != TCL_OK) {
544 Tcl_DeleteHashEntry(dataHashPtr);
545 return TCL_ERROR;
546 }

Callers

nothing calls this directly

Calls 5

PixmapInitFunction · 0.85
Tk_GetUidFunction · 0.85
Tk_DefinePixmapFunction · 0.85
Tcl_DeleteHashEntryFunction · 0.85
Tk_GetPixmapFunction · 0.85

Tested by

no test coverage detected