mirror of
https://github.com/RGBCube/serenity
synced 2025-06-16 08:12:07 +00:00
WindowServer: Some minor comments and cleanups in WSCompositor
This commit is contained in:
parent
503fe37eaa
commit
0f76366b34
1 changed files with 6 additions and 5 deletions
|
@ -107,9 +107,11 @@ void WSCompositor::compose()
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Paint the wallpaper.
|
||||||
for (auto& dirty_rect : dirty_rects.rects()) {
|
for (auto& dirty_rect : dirty_rects.rects()) {
|
||||||
if (wm.any_opaque_window_contains_rect(dirty_rect))
|
if (wm.any_opaque_window_contains_rect(dirty_rect))
|
||||||
continue;
|
continue;
|
||||||
|
// FIXME: If the wallpaper is opaque, no need to fill with color!
|
||||||
m_back_painter->fill_rect(dirty_rect, wm.m_background_color);
|
m_back_painter->fill_rect(dirty_rect, wm.m_background_color);
|
||||||
if (m_wallpaper) {
|
if (m_wallpaper) {
|
||||||
if (m_wallpaper_mode == WallpaperMode::Simple) {
|
if (m_wallpaper_mode == WallpaperMode::Simple) {
|
||||||
|
@ -121,11 +123,13 @@ void WSCompositor::compose()
|
||||||
dirty_rect, offset);
|
dirty_rect, offset);
|
||||||
} else if (m_wallpaper_mode == WallpaperMode::Tile) {
|
} else if (m_wallpaper_mode == WallpaperMode::Tile) {
|
||||||
m_back_painter->draw_tiled_bitmap(dirty_rect, *m_wallpaper);
|
m_back_painter->draw_tiled_bitmap(dirty_rect, *m_wallpaper);
|
||||||
} else {
|
} else if (m_wallpaper_mode == WallpaperMode::Scaled) {
|
||||||
float hscale = (float)m_wallpaper->size().width() / (float)ws.size().width();
|
float hscale = (float)m_wallpaper->size().width() / (float)ws.size().width();
|
||||||
float vscale = (float)m_wallpaper->size().height() / (float)ws.size().height();
|
float vscale = (float)m_wallpaper->size().height() / (float)ws.size().height();
|
||||||
|
|
||||||
m_back_painter->blit_scaled(dirty_rect, *m_wallpaper, dirty_rect, hscale, vscale);
|
m_back_painter->blit_scaled(dirty_rect, *m_wallpaper, dirty_rect, hscale, vscale);
|
||||||
|
} else {
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,6 +173,7 @@ void WSCompositor::compose()
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Paint the window stack.
|
||||||
if (auto* fullscreen_window = wm.active_fullscreen_window()) {
|
if (auto* fullscreen_window = wm.active_fullscreen_window()) {
|
||||||
compose_window(*fullscreen_window);
|
compose_window(*fullscreen_window);
|
||||||
} else {
|
} else {
|
||||||
|
@ -342,10 +347,6 @@ void WSCompositor::draw_cursor()
|
||||||
{
|
{
|
||||||
auto& wm = WSWindowManager::the();
|
auto& wm = WSWindowManager::the();
|
||||||
Rect cursor_rect = current_cursor_rect();
|
Rect cursor_rect = current_cursor_rect();
|
||||||
Color inner_color = Color::White;
|
|
||||||
Color outer_color = Color::Black;
|
|
||||||
if (WSScreen::the().mouse_button_state() & (unsigned)MouseButton::Left)
|
|
||||||
swap(inner_color, outer_color);
|
|
||||||
m_back_painter->blit(cursor_rect.location(), wm.active_cursor().bitmap(), wm.active_cursor().rect());
|
m_back_painter->blit(cursor_rect.location(), wm.active_cursor().bitmap(), wm.active_cursor().rect());
|
||||||
m_last_cursor_rect = cursor_rect;
|
m_last_cursor_rect = cursor_rect;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue