OpenGLES: remove RenderCopy and RenderCopyEx from back-end

main
Sylvain 2021-09-20 16:40:47 +02:00 committed by Ryan C. Gordon
parent d192515428
commit 88548070a5
2 changed files with 2 additions and 157 deletions

View File

@ -57,10 +57,6 @@ SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei))
SDL_PROC_OES(void, glBindFramebufferOES, (GLenum, GLuint))
SDL_PROC_OES(void, glFramebufferTexture2DOES, (GLenum, GLenum, GLenum, GLuint, GLint))
SDL_PROC_OES(GLenum, glCheckFramebufferStatusOES, (GLenum))
SDL_PROC(void, glPushMatrix, (void))
SDL_PROC(void, glTranslatef, (GLfloat, GLfloat, GLfloat))
SDL_PROC(void, glRotatef, (GLfloat, GLfloat, GLfloat, GLfloat))
SDL_PROC(void, glPopMatrix, (void))
SDL_PROC_OES(void, glDeleteFramebuffersOES, (GLsizei, const GLuint*))
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -632,129 +632,6 @@ GLES_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
return 0;
}
static int
GLES_QueueCopy(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect)
{
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
GLfloat minx, miny, maxx, maxy;
GLfloat minu, maxu, minv, maxv;
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, 16 * sizeof (GLfloat), 0, &cmd->data.draw.first);
if (!verts) {
return -1;
}
cmd->data.draw.count = 1;
minx = dstrect->x;
miny = dstrect->y;
maxx = dstrect->x + dstrect->w;
maxy = dstrect->y + dstrect->h;
minu = (GLfloat) srcrect->x / texture->w;
minu *= texturedata->texw;
maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
maxu *= texturedata->texw;
minv = (GLfloat) srcrect->y / texture->h;
minv *= texturedata->texh;
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
maxv *= texturedata->texh;
*(verts++) = minx;
*(verts++) = miny;
*(verts++) = maxx;
*(verts++) = miny;
*(verts++) = minx;
*(verts++) = maxy;
*(verts++) = maxx;
*(verts++) = maxy;
*(verts++) = minu;
*(verts++) = minv;
*(verts++) = maxu;
*(verts++) = minv;
*(verts++) = minu;
*(verts++) = maxv;
*(verts++) = maxu;
*(verts++) = maxv;
return 0;
}
static int
GLES_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * texture,
const SDL_Rect * srcquad, const SDL_FRect * dstrect,
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
{
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
GLfloat minx, miny, maxx, maxy;
GLfloat centerx, centery;
GLfloat minu, maxu, minv, maxv;
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, 19 * sizeof (GLfloat), 0, &cmd->data.draw.first);
if (!verts) {
return -1;
}
centerx = center->x;
centery = center->y;
if (flip & SDL_FLIP_HORIZONTAL) {
minx = dstrect->w - centerx;
maxx = -centerx;
}
else {
minx = -centerx;
maxx = dstrect->w - centerx;
}
if (flip & SDL_FLIP_VERTICAL) {
miny = dstrect->h - centery;
maxy = -centery;
}
else {
miny = -centery;
maxy = dstrect->h - centery;
}
minu = (GLfloat) srcquad->x / texture->w;
minu *= texturedata->texw;
maxu = (GLfloat) (srcquad->x + srcquad->w) / texture->w;
maxu *= texturedata->texw;
minv = (GLfloat) srcquad->y / texture->h;
minv *= texturedata->texh;
maxv = (GLfloat) (srcquad->y + srcquad->h) / texture->h;
maxv *= texturedata->texh;
cmd->data.draw.count = 1;
*(verts++) = minx;
*(verts++) = miny;
*(verts++) = maxx;
*(verts++) = miny;
*(verts++) = minx;
*(verts++) = maxy;
*(verts++) = maxx;
*(verts++) = maxy;
*(verts++) = minu;
*(verts++) = minv;
*(verts++) = maxu;
*(verts++) = minv;
*(verts++) = minu;
*(verts++) = maxv;
*(verts++) = maxu;
*(verts++) = maxv;
*(verts++) = (GLfloat) dstrect->x + centerx;
*(verts++) = (GLfloat) dstrect->y + centery;
*(verts++) = (GLfloat) angle;
return 0;
}
#if SDL_HAVE_RENDER_GEOMETRY
static int
GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
@ -812,7 +689,6 @@ GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *
}
return 0;
}
#endif
static void
SetDrawState(GLES_RenderData *data, const SDL_RenderCommand *cmd)
@ -1028,35 +904,13 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
break;
}
case SDL_RENDERCMD_COPY: {
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
SetCopyState(data, cmd);
data->glVertexPointer(2, GL_FLOAT, 0, verts);
data->glTexCoordPointer(2, GL_FLOAT, 0, verts + 8);
data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
case SDL_RENDERCMD_COPY: /* unused */
break;
}
case SDL_RENDERCMD_COPY_EX: {
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
const GLfloat translatex = verts[16];
const GLfloat translatey = verts[17];
const GLfloat angle = verts[18];
SetCopyState(data, cmd);
data->glVertexPointer(2, GL_FLOAT, 0, verts);
data->glTexCoordPointer(2, GL_FLOAT, 0, verts + 8);
/* Translate to flip, rotate, translate to position */
data->glPushMatrix();
data->glTranslatef(translatex, translatey, 0.0f);
data->glRotatef(angle, 0.0, 0.0, 1.0);
data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
data->glPopMatrix();
case SDL_RENDERCMD_COPY_EX: /* unused */
break;
}
case SDL_RENDERCMD_GEOMETRY: {
#if SDL_HAVE_RENDER_GEOMETRY
const GLfloat *verts = (GLfloat *) (((Uint8 *) vertices) + cmd->data.draw.first);
SDL_Texture *texture = cmd->data.draw.texture;
const size_t count = cmd->data.draw.count;
@ -1079,7 +933,6 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
data->glDrawArrays(GL_TRIANGLES, 0, (GLsizei) count);
data->glDisableClientState(GL_COLOR_ARRAY);
#endif
break;
}
@ -1312,11 +1165,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueueDrawPoints = GLES_QueueDrawPoints;
renderer->QueueDrawLines = GLES_QueueDrawLines;
renderer->QueueFillRects = GLES_QueueFillRects;
renderer->QueueCopy = GLES_QueueCopy;
renderer->QueueCopyEx = GLES_QueueCopyEx;
#if SDL_HAVE_RENDER_GEOMETRY
renderer->QueueGeometry = GLES_QueueGeometry;
#endif
renderer->RunCommandQueue = GLES_RunCommandQueue;
renderer->RenderReadPixels = GLES_RenderReadPixels;
renderer->RenderPresent = GLES_RenderPresent;