diff options
author | Jonathan Marshall <jmarshall@never.you.mind> | 2013-01-06 15:24:42 +1300 |
---|---|---|
committer | S. Davilla <davilla@4pi.com> | 2013-01-06 08:36:21 -0500 |
commit | 839963db7f5843aaeacb87a1193fce6c22ab3f20 (patch) | |
tree | 105d8d7586a2d1a49dd22b17362e246e09291f22 | |
parent | e10e60eb807164863458571627805c0c5db76281 (diff) |
check the result of lzo1x_optimize
-rw-r--r-- | tools/TexturePacker/XBMCTex.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/TexturePacker/XBMCTex.cpp b/tools/TexturePacker/XBMCTex.cpp index 488e909008..21404df797 100644 --- a/tools/TexturePacker/XBMCTex.cpp +++ b/tools/TexturePacker/XBMCTex.cpp @@ -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; |