Skip to content

Commit

Permalink
fixing errors
Browse files Browse the repository at this point in the history
idk how to run the linux test locally
  • Loading branch information
GDBobby committed Sep 24, 2023
1 parent 828ec20 commit b907572
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 249 deletions.
14 changes: 7 additions & 7 deletions examples/HistogramBitmap/HistogramBitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
uint32_t reservedBytes = 0;
uint32_t pixelDataOffset = 54;

BmpHeader(size_t imageSize) {
BmpHeader(uint16_t imageSize) {
sizeOfBitmapFile += imageSize * imageSize * 3; //rgb, 1 byte per color
}
void writeToFile(std::ofstream& outFile){
Expand All @@ -40,7 +40,7 @@
uint32_t colorTableEntries = 0;
uint32_t importantColors = 0;

BmpInfoHeader(size_t imageSize){
BmpInfoHeader(uint16_t imageSize){
width = imageSize;
height = imageSize;
}
Expand Down Expand Up @@ -120,7 +120,7 @@ struct Config {
}
};

void writeBitmapFileHeader(size_t imageSize, std::ofstream& outFile) {
void writeBitmapFileHeader(uint16_t imageSize, std::ofstream& outFile) {

assert(outFile.is_open());
BmpHeader bmpHeader{imageSize};
Expand Down Expand Up @@ -153,13 +153,13 @@ class HistogramBitmap {


auto add(float const value) -> HistogramBitmap& {
heightValues.push_back(static_cast<std::size_t>((value + 1.0f) * 0.5f * static_cast<float>(imageSize)));
heightValues.push_back((value + 1.0f) * 0.5f * static_cast<float>(imageSize));

return *this;
}

void writeImage() {
std::vector<uint16_t> interpolatedHeight;
std::vector<float> interpolatedHeight;
interpolatedHeight.resize(imageSize);
float stepSizeOfBaseGraph = static_cast<float>(imageSize) / static_cast<float>(heightValues.size() - 1);

Expand Down Expand Up @@ -189,7 +189,7 @@ class HistogramBitmap {
Color outColor;
for(int y = 0; y < imageSize; y++) {
for(int x = 0; x < imageSize; x++) {
if(interpolatedHeight[x] >= y) {
if(interpolatedHeight[x] >= (float)y) {
histogramColor.writeToFile(outFile);
}
else{
Expand All @@ -207,7 +207,7 @@ class HistogramBitmap {
uint16_t imageSize = 256;
Color backgroundColor{.red = 0, .green = 0, .blue = 0};
Color histogramColor{.red = 0, .green = 127, .blue = 0};
std::vector<size_t> heightValues;
std::vector<float> heightValues;
};
} // namespace

Expand Down
12 changes: 0 additions & 12 deletions examples/Texture2D/CMakeLists.txt

This file was deleted.

230 changes: 0 additions & 230 deletions examples/Texture2D/Texture2D.cpp

This file was deleted.

0 comments on commit b907572

Please sign in to comment.