Skip to content

Commit

Permalink
Allow for odd stride when rotating Jpg images
Browse files Browse the repository at this point in the history
  • Loading branch information
hughsando committed Apr 16, 2024
1 parent ac4d1f6 commit 77a38ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions project/src/common/SurfaceIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ static Surface *TryJPEG(FILE *inFile,const uint8 *inData, int inDataLen, IAppDat

RenderTarget target = result->BeginRender(Rect(imageW, imageH));

int strideBytes = target.Row(1)-target.Row(0);

while (cinfo.output_scanline < cinfo.output_height)
{
Expand All @@ -369,7 +370,7 @@ static Surface *TryJPEG(FILE *inFile,const uint8 *inData, int inDataLen, IAppDat
for(int x=0; x<imageH; x++)
{
*col = rowBuf[x];
col += imageW;
col = (RGB *)((char *)col + strideBytes);
}
}
else if (rotation==2)
Expand All @@ -386,7 +387,7 @@ static Surface *TryJPEG(FILE *inFile,const uint8 *inData, int inDataLen, IAppDat
for(int x=0; x<imageH; x++)
{
*col = rowBuf[x];
col -= imageW;
col = (RGB *)((char *)col - strideBytes);
}
}

Expand Down

0 comments on commit 77a38ae

Please sign in to comment.