void Painter32::FillRect(Rect rect, Uint32 color) { Rect clipped_rect = rect.Clip(bounds); Uint8 *start = (Uint8 *)_video_aquire_buffer(screen) + (clipped_rect.y * screen->pitch) + (clipped_rect.x * 4); Uint8 r = (Uint8)((color & 0xff0000) >> 16); Uint8 g = (Uint8)((color & 0x00ff00) >> 8); Uint8 b = (Uint8)(color & 0x0000ff); for ( Uint32 y = 0; y < clipped_rect.height; ++y ) { Uint8 *dest = start; for ( Uint32 x = 0; x < clipped_rect.width; ++x ) { dest[0] = b; dest[1] = g; dest[2] = r; dest[3] = 0xff; dest += 4; } start = (Uint8 *)((Uint32)start + screen->pitch); } _video_release_buffer(screen); }
void Window::VideoModeChange( void ) { Rect pos = *this; pos.Align( *view ); pos.Clip( *view ); if ( flags & WIN_CENTER ) pos.Center( *view ); if ( (pos.w != w) || (pos.h != h) ) { SetSize( pos.x, pos.y, pos.w, pos.h ); Draw(); } else { x = pos.x; y = pos.y; } }