Renderer backends use SDL_Color instead of int for geometry colors.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 3259c4a..950db0b 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -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) {
diff --git a/src/render/SDL_sysrender.h b/src/render/SDL_sysrender.h
index a9ae25d..2c49c15 100644
--- a/src/render/SDL_sysrender.h
+++ b/src/render/SDL_sysrender.h
@@ -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);
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 3a876e1..8ca95b5 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -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)
{
diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c
index 2192816..620f395 100644
--- a/src/render/direct3d11/SDL_render_d3d11.c
+++ b/src/render/direct3d11/SDL_render_d3d11.c
@@ -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)
{
diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m
index 00e5de9..c8cf597 100644
--- a/src/render/metal/SDL_render_metal.m
+++ b/src/render/metal/SDL_render_metal.m
@@ -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);
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index dbfcc41..44c5730 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -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)
{
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 5beac99..065bf9b 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -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)
{
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 44d5cb2..ae49503 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -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];
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index 4169532..ebeddc2 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -112,16 +112,16 @@ typedef struct
typedef struct
{
- int col;
- float x, y, z;
+ SDL_Color col;
+ float x, y, z;
} VertCV;
typedef struct
{
- float u, v;
- int col;
- float x, y, z;
+ float u, v;
+ SDL_Color col;
+ float x, y, z;
} VertTCV;
#define PI 3.14159265358979f
@@ -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;
diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index 14f49b6..09e2127 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -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)
{
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 4659fe8..d4a086a 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -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;
diff --git a/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/src/render/vitagxm/SDL_render_vita_gxm_tools.c
index 42fc148..ed3c136 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm_tools.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm_tools.c
@@ -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;
diff --git a/src/render/vitagxm/SDL_render_vita_gxm_types.h b/src/render/vitagxm/SDL_render_vita_gxm_types.h
index 3dd6dc4..48ef378 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm_types.h
+++ b/src/render/vitagxm/SDL_render_vita_gxm_types.h
@@ -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;
diff --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c
index 00b70b3..85331d9 100644
--- a/src/video/directfb/SDL_DirectFB_render.c
+++ b/src/video/directfb/SDL_DirectFB_render.c
@@ -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)
{