Skip to content

Commit d62ceea

Browse files
authored
Merge pull request #170 from schmouk/dev
Merge Dev to Main for releasing v. 0.2 of library
2 parents 6533a13 + 70c6891 commit d62ceea

29 files changed

+15
-24
lines changed

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CppBMPLoader [![Latest release](http://img.shields.io/github/release/schmouk/cppbmploader.svg?style=plastic&labelColor=blueviolet&color=success)](https://github.com/schmouk/cppbmploader/releases)
2-
An exhaustive BMP Loader, MIT-licensed, implemented for c++14 and c++20
2+
An exhaustive BMP Loader, MIT-licensed, implemented for c++11
33

44
This BMP loader library decodes **Windows** BMP files encoded according to
55
BMP format versions 1 up to 5, as well as the specific *OS/2 1.x* and *OS/2
@@ -27,17 +27,13 @@ sees the number of questions asked on this topic on the Internet and the
2727
number of BMPLoader libraries already existing, but apparently incomplete, that
2828
can be found on *GitHub*, programmed in c++ or in other programming languages.
2929

30-
## c++14 and c++20 versions
31-
Initially, two versions of the library are offerred, one responding to standard
32-
c++14 and the other responding to standard c++20 (offering more advanced
33-
programming concepts, e.g. *ranges* and *views* or STL extensions).
34-
35-
Notice: by November 2024, the c++20 version of the library is not yet released.
30+
## c++11 version
31+
Initially, only a c++11 version of the library code is offerred.
3632

3733
## Notice (1/2)
38-
The c++14 standard version of **CppBMPLoader** does not use any c++14
39-
specificities but only c++11 ones. It has been compiled and validated with
40-
a c++14 compiler but should as well be compilable with a c++11 compiler.
34+
The c++11 version of **CppBMPLoader** has been compiled with c++14 standard as provided by Visual Studio 2022. Meanwhile, it does not use any c++14
35+
specificities but only c++11 ones. While having been compiled and validated with
36+
a c++14 compiler it should as well be compilable with a c++11 compiler.
4137

4238
## Notice (2/2)
4339
All released code has been validated. For this purpose, we used the great
@@ -52,8 +48,6 @@ ISO images of OS/2.
5248

5349
# Documentation
5450
The API of **CppBMPLoader** is documented in [documentation.md](./documentation.doc).
55-
This API is exactly the same for both the c++14 and the c++20 implementations of
56-
the library.
5751

5852
Shortly speeking, this API offers a templated class BMPImage<> for the loading
5953
of BMP images content and classes and functions to extract and load all images
@@ -72,15 +66,12 @@ For those of you who are the most motivated for deeply diving into this
7266
library code, please notice that no implementation documentation is provided
7367
for **CppBMPLoader**.
7468

75-
The design decision made for its first implementation, a.k.a. cpp-14, has been
69+
The design decision made for its first implementation has been
7670
to factorize as much code as possible. This was a tremendous decision when at
7771
bugs fixing time: each bug had to be fixed in one and only one place. This was
78-
also a very deceptive decision about the final readability of the code. So, you
79-
should avoid to have a first look at this code. Prefer to go into the c++20
80-
implementation of **CppBMPLoader** instead to have a far easier reading of it.
81-
There, we've preferred to duplicate the already debugged code, to provide a
82-
clear class for each type of object and for each format version that is
83-
internally managed by the library.
72+
also a very deceptive decision about the final readability of the code. It might be that a further version of libray **CppBMPLoader** will embed c++20 or even c++23 code. Should this happen, a full refactoring would then happen. Duplicating the already debugged code, to provide a
73+
single clear class for each type of object and for each format version that is
74+
internally managed by the library, would eventually enhance the readiness of the code. So, wait and see.
8475

8576
Meanwhile, experienced c++ developers should get no trouble in understanding
8677
the directories tree structure and the code itself as well, which is
File renamed without changes.

cpp-14/bmp_file_bitmaps/bmp_bitmaps.h renamed to cpp-11/bmp_file_bitmaps/bmp_bitmaps.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ namespace bmpl
10601060
masked_content.assign(mask_size, std::uint16_t(0));
10611061

10621062
if (bmpl::utils::PLATFORM_IS_LITTLE_ENDIAN) {
1063-
if (!(this->in_stream.read(reinterpret_cast<char*>(masked_content.data()), mask_size * sizeof std::uint16_t))) {
1063+
if (!(this->in_stream.read(reinterpret_cast<char*>(masked_content.data()), mask_size * sizeof(std::uint16_t)))) {
10641064
if (this->in_stream.eof())
10651065
return this->_set_err(bmpl::utils::ErrorCode::END_OF_FILE);
10661066
else
@@ -1319,7 +1319,7 @@ namespace bmpl
13191319
masked_content.assign(mask_size, std::uint32_t(0));
13201320

13211321
if (bmpl::utils::PLATFORM_IS_LITTLE_ENDIAN) {
1322-
if (!(this->in_stream.read(reinterpret_cast<char*>(masked_content.data()), mask_size * sizeof std::uint32_t))) {
1322+
if (!(this->in_stream.read(reinterpret_cast<char*>(masked_content.data()), mask_size * sizeof(std::uint32_t)))) {
13231323
if (this->in_stream.eof())
13241324
return this->_set_err(bmpl::utils::ErrorCode::END_OF_FILE);
13251325
else
@@ -1372,7 +1372,7 @@ namespace bmpl
13721372
bitmap.assign(bmp_size, bmpl::clr::BGRA_HDR());
13731373

13741374
if (bmpl::utils::PLATFORM_IS_LITTLE_ENDIAN) {
1375-
if (!(this->in_stream.read(reinterpret_cast<char*>(bitmap.data()), bmp_size * sizeof bmpl::clr::BGRA_HDR))) {
1375+
if (!(this->in_stream.read(reinterpret_cast<char*>(bitmap.data()), bmp_size * sizeof(bmpl::clr::BGRA_HDR)))) {
13761376
if (this->in_stream.eof())
13771377
return this->_set_err(bmpl::utils::ErrorCode::END_OF_FILE);
13781378
else
File renamed without changes.
File renamed without changes.

cpp-14/bmp_loader/bmp_loader.h renamed to cpp-11/bmp_loader/bmp_loader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ namespace bmpl
576576

577577
if (is_BA_file()) {
578578
// this is a multi array bitmaps file, let's load the content of the very first image in array
579-
this->_in_stream.seekg(sizeof std::int16_t);
579+
this->_in_stream.seekg(sizeof(std::int16_t));
580580
bmpl::frmt::BAHeader first_ba_header(this->_in_stream);
581581
this->_bitmap_loader_ptr = bmpl::bmpf::create_bitmap_loader<PixelT>(
582582
this->_in_stream,
@@ -736,7 +736,7 @@ namespace bmpl
736736

737737
const std::size_t image_width{ this->image_width };
738738
const std::size_t image_height{ this->image_height };
739-
const std::size_t line_width{ image_width * sizeof PixelT };
739+
const std::size_t line_width{ image_width * sizeof(PixelT) };
740740

741741
std::vector<std::uint8_t> tmp_line;
742742
tmp_line.assign(line_width, 0);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)