MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / drawStruct

Function drawStruct

src/OpenLoco/src/Paint/Paint.cpp:963–988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961 }
962
963 static void drawStruct(const Gfx::RenderTarget& rt, Gfx::DrawingContext& drawingCtx, const PaintStruct& ps, const bool shouldCull)
964 {
965 auto imageId = ps.imageId;
966
967 if (shouldCull)
968 {
969 imageId = ImageId(imageId.getIndex()).withTranslucency(ExtColour::unk30);
970 }
971
972 auto imagePos = ps.vpPos;
973 if (ps.type == Ui::ViewportInteraction::InteractionItem::entity)
974 {
975 const auto zoomAlign = 1U << rt.zoomLevel;
976 imagePos.x = Numerics::floor2(imagePos.x, zoomAlign);
977 imagePos.y = Numerics::floor2(imagePos.y, zoomAlign);
978 }
979
980 if ((ps.flags & PaintStructFlags::hasMaskedImage) != PaintStructFlags::none)
981 {
982 drawingCtx.drawImageMasked(imagePos, imageId, ps.maskedImageId);
983 }
984 else
985 {
986 drawingCtx.drawImage(imagePos, imageId);
987 }
988 }
989
990 static void drawAttachStruct(const Gfx::RenderTarget& rt, Gfx::DrawingContext& drawingCtx, const PaintStruct& ps, const AttachedPaintStruct& attachPs, const bool shouldCull)
991 {

Callers 1

drawStructsMethod · 0.85

Calls 6

ImageIdClass · 0.85
floor2Function · 0.85
withTranslucencyMethod · 0.80
drawImageMaskedMethod · 0.80
getIndexMethod · 0.45
drawImageMethod · 0.45

Tested by

no test coverage detected