diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-12 07:08:32 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-12 07:08:32 -0300 |
commit | e47c584d770141e1bc0d33da479e0a1412145ce6 (patch) | |
tree | 0a63c53b4fcaac1954f70fc559d7798d8f865bae /drivers | |
parent | f2ae6f87a448bf65f18eac572732cdf29012d661 (diff) | |
parent | f3383ded64f1211457023c5cd95f4ac344e56682 (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnm/bitmap_loader_pnm.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/pnm/bitmap_loader_pnm.cpp b/drivers/pnm/bitmap_loader_pnm.cpp index b57533e521..c9298be26a 100644 --- a/drivers/pnm/bitmap_loader_pnm.cpp +++ b/drivers/pnm/bitmap_loader_pnm.cpp @@ -170,15 +170,12 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E } DVector<uint8_t>::Read r=token.read(); - int bitwidth = width; - if (bitwidth % 8) - bitwidth+=8-(bitwidth%8); for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { - char num = r[i*bitwidth+j]; + char num = r[i*width+j]; bm->set_bit(Point2i(j,i),num=='0'); } @@ -197,11 +194,14 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E } DVector<uint8_t>::Read r=token.read(); + int bitwidth = width; + if (bitwidth % 8) + bitwidth+=8-(bitwidth%8); for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { - int ofs = width*i+j; + int ofs = bitwidth*i+j; uint8_t byte = r[ofs/8]; bool bit = (byte>>(7-(ofs%8)))&1; |