Skip to content

Commit

Permalink
check the result of lzo1x_optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Jan 6, 2013
1 parent 3d11150 commit 6ebca65
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/TexturePacker/XBMCTex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,15 @@ CXBTFFrame appendContent(CXBTFWriter &writer, int width, int height, unsigned ch
else
{ // success
lzo_uint optimSize = size;
lzo1x_optimize(packed, packedSize, data, &optimSize, NULL);
writer.AppendContent(packed, packedSize);
if (lzo1x_optimize(packed, packedSize, data, &optimSize, NULL) != LZO_E_OK || optimSize != size)
{ //optimisation failed
packedSize = size;
writer.AppendContent(data, size);
}
else
{ // success
writer.AppendContent(packed, packedSize);
}
}
delete[] working;
delete[] packed;
Expand Down

0 comments on commit 6ebca65

Please sign in to comment.