summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/pnm/bitmap_loader_pnm.cpp7
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');
}