Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11render.c @ 2901:133601e3b255
Added RenderPiont() API
Merged the drawing tests into a single test program
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 21 Dec 2008 17:39:41 +0000 |
parents | e80f347b6d29 |
children | ffdd533f7add |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11render.c Sun Dec 21 08:59:56 2008 +0000 +++ b/src/video/x11/SDL_x11render.c Sun Dec 21 17:39:41 2008 +0000 @@ -49,6 +49,7 @@ static void X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int X11_SetDrawColor(SDL_Renderer * renderer); static int X11_SetDrawBlendMode(SDL_Renderer * renderer); +static int X11_RenderPoint(SDL_Renderer * renderer, int x, int y); static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2); static int X11_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect); @@ -196,6 +197,7 @@ renderer->UnlockTexture = X11_UnlockTexture; renderer->SetDrawColor = X11_SetDrawColor; renderer->SetDrawBlendMode = X11_SetDrawBlendMode; + renderer->RenderPoint = X11_RenderPoint; renderer->RenderLine = X11_RenderLine; renderer->RenderFill = X11_RenderFill; renderer->RenderCopy = X11_RenderCopy; @@ -593,6 +595,28 @@ } static int +X11_RenderPoint(SDL_Renderer * renderer, int x, int y) +{ + X11_RenderData *data = (X11_RenderData *) renderer->driverdata; + unsigned long foreground; + + if (data->makedirty) { + SDL_Rect rect; + + rect.x = x; + rect.y = y; + rect.w = 1; + rect.h = 1; + SDL_AddDirtyRect(&data->dirty, &rect); + } + + foreground = renderdrawcolor(renderer, 1); + XSetForeground(data->display, data->gc, foreground); + XDrawPoint(data->display, data->drawable, data->gc, x, y); + return 0; +} + +static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) { X11_RenderData *data = (X11_RenderData *) renderer->driverdata;