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

Method PopulateCursorCache

src/video/opengl.cpp:1100–1122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1098};
1099
1100void OpenGLBackend::PopulateCursorCache()
1101{
1102 if (this->clear_cursor_cache) {
1103 /* We have a pending cursor cache clear to do first. */
1104 this->clear_cursor_cache = false;
1105 this->last_sprite_pal = (PaletteID)-1;
1106
1107 this->InternalClearCursorCache();
1108 }
1109
1110 this->cursor_pos = _cursor.pos;
1111 this->cursor_in_window = _cursor.in_window;
1112
1113 this->cursor_sprites.clear();
1114 for (const auto &sc : _cursor.sprites) {
1115 this->cursor_sprites.emplace_back(sc);
1116
1117 if (!this->cursor_cache.Contains(sc.image.sprite)) {
1118 OpenGLSpriteAllocator allocator(this->cursor_cache, sc.image.sprite);
1119 GetRawSprite(sc.image.sprite, SpriteType::Normal, &allocator, this);
1120 }
1121 }
1122}
1123
1124/**
1125 * Clear all cached cursor sprites.

Callers 2

PopulateSystemSpritesMethod · 0.80
PopulateSystemSpritesMethod · 0.80

Calls 4

GetRawSpriteFunction · 0.85
clearMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected