| Summary: | SDL_RenderDrawRect not rectangular | ||
|---|---|---|---|
| Product: | SDL | Reporter: | David Connolly <menounsef> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | blocker | ||
| Priority: | P2 | Keywords: | target-2.0.16 |
| Version: | 2.0.15 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Display of SDL_RenderDrawRect | ||
This is from latest HG 2.0.15 Seems to be caused by http://hg.libsdl.org/SDL/rev/ba7112eeb065 |
Created attachment 4679 [details] Display of SDL_RenderDrawRect Using SDL_RenderDrawRect does not produce a perfect rectangle anymore. The bottom line seems to be out by one pixel. See attached screenshot. -------------------------- //Using SDL and standard IO #include <SDL2/SDL.h> #include <stdio.h> //Screen dimension constants const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main( int argc, char* args[] ) { //The window we'll be rendering to SDL_Window* window = NULL; SDL_Renderer* renderer = NULL; //Initialize SDL if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); } else { //Create window window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN ); if( window == NULL ) { printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() ); } else { renderer = SDL_CreateRenderer( window, -1, SDL_RENDERER_ACCELERATED ); if( renderer == NULL ) { printf( "Renderer could not be created! SDL Error: %s\n", SDL_GetError() ); } SDL_Rect outlineRect = { SCREEN_WIDTH / 6, SCREEN_HEIGHT / 6, SCREEN_WIDTH * 2 / 3, SCREEN_HEIGHT * 2 / 3 }; SDL_SetRenderDrawColor( renderer, 0x00, 0xFF, 0x00, 0xFF ); SDL_RenderDrawRect( renderer, &outlineRect ); SDL_Rect outlineRect2 = { SCREEN_WIDTH / 4, SCREEN_HEIGHT / 4, SCREEN_WIDTH * 2 / 4, SCREEN_HEIGHT * 2 / 4 }; SDL_SetRenderDrawColor( renderer, 0xFF, 0xFF, 0x00, 0xFF ); SDL_RenderDrawRect( renderer, &outlineRect2 ); SDL_Rect outlineRect3 = { SCREEN_WIDTH / 3, SCREEN_HEIGHT / 3, SCREEN_WIDTH / 3, SCREEN_HEIGHT / 3 }; SDL_SetRenderDrawColor( renderer, 0xFF, 0xFF, 0xFF, 0xFF ); SDL_RenderDrawRect( renderer, &outlineRect3 ); SDL_RenderPresent( renderer ); //Wait two seconds SDL_Delay( 5000 ); } } //Destroy window SDL_DestroyWindow( window ); //Quit SDL subsystems SDL_Quit(); return 0; }