Skip to content

Commit 11fb900

Browse files
committed
Fix issue #1
Credits to @seeliger-ec
1 parent 8b06327 commit 11fb900

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ namespace bmp {
516516
throw Exception("Bitmap::Load(\"" + filename + "\"): Only 24 bits per pixel bitmaps supported.");
517517
}
518518

519+
// Seek the beginning of the pixels data
520+
// Note: We can't just assume we're there right after we read the BitmapHeader
521+
// Because some editors like Gimp might put extra information after the header.
522+
// Thanks to @seeliger-ec
523+
ifs.seekg(header->offset_bits);
524+
519525
// Set width & height
520526
m_width = header->width;
521527
m_height = header->height;
@@ -534,7 +540,7 @@ namespace bmp {
534540
color.b = line[i++];
535541
color.g = line[i++];
536542
color.r = line[i++];
537-
m_pixels[IX(x, y)] = color; // this->Set(x, y, color);
543+
m_pixels[IX(x, y)] = color;
538544
}
539545
}
540546

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if(BPP_BUILD_EXAMPLES)
88
foreach(example_file ${EXAMPLES_FILES})
99
message(STATUS "Adding example ${example_file}")
1010
get_filename_component(target_name ${example_file} NAME_WE)
11-
include_directories(${target_name} ${CMAKE_SOURCE_DIR}/include/)
11+
include_directories(${target_name} ${CMAKE_CURRENT_SOURCE_DIR})
1212
add_executable(${target_name} ${example_file})
1313
endforeach()
1414
endif()

0 commit comments

Comments
 (0)