ARGSUSED */
(interp, tkwin, source, width, height)
| 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 */ |
| 512 | Pixmap |
| 513 | Tk_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 | } |
nothing calls this directly
no test coverage detected