| 452 | } |
| 453 | |
| 454 | static void DrawBitmappedTextCore(struct Bitmap* bmp, struct DrawTextArgs* args, int x, int y, cc_bool shadow) { |
| 455 | BitmapCol color; |
| 456 | cc_string text = args->text; |
| 457 | int i, point = args->font->size, count = 0; |
| 458 | |
| 459 | int xPadding; |
| 460 | int srcX, srcY, dstX, dstY; |
| 461 | int fontX, fontY; |
| 462 | int srcWidth, dstWidth; |
| 463 | int dstHeight, begX, xx, yy; |
| 464 | int cellY, underlineY, underlineHeight; |
| 465 | |
| 466 | BitmapCol* srcRow, src; |
| 467 | BitmapCol* dstRow; |
| 468 | |
| 469 | cc_uint8 coords[DRAWER2D_MAX_TEXT_LENGTH]; |
| 470 | BitmapCol colors[DRAWER2D_MAX_TEXT_LENGTH]; |
| 471 | cc_uint16 dstWidths[DRAWER2D_MAX_TEXT_LENGTH]; |
| 472 | |
| 473 | color = Drawer2D.Colors['f']; |
| 474 | if (shadow) color = GetShadowColor(color); |
| 475 | |
| 476 | for (i = 0; i < text.length; i++) { |
| 477 | char c = text.buffer[i]; |
| 478 | if (c == '&' && Drawer2D_ValidColorCodeAt(&text, i + 1)) { |
| 479 | color = Drawer2D_GetColor(text.buffer[i + 1]); |
| 480 | |
| 481 | if (shadow) color = GetShadowColor(color); |
| 482 | i++; continue; /* skip over the color code */ |
| 483 | } |
| 484 | |
| 485 | coords[count] = c; |
| 486 | colors[count] = color; |
| 487 | dstWidths[count] = Drawer2D_Width(point, c); |
| 488 | count++; |
| 489 | } |
| 490 | |
| 491 | dstHeight = point; begX = x; |
| 492 | /* adjust coords to make drawn text match GDI fonts */ |
| 493 | y += (args->font->height - dstHeight) / 2; |
| 494 | xPadding = Drawer2D_XPadding(point); |
| 495 | |
| 496 | for (yy = 0; yy < dstHeight; yy++) { |
| 497 | dstY = y + yy; |
| 498 | if ((unsigned)dstY >= (unsigned)bmp->height) continue; |
| 499 | |
| 500 | fontY = 0 + yy * tileSize / dstHeight; |
| 501 | dstRow = Bitmap_GetRow(bmp, dstY); |
| 502 | |
| 503 | for (i = 0; i < count; i++) { |
| 504 | srcX = (coords[i] & 0x0F) * tileSize; |
| 505 | srcY = (coords[i] >> 4) * tileSize; |
| 506 | srcRow = Bitmap_GetRow(&fontBitmap, fontY + srcY); |
| 507 | |
| 508 | srcWidth = tileWidths[coords[i]]; |
| 509 | dstWidth = dstWidths[i]; |
| 510 | color = colors[i]; |
| 511 |
no test coverage detected