Skip to content

Commit

Permalink
fix Load(): RGB not BGR
Browse files Browse the repository at this point in the history
  • Loading branch information
a1exsh committed Oct 31, 2021
1 parent ba8a01e commit f7a9610
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/engine/image_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace fheroes2
const uint8_t * inXEnd = inX + surface->w * 3;

for ( ; inX != inXEnd; inX += 3, ++outX ) {
*outX = GetColorId( *( inX + 2 ), *( inX + 1 ), *inX );
*outX = GetColorId( inX[0], inX[1], inX[2] );
}
}
}
Expand All @@ -177,21 +177,21 @@ namespace fheroes2
const uint8_t * inXEnd = inX + surface->w * 4;

for ( ; inX != inXEnd; inX += 4, ++outX, ++transformX ) {
const uint8_t alpha = *( inX + 3 );
const uint8_t alpha = inX[3];
if ( alpha < 255 ) {
if ( alpha == 0 ) {
*transformX = 1;
}
else if ( *( inX ) == 0 && *( inX + 1 ) == 0 && *( inX + 2 ) == 0 ) {
else if ( inX[0] == 0 && inX[1] == 0 && inX[2] == 0 ) {
*transformX = 2;
}
else {
*outX = GetColorId( *( inX + 2 ), *( inX + 1 ), *inX );
*outX = GetColorId( inX[0], inX[1], inX[2] );
*transformX = 0;
}
}
else {
*outX = GetColorId( *( inX + 2 ), *( inX + 1 ), *inX );
*outX = GetColorId( inX[0], inX[1], inX[2] );
*transformX = 0;
}
}
Expand Down

0 comments on commit f7a9610

Please sign in to comment.