software renderer, part G

This commit is contained in:
tildearrow 2024-04-09 02:57:28 -05:00
parent b7e909d1d8
commit 44b6ec15e9
2 changed files with 56 additions and 18 deletions

View file

@ -75,7 +75,22 @@ void FurnaceGUIRenderSoftware::setBlendMode(FurnaceGUIBlendMode mode) {
}
void FurnaceGUIRenderSoftware::clear(ImVec4 color) {
// TODO
SDL_Surface* surf=SDL_GetWindowSurface(sdlWin);
if (!surf) return;
ImU32 clearToWhat=ImGui::ColorConvertFloat4ToU32(color);
clearToWhat=(clearToWhat&0xff00ff00)|((clearToWhat&0xff)<<16)|((clearToWhat&0xff0000)>>16);
bool mustLock=SDL_MUSTLOCK(surf);
if (mustLock) {
if (SDL_LockSurface(surf)!=0) return;
}
unsigned int* pixels=(unsigned int*)surf->pixels;
for (size_t total=surf->w*surf->h; total; total--) {
*(pixels++)=clearToWhat;
}
if (mustLock) {
SDL_UnlockSurface(surf);
}
}
bool FurnaceGUIRenderSoftware::newFrame() {