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

Function imageWithinRT

src/OpenLoco/src/Paint/Paint.cpp:187–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185 }
186
187 static constexpr bool imageWithinRT(const Ui::viewport_pos& imagePos, const Gfx::G1Element& g1, const Gfx::RenderTarget& rt)
188 {
189 int32_t left = imagePos.x + g1.xOffset;
190 int32_t bottom = imagePos.y + g1.yOffset;
191
192 int32_t right = left + g1.width;
193 int32_t top = bottom + g1.height;
194
195 if (right <= rt.x)
196 {
197 return false;
198 }
199 if (top <= rt.y)
200 {
201 return false;
202 }
203 if (left >= rt.x + rt.width)
204 {
205 return false;
206 }
207 if (bottom >= rt.y + rt.height)
208 {
209 return false;
210 }
211 return true;
212 }
213
214 static constexpr World::Pos3 rotateBoundBoxSize(const World::Pos3& bbSize, const uint8_t rotation)
215 {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected