0x004CADE8
| 9 | { |
| 10 | // 0x004CADE8 |
| 11 | static void drawImage(Gfx::DrawingContext& drawingCtx, const Widget& widget, const WidgetState& widgetState) |
| 12 | { |
| 13 | auto* window = widgetState.window; |
| 14 | |
| 15 | const auto pos = window->position() + widget.position(); |
| 16 | |
| 17 | const bool isColourSet = widget.image & Widget::kImageIdColourSet; |
| 18 | ImageId imageId = ImageId::fromUInt32(widget.image & ~Widget::kImageIdColourSet); |
| 19 | |
| 20 | auto colour = widgetState.colour; |
| 21 | if (widgetState.disabled) |
| 22 | { |
| 23 | // TODO: this is odd most likely this is another flag like Widget::kImageIdColourSet |
| 24 | if (imageId.hasSecondary()) |
| 25 | { |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | // No colour applied image |
| 30 | const auto pureImage = ImageId{ imageId.getIndex() }; |
| 31 | uint8_t c; |
| 32 | if (colour.isTranslucent()) |
| 33 | { |
| 34 | c = Colours::getShade(colour.c(), 4); |
| 35 | drawingCtx.drawImageSolid(pos + Ui::Point{ 1, 1 }, pureImage, c); |
| 36 | c = Colours::getShade(colour.c(), 2); |
| 37 | drawingCtx.drawImageSolid(pos, pureImage, c); |
| 38 | } |
| 39 | else |
| 40 | { |
| 41 | c = Colours::getShade(colour.c(), 6); |
| 42 | drawingCtx.drawImageSolid(pos + Ui::Point{ 1, 1 }, pureImage, c); |
| 43 | c = Colours::getShade(colour.c(), 4); |
| 44 | drawingCtx.drawImageSolid(pos, pureImage, c); |
| 45 | } |
| 46 | |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | if (!isColourSet && imageId.hasSecondary()) |
| 51 | { |
| 52 | imageId = imageId.withSecondary(colour.c()); |
| 53 | } |
| 54 | |
| 55 | if (!isColourSet && imageId.hasPrimary()) |
| 56 | { |
| 57 | imageId = imageId.withPrimary(colour.c()); |
| 58 | } |
| 59 | |
| 60 | if (!isColourSet) |
| 61 | { |
| 62 | imageId = ImageId::fromUInt32(Gfx::recolour(imageId.getIndex(), colour.c())); |
| 63 | } |
| 64 | |
| 65 | drawingCtx.drawImage(pos, imageId); |
| 66 | } |
| 67 | |
| 68 | static void draw_3(Gfx::DrawingContext& drawingCtx, const Widget& widget, const WidgetState& widgetState) |
no test coverage detected