ARGSUSED */
(canvasPtr, bmapPtr)
| 352 | * The fields x1, y1, x2, and y2 are updated in the header |
| 353 | * for itemPtr. |
| 354 | * |
| 355 | *-------------------------------------------------------------- |
| 356 | */ |
| 357 | |
| 358 | /* ARGSUSED */ |
| 359 | static void |
| 360 | ComputeBitmapBbox(canvasPtr, bmapPtr) |
| 361 | Tk_Canvas *canvasPtr; /* Canvas that contains item. */ |
| 362 | register BitmapItem *bmapPtr; /* Item whose bbox is to be |
| 363 | * recomputed. */ |
| 364 | { |
| 365 | unsigned int width, height; |
| 366 | int x, y; |
| 367 | |
| 368 | x = bmapPtr->x + 0.5; |
| 369 | y = bmapPtr->y + 0.5; |
| 370 | |
| 371 | if (bmapPtr->bitmap == None) { |
| 372 | bmapPtr->header.x1 = bmapPtr->header.x2 = x; |
| 373 | bmapPtr->header.y1 = bmapPtr->header.y2 = y; |
| 374 | return; |
| 375 | } |
| 376 | |
| 377 | /* |
| 378 | * Compute location and size of bitmap, using anchor information. |
| 379 | */ |
| 380 | |
| 381 | #if defined(USE_XPM3) |
| 382 | Tk_SizeOfPixmap(bmapPtr->bitmap, &width, &height); |
| 383 | #else |
| 384 | Tk_SizeOfBitmap(bmapPtr->bitmap, &width, &height); |
| 385 | #endif |
| 386 | switch (bmapPtr->anchor) { |
| 387 | case TK_ANCHOR_N: |
| 388 | x -= width/2; |
| 389 | break; |
| 390 | case TK_ANCHOR_NE: |
| 391 | x -= width; |
| 392 | break; |
| 393 | case TK_ANCHOR_E: |
| 394 | x -= width; |
| 395 | y -= height/2; |
| 396 | break; |
| 397 | case TK_ANCHOR_SE: |
| 398 | x -= width; |
| 399 | y -= height; |
| 400 | break; |
| 401 | case TK_ANCHOR_S: |
| 402 | x -= width/2; |
| 403 | y -= height; |
| 404 | break; |
| 405 | case TK_ANCHOR_SW: |
| 406 | y -= height; |
| 407 | break; |
| 408 | case TK_ANCHOR_W: |
| 409 | y -= height/2; |
| 410 | break; |
| 411 | case TK_ANCHOR_NW: |
no test coverage detected