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