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

Function ViewportDrawDirtyBlocks

src/viewport.cpp:1756–1773  ·  view source on GitHub ↗

* Draw/colour the blocks that have been redrawn. */

Source from the content-addressed store, hash-verified

1754 * Draw/colour the blocks that have been redrawn.
1755 */
1756static void ViewportDrawDirtyBlocks()
1757{
1758 Blitter *blitter = BlitterFactory::GetCurrentBlitter();
1759 const DrawPixelInfo *dpi = _cur_dpi;
1760 void *dst;
1761 int right = UnScaleByZoom(dpi->width, dpi->zoom);
1762 int bottom = UnScaleByZoom(dpi->height, dpi->zoom);
1763
1764 PixelColour colour = _string_colourmap[_dirty_block_colour & 0xF];
1765
1766 dst = dpi->dst_ptr;
1767
1768 uint8_t bo = UnScaleByZoom(dpi->left + dpi->top, dpi->zoom) & 1;
1769 do {
1770 for (int i = (bo ^= 1); i < right; i += 2) blitter->SetPixel(dst, i, 0, colour);
1771 dst = blitter->MoveTo(dst, 0, 1);
1772 } while (--bottom > 0);
1773}
1774
1775static void ViewportDrawStrings(ZoomLevel zoom, const StringSpriteToDrawVector *sstdv)
1776{

Callers 1

ViewportDoDrawFunction · 0.85

Calls 3

UnScaleByZoomFunction · 0.85
SetPixelMethod · 0.45
MoveToMethod · 0.45

Tested by

no test coverage detected