comparison 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
comparison
equal deleted inserted replaced
2900:3a9636c83849 2901:133601e3b255
47 const SDL_Rect * rect, int markDirty, 47 const SDL_Rect * rect, int markDirty,
48 void **pixels, int *pitch); 48 void **pixels, int *pitch);
49 static void X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); 49 static void X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
50 static int X11_SetDrawColor(SDL_Renderer * renderer); 50 static int X11_SetDrawColor(SDL_Renderer * renderer);
51 static int X11_SetDrawBlendMode(SDL_Renderer * renderer); 51 static int X11_SetDrawBlendMode(SDL_Renderer * renderer);
52 static int X11_RenderPoint(SDL_Renderer * renderer, int x, int y);
52 static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, 53 static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
53 int y2); 54 int y2);
54 static int X11_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect); 55 static int X11_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
55 static int X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 56 static int X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
56 const SDL_Rect * srcrect, const SDL_Rect * dstrect); 57 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
194 renderer->UpdateTexture = X11_UpdateTexture; 195 renderer->UpdateTexture = X11_UpdateTexture;
195 renderer->LockTexture = X11_LockTexture; 196 renderer->LockTexture = X11_LockTexture;
196 renderer->UnlockTexture = X11_UnlockTexture; 197 renderer->UnlockTexture = X11_UnlockTexture;
197 renderer->SetDrawColor = X11_SetDrawColor; 198 renderer->SetDrawColor = X11_SetDrawColor;
198 renderer->SetDrawBlendMode = X11_SetDrawBlendMode; 199 renderer->SetDrawBlendMode = X11_SetDrawBlendMode;
200 renderer->RenderPoint = X11_RenderPoint;
199 renderer->RenderLine = X11_RenderLine; 201 renderer->RenderLine = X11_RenderLine;
200 renderer->RenderFill = X11_RenderFill; 202 renderer->RenderFill = X11_RenderFill;
201 renderer->RenderCopy = X11_RenderCopy; 203 renderer->RenderCopy = X11_RenderCopy;
202 renderer->RenderPresent = X11_RenderPresent; 204 renderer->RenderPresent = X11_RenderPresent;
203 renderer->DestroyTexture = X11_DestroyTexture; 205 renderer->DestroyTexture = X11_DestroyTexture;
591 else 593 else
592 return SDL_MapRGBA(data->format, r, g, b, a); 594 return SDL_MapRGBA(data->format, r, g, b, a);
593 } 595 }
594 596
595 static int 597 static int
598 X11_RenderPoint(SDL_Renderer * renderer, int x, int y)
599 {
600 X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
601 unsigned long foreground;
602
603 if (data->makedirty) {
604 SDL_Rect rect;
605
606 rect.x = x;
607 rect.y = y;
608 rect.w = 1;
609 rect.h = 1;
610 SDL_AddDirtyRect(&data->dirty, &rect);
611 }
612
613 foreground = renderdrawcolor(renderer, 1);
614 XSetForeground(data->display, data->gc, foreground);
615 XDrawPoint(data->display, data->drawable, data->gc, x, y);
616 return 0;
617 }
618
619 static int
596 X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) 620 X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
597 { 621 {
598 X11_RenderData *data = (X11_RenderData *) renderer->driverdata; 622 X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
599 unsigned long foreground; 623 unsigned long foreground;
600 624