0x004530F8
| 389 | |
| 390 | // 0x004530F8 |
| 391 | ImageExtents getImagesMaxExtent(const ImageId baseImageId, const size_t numImages) |
| 392 | { |
| 393 | uint8_t bitmap[200][200] = {}; |
| 394 | |
| 395 | RenderTarget rt = { |
| 396 | /*.bits = */ reinterpret_cast<uint8_t*>(bitmap), |
| 397 | /*.x = */ -100, |
| 398 | /*.y = */ -100, |
| 399 | /*.width = */ 200, |
| 400 | /*.height = */ 200, |
| 401 | /*.pitch = */ 0, |
| 402 | /*.zoom_level = */ 0, |
| 403 | }; |
| 404 | |
| 405 | auto& drawingCtx = Gfx::getDrawingEngine().getDrawingContext(); |
| 406 | drawingCtx.pushRenderTarget(rt); |
| 407 | |
| 408 | // Draw all the images on top of the one bitmap |
| 409 | for (size_t i = 0; i < numImages; ++i) |
| 410 | { |
| 411 | drawingCtx.drawImage({ 0, 0 }, baseImageId.withIndexOffset(static_cast<int32_t>(i))); |
| 412 | } |
| 413 | |
| 414 | drawingCtx.popRenderTarget(); |
| 415 | |
| 416 | // Explore the bitmap to find the extents of the images drawn |
| 417 | int32_t spriteWidth = -1; |
| 418 | for (int32_t i = 99; i != 0; --i) |
| 419 | { |
| 420 | for (int32_t j = 0; j < 200; j++) |
| 421 | { |
| 422 | if (bitmap[j][100 - i] != 0) |
| 423 | { |
| 424 | spriteWidth = i; |
| 425 | break; |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | if (spriteWidth != -1) |
| 430 | { |
| 431 | break; |
| 432 | } |
| 433 | |
| 434 | for (int32_t j = 0; j < 200; j++) |
| 435 | { |
| 436 | if (bitmap[j][100 + i] != 0) |
| 437 | { |
| 438 | spriteWidth = i; |
| 439 | break; |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | if (spriteWidth != -1) |
| 444 | { |
| 445 | break; |
| 446 | } |
| 447 | } |
| 448 |
no test coverage detected