comparison src/video/win32/SDL_gdirender.c @ 2884:9dde605c7540

Date: Fri, 19 Dec 2008 20:17:35 +0100 From: Couriersud Subject: Re: Aw: Experience using SDL1.3 in sdlmame/Proposal for api additions > For consistency you'd probably want: > SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a); > SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode); > SDL_RenderLine(int x1, int y1, int x2, int y2); > SDL_RenderFill(SDL_Rect *rect); > > You probably also want to add API functions query the current state. > I have implemented the above api for the opengl, x11, directfb and software renderers. I have also renamed *TEXTUREBLENDMODE* constants to BLENDMODE*. The unix build compiles. The windows renderer still needs to be updated, but I have no windows development machine at hand. Have a look at the x11 renderer for a sample. Vector games now run at 90% both on opengl and directfb in comparison to sdlmame's own opengl renderer. The same applies to raster games. The diff also includes a) Changed XDrawRect to XFillRect in x11 renderer b) A number of changes to fix blending and modulation issues in the directfb renderer.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 20 Dec 2008 12:00:00 +0000
parents 99210400e8b9
children 2f91a3847ae8
comparison
equal deleted inserted replaced
2883:11626a53e7bc 2884:9dde605c7540
71 "gdi", 71 "gdi",
72 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | 72 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
73 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | 73 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
74 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED), 74 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED),
75 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA), 75 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA),
76 (SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK | 76 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND),
77 SDL_TEXTUREBLENDMODE_BLEND),
78 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST), 77 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST),
79 14, 78 14,
80 { 79 {
81 SDL_PIXELFORMAT_INDEX8, 80 SDL_PIXELFORMAT_INDEX8,
82 SDL_PIXELFORMAT_RGB555, 81 SDL_PIXELFORMAT_RGB555,
457 456
458 static int 457 static int
459 GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) 458 GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
460 { 459 {
461 switch (texture->blendMode) { 460 switch (texture->blendMode) {
462 case SDL_TEXTUREBLENDMODE_NONE: 461 case SDL_BLENDMODE_NONE:
463 case SDL_TEXTUREBLENDMODE_MASK: 462 case SDL_BLENDMODE_MASK:
464 case SDL_TEXTUREBLENDMODE_BLEND: 463 case SDL_BLENDMODE_BLEND:
465 return 0; 464 return 0;
466 default: 465 default:
467 SDL_Unsupported(); 466 SDL_Unsupported();
468 texture->blendMode = SDL_TEXTUREBLENDMODE_NONE; 467 texture->blendMode = SDL_BLENDMODE_NONE;
469 return -1; 468 return -1;
470 } 469 }
471 } 470 }
472 471
473 static int 472 static int
615 SelectObject(data->memory_hdc, texturedata->hbm); 614 SelectObject(data->memory_hdc, texturedata->hbm);
616 if (texturedata->hpal) { 615 if (texturedata->hpal) {
617 SelectPalette(data->memory_hdc, texturedata->hpal, TRUE); 616 SelectPalette(data->memory_hdc, texturedata->hpal, TRUE);
618 RealizePalette(data->memory_hdc); 617 RealizePalette(data->memory_hdc);
619 } 618 }
620 if (texture->blendMode & 619 if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) {
621 (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND)) {
622 BLENDFUNCTION blendFunc = { 620 BLENDFUNCTION blendFunc = {
623 AC_SRC_OVER, 621 AC_SRC_OVER,
624 0, 622 0,
625 texture->a, 623 texture->a,
626 AC_SRC_ALPHA 624 AC_SRC_ALPHA