Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Implemented the X11 (non-OpenGL) renderer, no alpha or scaling availa…

…ble.
  • Loading branch information
slouken committed Nov 30, 2008
1 parent 96522c0 commit e0e05fdd859455cd918cd02020becf8878f9be5d
@@ -1172,6 +1172,13 @@ AC_HELP_STRING([--enable-video-x11-dpms], [enable X11 DPMS extension [[default=y
AC_DEFINE(SDL_VIDEO_DRIVER_X11_DPMS)
fi
fi

AC_ARG_ENABLE(render-x11,
AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
, enable_render_x11=yes)
if test x$enable_render_x11 = xyes; then
AC_DEFINE(SDL_VIDEO_RENDER_X11)
fi
fi
fi
}
@@ -294,6 +294,7 @@
#undef SDL_VIDEO_RENDER_D3D
#undef SDL_VIDEO_RENDER_GDI
#undef SDL_VIDEO_RENDER_OGL
#undef SDL_VIDEO_RENDER_X11

/* Enable OpenGL support */
#undef SDL_VIDEO_OPENGL
@@ -59,9 +59,6 @@ static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels,
int *pitch);
static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static void SW_DirtyTexture(SDL_Renderer * renderer,
SDL_Texture * texture, int numrects,
const SDL_Rect * rects);
static int SW_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect);
static int SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
@@ -84,7 +81,7 @@ SDL_RenderDriver SW_RenderDriver = {
SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD |
SDL_TEXTUREBLENDMODE_MOD),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST),
11,
12,
{
SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB555,
@@ -96,7 +93,8 @@ SDL_RenderDriver SW_RenderDriver = {
SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_YUY2,
SDL_PIXELFORMAT_UYVY},
SDL_PIXELFORMAT_UYVY,
SDL_PIXELFORMAT_YVYU},
0,
0}
};
@@ -174,7 +172,6 @@ Setup_SoftwareRenderer(SDL_Renderer * renderer)
renderer->UpdateTexture = SW_UpdateTexture;
renderer->LockTexture = SW_LockTexture;
renderer->UnlockTexture = SW_UnlockTexture;
renderer->DirtyTexture = SW_DirtyTexture;
renderer->DestroyTexture = SW_DestroyTexture;

renderer->info.mod_modes = SW_RenderDriver.info.mod_modes;
@@ -520,12 +517,6 @@ SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
}

static void
SW_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects)
{
}

static int
SW_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
const SDL_Rect * rect)
@@ -1476,7 +1476,11 @@ SDL_CreateTexture(Uint32 format, int access, int w, int h)
return 0;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer || !renderer->CreateTexture) {
if (!renderer) {
return 0;
}
if (!renderer->CreateTexture) {
SDL_Unsupported();
return 0;
}
texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
@@ -1669,6 +1673,7 @@ SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch)
}
renderer = texture->renderer;
if (!renderer->QueryTexturePixels) {
SDL_Unsupported();
return -1;
}
return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
@@ -1686,6 +1691,7 @@ SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors,
}
renderer = texture->renderer;
if (!renderer->SetTexturePalette) {
SDL_Unsupported();
return -1;
}
return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
@@ -1704,6 +1710,7 @@ SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
}
renderer = texture->renderer;
if (!renderer->GetTexturePalette) {
SDL_Unsupported();
return -1;
}
return renderer->GetTexturePalette(renderer, texture, colors, firstcolor,
@@ -1721,6 +1728,7 @@ SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
}
renderer = texture->renderer;
if (!renderer->SetTextureColorMod) {
SDL_Unsupported();
return -1;
}
if (r < 255 || g < 255 || b < 255) {
@@ -1768,6 +1776,7 @@ SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
}
renderer = texture->renderer;
if (!renderer->SetTextureAlphaMod) {
SDL_Unsupported();
return -1;
}
if (alpha < 255) {
@@ -1804,6 +1813,7 @@ SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
}
renderer = texture->renderer;
if (!renderer->SetTextureBlendMode) {
SDL_Unsupported();
return -1;
}
texture->blendMode = blendMode;
@@ -1835,6 +1845,7 @@ SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
}
renderer = texture->renderer;
if (!renderer->SetTextureScaleMode) {
SDL_Unsupported();
return -1;
}
texture->scaleMode = scaleMode;
@@ -1868,6 +1879,7 @@ SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect,
}
renderer = texture->renderer;
if (!renderer->UpdateTexture) {
SDL_Unsupported();
return -1;
}
if (!rect) {
@@ -1897,6 +1909,7 @@ SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty,
}
renderer = texture->renderer;
if (!renderer->LockTexture) {
SDL_Unsupported();
return -1;
}
if (!rect) {
@@ -1961,7 +1974,11 @@ SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer || !renderer->RenderFill) {
if (!renderer) {
return -1;
}
if(!renderer->RenderFill) {
SDL_Unsupported();
return -1;
}
window = SDL_GetWindowFromID(renderer->window);
@@ -1991,7 +2008,11 @@ SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer || !renderer->RenderCopy) {
if (!renderer) {
return -1;
}
if (!renderer->RenderCopy) {
SDL_Unsupported();
return -1;
}
window = SDL_GetWindowFromID(renderer->window);
@@ -124,9 +124,6 @@ static int NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty,
void **pixels, int *pitch);
static void NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static void NDS_DirtyTexture(SDL_Renderer * renderer,
SDL_Texture * texture, int numrects,
const SDL_Rect * rects);
static int NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g,
Uint8 b, Uint8 a, const SDL_Rect * rect);
static int NDS_RenderCopy(SDL_Renderer * renderer,
@@ -246,7 +243,6 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->UpdateTexture = NDS_UpdateTexture;
renderer->LockTexture = NDS_LockTexture;
renderer->UnlockTexture = NDS_UnlockTexture;
renderer->DirtyTexture = NDS_DirtyTexture;
renderer->DestroyTexture = NDS_DestroyTexture;

renderer->info.mod_modes = NDS_RenderDriver.info.mod_modes;
@@ -499,13 +495,6 @@ NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
/* stub! */
}

static void
NDS_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects)
{
/* stub! */
}

static int
NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect)
@@ -87,7 +87,7 @@ SDL_RenderDriver D3D_RenderDriver = {
SDL_TEXTUREBLENDMODE_MOD),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST |
SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST),
12,
13,
{
SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB332,
@@ -99,8 +99,9 @@ SDL_RenderDriver D3D_RenderDriver = {
SDL_PIXELFORMAT_RGB888,
SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ARGB2101010,
SDL_PIXELFORMAT_YUY2,
SDL_PIXELFORMAT_UYVY,
SDL_PIXELFORMAT_YUY2},
SDL_PIXELFORMAT_YVYU},
0,
0}
};
@@ -55,8 +55,6 @@ static int GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty,
void **pixels, int *pitch);
static void GDI_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static void GDI_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
static int GDI_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect);
static int GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
@@ -78,7 +76,7 @@ SDL_RenderDriver GDI_RenderDriver = {
(SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
SDL_TEXTUREBLENDMODE_BLEND),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST),
11,
12,
{
SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB555,
@@ -90,7 +88,8 @@ SDL_RenderDriver GDI_RenderDriver = {
SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_YUY2,
SDL_PIXELFORMAT_UYVY},
SDL_PIXELFORMAT_UYVY,
SDL_PIXELFORMAT_YVYU},
0,
0}
};
@@ -173,7 +172,6 @@ GDI_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->UpdateTexture = GDI_UpdateTexture;
renderer->LockTexture = GDI_LockTexture;
renderer->UnlockTexture = GDI_UnlockTexture;
renderer->DirtyTexture = GDI_DirtyTexture;
renderer->RenderFill = GDI_RenderFill;
renderer->RenderCopy = GDI_RenderCopy;
renderer->RenderPresent = GDI_RenderPresent;
@@ -274,6 +272,8 @@ GDI_DisplayModeChanged(SDL_Renderer * renderer)
if (n > 0) {
SelectObject(data->render_hdc, data->hbm[0]);
}
data->current_hbm = 0;

return 0;
}

@@ -568,12 +568,6 @@ GDI_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
}

static void
GDI_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
const SDL_Rect * rects)
{
}

static int
GDI_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
const SDL_Rect * rect)

0 comments on commit e0e05fd

Please sign in to comment.