mirror of https://github.com/encounter/SDL.git
Renderer backends use SDL_Color instead of int for geometry colors.
This commit is contained in:
parent
086c74556d
commit
3a5e148b13
|
@ -545,7 +545,6 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou
|
|||
const int num_indices = 6 * count;
|
||||
const int size_indices = 4;
|
||||
int cur_indice = 0;
|
||||
int color = (renderer->color.r << 0) | (renderer->color.g << 8) | (renderer->color.b << 16) | ((Uint32)renderer->color.a << 24);
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
float minx, miny, maxx, maxy;
|
||||
|
@ -574,7 +573,7 @@ QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect * rects, const int cou
|
|||
}
|
||||
|
||||
retval = renderer->QueueGeometry(renderer, cmd, NULL,
|
||||
xy, xy_stride, &color, 0 /* color_stride */, NULL, 0,
|
||||
xy, xy_stride, &renderer->color, 0 /* color_stride */, NULL, 0,
|
||||
num_vertices, indices, num_indices, size_indices,
|
||||
1.0f, 1.0f);
|
||||
|
||||
|
@ -640,7 +639,7 @@ QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture,
|
|||
if (cmd != NULL) {
|
||||
retval = renderer->QueueGeometry(renderer, cmd, texture,
|
||||
xy, xy_stride,
|
||||
(const int *)color, color_stride, uv, uv_stride,
|
||||
color, color_stride, uv, uv_stride,
|
||||
num_vertices, indices, num_indices, size_indices,
|
||||
scale_x, scale_y);
|
||||
if (retval < 0) {
|
||||
|
|
|
@ -130,7 +130,7 @@ struct SDL_Renderer
|
|||
const SDL_Rect * srcquad, const SDL_FRect * dstrect,
|
||||
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
|
||||
int (*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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y);
|
||||
|
||||
|
|
|
@ -833,7 +833,7 @@ D3D_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
|
|||
|
||||
static int
|
||||
D3D_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
|
|
@ -1615,12 +1615,11 @@ D3D11_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
|
|||
{
|
||||
VertexPositionColor *verts = (VertexPositionColor *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertexPositionColor), 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
const SDL_Color color = {
|
||||
.r = cmd->data.draw.r,
|
||||
.g = cmd->data.draw.g,
|
||||
.b = cmd->data.draw.b,
|
||||
.a = cmd->data.draw.a
|
||||
};
|
||||
SDL_Color color;
|
||||
color.r = cmd->data.draw.r;
|
||||
color.g = cmd->data.draw.g;
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (!verts) {
|
||||
return -1;
|
||||
|
@ -1642,7 +1641,7 @@ D3D11_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
|
|||
|
||||
static int
|
||||
D3D11_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
|
|
@ -1084,8 +1084,14 @@ METAL_QueueSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
|
|||
static int
|
||||
METAL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
|
||||
{
|
||||
const int color = (cmd->data.draw.r << 0) | (cmd->data.draw.g << 8) | (cmd->data.draw.b << 16) | ((Uint32)cmd->data.draw.a << 24);
|
||||
const size_t vertlen = (2 * sizeof (float) + sizeof (int)) * count;
|
||||
const SDL_Color color = {
|
||||
cmd->data.draw.r,
|
||||
cmd->data.draw.g,
|
||||
cmd->data.draw.b,
|
||||
cmd->data.draw.a
|
||||
};
|
||||
|
||||
const size_t vertlen = (2 * sizeof (float) + sizeof (SDL_Color)) * count;
|
||||
float *verts = (float *) SDL_AllocateRenderVertices(renderer, vertlen, DEVICE_ALIGN(8), &cmd->data.draw.first);
|
||||
if (!verts) {
|
||||
return -1;
|
||||
|
@ -1095,7 +1101,7 @@ METAL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
|
|||
for (int i = 0; i < count; i++, points++) {
|
||||
*(verts++) = points->x;
|
||||
*(verts++) = points->y;
|
||||
*((int *)verts++) = color;
|
||||
*((SDL_Color *)verts++) = color;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1103,12 +1109,16 @@ METAL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
|
|||
static int
|
||||
METAL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
|
||||
{
|
||||
|
||||
const int color = (cmd->data.draw.r << 0) | (cmd->data.draw.g << 8) | (cmd->data.draw.b << 16) | ((Uint32)cmd->data.draw.a << 24);
|
||||
const SDL_Color color = {
|
||||
cmd->data.draw.r,
|
||||
cmd->data.draw.g,
|
||||
cmd->data.draw.b,
|
||||
cmd->data.draw.a
|
||||
};
|
||||
|
||||
SDL_assert(count >= 2); /* should have been checked at the higher level. */
|
||||
|
||||
const size_t vertlen = (2 * sizeof (float) + sizeof (int)) * count;
|
||||
const size_t vertlen = (2 * sizeof (float) + sizeof (SDL_Color)) * count;
|
||||
float *verts = (float *) SDL_AllocateRenderVertices(renderer, vertlen, DEVICE_ALIGN(8), &cmd->data.draw.first);
|
||||
if (!verts) {
|
||||
return -1;
|
||||
|
@ -1118,7 +1128,7 @@ METAL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
|
|||
for (int i = 0; i < count; i++, points++) {
|
||||
*(verts++) = points->x;
|
||||
*(verts++) = points->y;
|
||||
*((int *)verts++) = color;
|
||||
*((SDL_Color *)verts++) = color;
|
||||
}
|
||||
|
||||
/* If the line segment is completely horizontal or vertical,
|
||||
|
@ -1148,7 +1158,7 @@ METAL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
|
|||
|
||||
static int
|
||||
METAL_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
@ -1175,12 +1185,11 @@ METAL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
|||
}
|
||||
|
||||
float *xy_ = (float *)((char*)xy + j * xy_stride);
|
||||
int col_ = *(int *)((char*)color + j * color_stride);
|
||||
|
||||
*(verts++) = xy_[0] * scale_x;
|
||||
*(verts++) = xy_[1] * scale_y;
|
||||
|
||||
*((int *)verts++) = col_;
|
||||
*((SDL_Color *)verts++) = *(SDL_Color *)((char*)color + j * color_stride);
|
||||
|
||||
if (texture) {
|
||||
float *uv_ = (float *)((char*)uv + j * uv_stride);
|
||||
|
|
|
@ -981,7 +981,7 @@ GL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPo
|
|||
|
||||
static int
|
||||
GL_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
|
|
@ -603,7 +603,7 @@ GLES_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
|
|||
|
||||
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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
|
|
@ -663,26 +663,30 @@ static int
|
|||
GLES2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
|
||||
{
|
||||
const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888));
|
||||
int color;
|
||||
const size_t vertlen = (2 * sizeof (float) + sizeof (int)) * count;
|
||||
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
SDL_Color color;
|
||||
color.r = cmd->data.draw.r;
|
||||
color.g = cmd->data.draw.g;
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (colorswap == 0) {
|
||||
color = (cmd->data.draw.r << 0) | (cmd->data.draw.g << 8) | (cmd->data.draw.b << 16) | ((Uint32)cmd->data.draw.a << 24);
|
||||
} else {
|
||||
color = (cmd->data.draw.r << 16) | (cmd->data.draw.g << 8) | (cmd->data.draw.b << 0) | ((Uint32)cmd->data.draw.a << 24);
|
||||
if (colorswap) {
|
||||
Uint8 r = color.r;
|
||||
color.r = color.b;
|
||||
color.b = r;
|
||||
}
|
||||
|
||||
cmd->data.draw.count = count;
|
||||
for (i = 0; i < count; i++) {
|
||||
*(verts++) = 0.5f + points[i].x;
|
||||
*(verts++) = 0.5f + points[i].y;
|
||||
*((int *)verts++) = color;
|
||||
*((SDL_Color *)verts++) = color;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -692,19 +696,24 @@ static int
|
|||
GLES2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
|
||||
{
|
||||
const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888));
|
||||
int color;
|
||||
int i;
|
||||
GLfloat prevx, prevy;
|
||||
const size_t vertlen = ((2 * sizeof (float)) + sizeof (int)) * count;
|
||||
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first);
|
||||
SDL_Color color;
|
||||
color.r = cmd->data.draw.r;
|
||||
color.g = cmd->data.draw.g;
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (colorswap == 0) {
|
||||
color = (cmd->data.draw.r << 0) | (cmd->data.draw.g << 8) | (cmd->data.draw.b << 16) | ((Uint32)cmd->data.draw.a << 24);
|
||||
} else {
|
||||
color = (cmd->data.draw.r << 16) | (cmd->data.draw.g << 8) | (cmd->data.draw.b << 0) | ((Uint32)cmd->data.draw.a << 24);
|
||||
if (colorswap) {
|
||||
Uint8 r = color.r;
|
||||
color.r = color.b;
|
||||
color.b = r;
|
||||
}
|
||||
|
||||
cmd->data.draw.count = count;
|
||||
|
@ -714,7 +723,7 @@ GLES2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
|
|||
prevy = 0.5f + points->y;
|
||||
*(verts++) = prevx;
|
||||
*(verts++) = prevy;
|
||||
*((int *)verts++) = color;
|
||||
*((SDL_Color*)verts++) = color;
|
||||
|
||||
/* bump the end of each line segment out a quarter of a pixel, to provoke
|
||||
the diamond-exit rule. Without this, you won't just drop the last
|
||||
|
@ -733,7 +742,7 @@ GLES2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
|
|||
prevy = yend + (SDL_sinf(angle) * 0.25f);
|
||||
*(verts++) = prevx;
|
||||
*(verts++) = prevy;
|
||||
*((int *)verts++) = color;
|
||||
*((SDL_Color*)verts++) = color;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -741,7 +750,7 @@ GLES2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
|
|||
|
||||
static int
|
||||
GLES2_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
@ -761,7 +770,7 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
|||
for (i = 0; i < count; i++) {
|
||||
int j;
|
||||
float *xy_;
|
||||
int col_;
|
||||
SDL_Color col_;
|
||||
if (size_indices == 4) {
|
||||
j = ((const Uint32 *)indices)[i];
|
||||
} else if (size_indices == 2) {
|
||||
|
@ -773,23 +782,19 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
|
|||
}
|
||||
|
||||
xy_ = (float *)((char*)xy + j * xy_stride);
|
||||
col_ = *(int *)((char*)color + j * color_stride);
|
||||
col_ = *(SDL_Color *)((char*)color + j * color_stride);
|
||||
|
||||
*(verts++) = xy_[0] * scale_x;
|
||||
*(verts++) = xy_[1] * scale_y;
|
||||
|
||||
if (colorswap == 0) {
|
||||
*((int *)verts++) = col_;
|
||||
} else {
|
||||
Uint8 r, g, b, a;
|
||||
r = (col_ >> 0) & 0xff;
|
||||
g = (col_ >> 8) & 0xff;
|
||||
b = (col_ >> 16) & 0xff;
|
||||
a = (col_ >> 24) & 0xff;
|
||||
col_ = (r << 16) | (g << 8) | (b << 0) | ((Uint32)a << 24);
|
||||
*((int *)verts++) = col_;
|
||||
if (colorswap) {
|
||||
Uint8 r = col_.r;
|
||||
col_.r = col_.b;
|
||||
col_.b = r;
|
||||
}
|
||||
|
||||
*((SDL_Color *)verts++) = col_;
|
||||
|
||||
if (texture) {
|
||||
float *uv_ = (float *)((char*)uv + j * uv_stride);
|
||||
*(verts++) = uv_[0];
|
||||
|
|
|
@ -112,7 +112,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int col;
|
||||
SDL_Color col;
|
||||
float x, y, z;
|
||||
} VertCV;
|
||||
|
||||
|
@ -120,7 +120,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
float u, v;
|
||||
int col;
|
||||
SDL_Color col;
|
||||
float x, y, z;
|
||||
} VertTCV;
|
||||
|
||||
|
@ -492,7 +492,7 @@ PSP_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
|
|||
|
||||
static int
|
||||
PSP_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
@ -512,7 +512,7 @@ PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
|
|||
for (i = 0; i < count; i++) {
|
||||
int j;
|
||||
float *xy_;
|
||||
int col_;
|
||||
SDL_Color col_;
|
||||
if (size_indices == 4) {
|
||||
j = ((const Uint32 *)indices)[i];
|
||||
} else if (size_indices == 2) {
|
||||
|
@ -524,7 +524,7 @@ PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
|
|||
}
|
||||
|
||||
xy_ = (float *)((char*)xy + j * xy_stride);
|
||||
col_ = *(int *)((char*)color + j * color_stride);
|
||||
col_ = *(SDL_Color *)((char*)color + j * color_stride);
|
||||
|
||||
verts->x = xy_[0] * scale_x;
|
||||
verts->y = xy_[1] * scale_y;
|
||||
|
@ -545,7 +545,7 @@ PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
|
|||
for (i = 0; i < count; i++) {
|
||||
int j;
|
||||
float *xy_;
|
||||
int col_;
|
||||
SDL_Color col_;
|
||||
float *uv_;
|
||||
|
||||
if (size_indices == 4) {
|
||||
|
@ -559,7 +559,7 @@ PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *t
|
|||
}
|
||||
|
||||
xy_ = (float *)((char*)xy + j * xy_stride);
|
||||
col_ = *(int *)((char*)color + j * color_stride);
|
||||
col_ = *(SDL_Color *)((char*)color + j * color_stride);
|
||||
uv_ = (float *)((char*)uv + j * uv_stride);
|
||||
|
||||
verts->x = xy_[0] * scale_x;
|
||||
|
|
|
@ -545,7 +545,7 @@ typedef struct GeometryCopyData
|
|||
|
||||
static int
|
||||
SW_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ static int VITA_GXM_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *c
|
|||
|
||||
static int
|
||||
VITA_GXM_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y);
|
||||
|
||||
|
@ -442,11 +442,10 @@ VITA_GXM_QueueSetDrawColor(SDL_Renderer * renderer, SDL_RenderCommand *cmd)
|
|||
{
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
|
||||
|
||||
const Uint8 r = cmd->data.color.r;
|
||||
const Uint8 g = cmd->data.color.g;
|
||||
const Uint8 b = cmd->data.color.b;
|
||||
const Uint8 a = cmd->data.color.a;
|
||||
data->drawstate.color = (((Uint32)a << 24) | (b << 16) | (g << 8) | r);
|
||||
data->drawstate.color.r = cmd->data.color.r;
|
||||
data->drawstate.color.g = cmd->data.color.g;
|
||||
data->drawstate.color.b = cmd->data.color.b;
|
||||
data->drawstate.color.a = cmd->data.color.a;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -456,7 +455,7 @@ VITA_GXM_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const
|
|||
{
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
|
||||
|
||||
int color = data->drawstate.color;
|
||||
SDL_Color color = data->drawstate.color;
|
||||
|
||||
color_vertex *vertex = (color_vertex *)pool_malloc(
|
||||
data,
|
||||
|
@ -480,7 +479,7 @@ static int
|
|||
VITA_GXM_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
|
||||
{
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *) renderer->driverdata;
|
||||
int color = data->drawstate.color;
|
||||
SDL_Color color = data->drawstate.color;
|
||||
|
||||
color_vertex *vertex = (color_vertex *)pool_malloc(
|
||||
data,
|
||||
|
@ -506,7 +505,7 @@ VITA_GXM_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const S
|
|||
|
||||
static int
|
||||
VITA_GXM_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
@ -533,7 +532,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu
|
|||
int j;
|
||||
float *xy_;
|
||||
float *uv_;
|
||||
int col_;
|
||||
SDL_Color col_;
|
||||
if (size_indices == 4) {
|
||||
j = ((const Uint32 *)indices)[i];
|
||||
} else if (size_indices == 2) {
|
||||
|
@ -545,7 +544,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu
|
|||
}
|
||||
|
||||
xy_ = (float *)((char*)xy + j * xy_stride);
|
||||
col_ = *(int *)((char*)color + j * color_stride);
|
||||
col_ = *(SDL_Color *)((char*)color + j * color_stride);
|
||||
uv_ = (float *)((char*)uv + j * uv_stride);
|
||||
|
||||
vertices[i].x = xy_[0] * scale_x;
|
||||
|
@ -572,7 +571,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu
|
|||
for (i = 0; i < count; i++) {
|
||||
int j;
|
||||
float *xy_;
|
||||
int col_;
|
||||
SDL_Color col_;
|
||||
if (size_indices == 4) {
|
||||
j = ((const Uint32 *)indices)[i];
|
||||
} else if (size_indices == 2) {
|
||||
|
@ -584,7 +583,7 @@ VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Textu
|
|||
}
|
||||
|
||||
xy_ = (float *)((char*)xy + j * xy_stride);
|
||||
col_ = *(int *)((char*)color + j * color_stride);
|
||||
col_ = *(SDL_Color *)((char*)color + j * color_stride);
|
||||
|
||||
vertices[i].x = xy_[0] * scale_x;
|
||||
vertices[i].y = xy_[1] * scale_y;
|
||||
|
|
|
@ -216,19 +216,31 @@ set_stencil_mask(VITA_GXM_RenderData *data, float x, float y, float w, float h)
|
|||
|
||||
vertices[0].x = x;
|
||||
vertices[0].y = y;
|
||||
vertices[0].color = 0;
|
||||
vertices[0].color.r = 0;
|
||||
vertices[0].color.g = 0;
|
||||
vertices[0].color.b = 0;
|
||||
vertices[0].color.a = 0;
|
||||
|
||||
vertices[1].x = x + w;
|
||||
vertices[1].y = y;
|
||||
vertices[1].color = 0;
|
||||
vertices[1].color.r = 0;
|
||||
vertices[1].color.g = 0;
|
||||
vertices[1].color.b = 0;
|
||||
vertices[1].color.a = 0;
|
||||
|
||||
vertices[2].x = x;
|
||||
vertices[2].y = y + h;
|
||||
vertices[2].color = 0;
|
||||
vertices[2].color.r = 0;
|
||||
vertices[2].color.g = 0;
|
||||
vertices[2].color.b = 0;
|
||||
vertices[2].color.a = 0;
|
||||
|
||||
vertices[3].x = x + w;
|
||||
vertices[3].y = y + h;
|
||||
vertices[3].color = 0;
|
||||
vertices[3].color.r = 0;
|
||||
vertices[3].color.g = 0;
|
||||
vertices[3].color.b = 0;
|
||||
vertices[3].color.a = 0;
|
||||
|
||||
data->drawstate.fragment_program = data->colorFragmentProgram;
|
||||
data->drawstate.vertex_program = data->colorVertexProgram;
|
||||
|
|
|
@ -61,7 +61,7 @@ typedef struct clear_vertex {
|
|||
typedef struct color_vertex {
|
||||
float x;
|
||||
float y;
|
||||
unsigned int color;
|
||||
SDL_Color color;
|
||||
} color_vertex;
|
||||
|
||||
typedef struct texture_vertex {
|
||||
|
@ -69,7 +69,7 @@ typedef struct texture_vertex {
|
|||
float y;
|
||||
float u;
|
||||
float v;
|
||||
unsigned int color;
|
||||
SDL_Color color;
|
||||
} texture_vertex;
|
||||
|
||||
typedef struct gxm_texture {
|
||||
|
@ -100,7 +100,7 @@ typedef struct
|
|||
SDL_bool viewport_dirty;
|
||||
SDL_Texture *texture;
|
||||
SDL_Texture *target;
|
||||
Uint32 color;
|
||||
SDL_Color color;
|
||||
SceGxmFragmentProgram *fragment_program;
|
||||
SceGxmVertexProgram *vertex_program;
|
||||
int last_command;
|
||||
|
@ -110,7 +110,7 @@ typedef struct
|
|||
SDL_bool cliprect_dirty;
|
||||
SDL_Rect cliprect;
|
||||
SDL_bool texturing;
|
||||
Uint32 clear_color;
|
||||
SDL_Color clear_color;
|
||||
int drawablew;
|
||||
int drawableh;
|
||||
} gxm_drawstate_cache;
|
||||
|
|
|
@ -633,7 +633,7 @@ DirectFB_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const
|
|||
|
||||
static int
|
||||
DirectFB_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,
|
||||
const float *xy, int xy_stride, const SDL_Color *color, int color_stride, const float *uv, int uv_stride,
|
||||
int num_vertices, const void *indices, int num_indices, int size_indices,
|
||||
float scale_x, float scale_y)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue