diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-11 11:44:53 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-11 11:44:53 -0300 |
commit | 9e8f647440bfbdd1b59adb33ea386d89ad8a8f74 (patch) | |
tree | 40dfa6ae5c46358dc02fc67e82bde1564f59a7d3 /drivers/pnm | |
parent | e212058841ea300c75764da4fa3d1b10f02c03e5 (diff) |
fix issue loading binary pbm
Diffstat (limited to 'drivers/pnm')
-rw-r--r-- | drivers/pnm/bitmap_loader_pnm.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/pnm/bitmap_loader_pnm.cpp b/drivers/pnm/bitmap_loader_pnm.cpp index 874e5977c1..cc7f8877be 100644 --- a/drivers/pnm/bitmap_loader_pnm.cpp +++ b/drivers/pnm/bitmap_loader_pnm.cpp @@ -170,12 +170,15 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E } DVector<uint8_t>::Read r=token.read(); - + int bitwidth = width; + if (bidtwidth % 8) + bitwidth+=8-(bitwidth%8); + for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { - char num = r[i*width+j]; + char num = r[i*bitwidth+j]; bm->set_bit(Point2i(j,i),num=='0'); } |