From 27dfd430ad0806f24b87c17ac9239ed7c3f9ad66 Mon Sep 17 00:00:00 2001 From: karutoh Date: Mon, 19 Feb 2024 21:12:03 -0800 Subject: [PATCH] Fixed image decoding. --- include/ehs/io/Glyph.h | 2 +- src/EHS.cpp | 4 ++-- src/io/Glyph.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ehs/io/Glyph.h b/include/ehs/io/Glyph.h index 50dec7d..6672fba 100644 --- a/include/ehs/io/Glyph.h +++ b/include/ehs/io/Glyph.h @@ -20,7 +20,7 @@ namespace ehs public: Glyph(); - Glyph(Serializer<>& ser); + Glyph(Serializer& ser); Glyph(const Char_32 code); diff --git a/src/EHS.cpp b/src/EHS.cpp index a12d78b..779cd9d 100644 --- a/src/EHS.cpp +++ b/src/EHS.cpp @@ -330,7 +330,7 @@ namespace ehs else if (colorType == 6) channels = 4; - *out = Img(out->GetId(), bitDepth, channels, {width, height}); + *out = Img(out->GetId(), bitDepth / 8, channels, {width, height}); UInt_8 compression = ihdrData->Read(); if (compression) @@ -555,7 +555,7 @@ namespace ehs UInt_64 size = width * channels * height; - *out = Img(out->GetId(), bitDepth, channels, {width, height}); + *out = Img(out->GetId(), bitDepth / 8, channels, {width, height}); Byte prevPixel[4] = {0, 0, 0, 255}; diff --git a/src/io/Glyph.cpp b/src/io/Glyph.cpp index a5f1fae..2c0b5c2 100644 --- a/src/io/Glyph.cpp +++ b/src/io/Glyph.cpp @@ -7,7 +7,7 @@ namespace ehs { } - Glyph::Glyph(Serializer<>& ser) + Glyph::Glyph(Serializer& ser) : code(ser.Read()), pos(ser.ReadVec2()), scale(ser.ReadVec2()), uv(ser.ReadRect()), bearing(ser.ReadVec2()), advance(ser.ReadVec2()) {