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

Method DrawLine

src/blitter/40bpp_anim.cpp:68–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void Blitter_40bppAnim::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, PixelColour colour, int width, int dash)
69{
70 if (_screen_disable_anim) {
71 /* This means our output is not to the screen, so we can't be doing any animation stuff, so use our parent DrawRect() */
72 Blitter_32bppOptimized::DrawLine(video, x, y, x2, y2, screen_width, screen_height, colour, width, dash);
73 return;
74 }
75
76 assert(VideoDriver::GetInstance()->GetAnimBuffer() != nullptr);
77 uint8_t *anim = ((uint32_t *)video - (uint32_t *)_screen.dst_ptr) + VideoDriver::GetInstance()->GetAnimBuffer();
78
79 this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
80 *((Colour *)video + x + y * _screen.pitch) = _black_colour;
81 *(anim + x + y * _screen.pitch) = colour.p;
82 });
83}
84
85/**
86 * Draws a sprite to a (screen) buffer. It is templated to allow faster operation.

Callers

nothing calls this directly

Calls 2

DrawLineGenericMethod · 0.80
GetAnimBufferMethod · 0.45

Tested by

no test coverage detected