Skip to content

Commit

Permalink
Fixed return value of saveImageText
Browse files Browse the repository at this point in the history
  • Loading branch information
Chlumsky committed Jul 27, 2021
1 parent ed96d92 commit 3ff9b05
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions msdf-atlas-gen/image-save.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ template <int N>
bool saveImageText(const msdfgen::BitmapConstRef<byte, N> &bitmap, const char *filename, YDirection outputYDirection) {
bool success = false;
if (FILE *f = fopen(filename, "wb")) {
success = true;
for (int y = 0; y < bitmap.height; ++y) {
const byte *p = bitmap.pixels+N*bitmap.width*(outputYDirection == YDirection::TOP_DOWN ? bitmap.height-y-1 : y);
for (int x = 0; x < N*bitmap.width; ++x) {
fprintf(f, x ? " %02X" : "%02X", (unsigned) *p++);
}
fprintf(f, "\n");
for (int x = 0; x < N*bitmap.width; ++x)
success &= fprintf(f, x ? " %02X" : "%02X", (unsigned) *p++) > 0;
success &= fprintf(f, "\n") > 0;
}
fclose(f);
}
Expand All @@ -157,12 +157,12 @@ template <int N>
bool saveImageText(const msdfgen::BitmapConstRef<float, N> &bitmap, const char *filename, YDirection outputYDirection) {
bool success = false;
if (FILE *f = fopen(filename, "wb")) {
success = true;
for (int y = 0; y < bitmap.height; ++y) {
const float *p = bitmap.pixels+N*bitmap.width*(outputYDirection == YDirection::TOP_DOWN ? bitmap.height-y-1 : y);
for (int x = 0; x < N*bitmap.width; ++x) {
fprintf(f, x ? " %g" : "%g", *p++);
}
fprintf(f, "\n");
for (int x = 0; x < N*bitmap.width; ++x)
success &= fprintf(f, x ? " %g" : "%g", *p++) > 0;
success &= fprintf(f, "\n") > 0;
}
fclose(f);
}
Expand Down

0 comments on commit 3ff9b05

Please sign in to comment.