MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawLine

Method DrawLine

src/blitter/32bpp_anim.cpp:334–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void Blitter_32bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, PixelColour colour, int width, int dash)
335{
336 const Colour c = LookupColourInPalette(colour.p);
337
338 if (_screen_disable_anim) {
339 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [&](int x, int y) {
340 *((Colour *)video + x + y * _screen.pitch) = c;
341 });
342 } else {
343 uint16_t * const offset_anim_buf = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)video);
344 const uint16_t anim_colour = colour.p | (DEFAULT_BRIGHTNESS << 8);
345 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [&](int x, int y) {
346 *((Colour *)video + x + y * _screen.pitch) = c;
347 offset_anim_buf[x + y * this->anim_buf_pitch] = anim_colour;
348 });
349 }
350}
351
352void Blitter_32bppAnim::DrawRect(void *video, int width, int height, PixelColour colour)
353{

Callers

nothing calls this directly

Calls 2

ScreenToAnimOffsetMethod · 0.95
DrawLineGenericMethod · 0.80

Tested by

no test coverage detected