Parcourir la source

[rtextures] advance k in LoadImageColors (#4120)

Some formats are not advancing k to get pixels values
pull/4127/head
Bruno Cabral il y a 6 mois
committed by GitHub
Parent
révision
b5473d5ffd
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: B5690EEEBB952194
1 fichiers modifiés avec 8 ajouts et 6 suppressions
  1. +8
    -6
      src/rtextures.c

+ 8
- 6
src/rtextures.c Voir le fichier

@ -3111,6 +3111,7 @@ Color *LoadImageColors(Image image)
pixels[i].b = 0;
pixels[i].a = 255;
k += 1;
} break;
case PIXELFORMAT_UNCOMPRESSED_R32G32B32:
{
@ -3124,9 +3125,9 @@ Color *LoadImageColors(Image image)
case PIXELFORMAT_UNCOMPRESSED_R32G32B32A32:
{
pixels[i].r = (unsigned char)(((float *)image.data)[k]*255.0f);
pixels[i].g = (unsigned char)(((float *)image.data)[k]*255.0f);
pixels[i].b = (unsigned char)(((float *)image.data)[k]*255.0f);
pixels[i].a = (unsigned char)(((float *)image.data)[k]*255.0f);
pixels[i].g = (unsigned char)(((float *)image.data)[k + 1]*255.0f);
pixels[i].b = (unsigned char)(((float *)image.data)[k + 2]*255.0f);
pixels[i].a = (unsigned char)(((float *)image.data)[k + 3]*255.0f);
k += 4;
} break;
@ -3137,6 +3138,7 @@ Color *LoadImageColors(Image image)
pixels[i].b = 0;
pixels[i].a = 255;
k += 1;
} break;
case PIXELFORMAT_UNCOMPRESSED_R16G16B16:
{
@ -3150,9 +3152,9 @@ Color *LoadImageColors(Image image)
case PIXELFORMAT_UNCOMPRESSED_R16G16B16A16:
{
pixels[i].r = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k])*255.0f);
pixels[i].g = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k])*255.0f);
pixels[i].b = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k])*255.0f);
pixels[i].a = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k])*255.0f);
pixels[i].g = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k + 1])*255.0f);
pixels[i].b = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k + 2])*255.0f);
pixels[i].a = (unsigned char)(HalfToFloat(((unsigned short *)image.data)[k + 3])*255.0f);
k += 4;
} break;

Chargement…
Annuler
Enregistrer