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

Method Paint

src/video/sdl2_default_v.cpp:91–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void VideoDriver_SDL_Default::Paint()
92{
93 PerformanceMeasurer framerate(PFE_VIDEO);
94
95 if (IsEmptyRect(this->dirty_rect) && this->local_palette.count_dirty == 0) return;
96
97 if (this->local_palette.count_dirty != 0) {
98 Blitter *blitter = BlitterFactory::GetCurrentBlitter();
99
100 switch (blitter->UsePaletteAnimation()) {
101 case Blitter::PaletteAnimation::VideoBackend:
102 this->UpdatePalette();
103 break;
104
105 case Blitter::PaletteAnimation::Blitter: {
106 blitter->PaletteAnimate(this->local_palette);
107 break;
108 }
109
110 case Blitter::PaletteAnimation::None:
111 break;
112
113 default:
114 NOT_REACHED();
115 }
116 this->local_palette.count_dirty = 0;
117 }
118
119 SDL_Rect r = { this->dirty_rect.left, this->dirty_rect.top, this->dirty_rect.right - this->dirty_rect.left, this->dirty_rect.bottom - this->dirty_rect.top };
120
121 if (_sdl_surface != _sdl_real_surface) {
122 SDL_BlitSurface(_sdl_surface, &r, _sdl_real_surface, &r);
123 }
124 SDL_UpdateWindowSurfaceRects(this->sdl_window, &r, 1);
125
126 this->dirty_rect = {};
127}
128
129bool VideoDriver_SDL_Default::AllocateBackingStore(int w, int h, bool force)
130{

Callers

nothing calls this directly

Calls 5

UpdatePaletteMethod · 0.95
IsEmptyRectFunction · 0.85
NOT_REACHEDFunction · 0.85
UsePaletteAnimationMethod · 0.45
PaletteAnimateMethod · 0.45

Tested by

no test coverage detected