Fixed return value of saveImageText
This commit is contained in:
parent
ed96d92185
commit
3ff9b05254
|
|
@ -141,12 +141,12 @@ template <int N>
|
||||||
bool saveImageText(const msdfgen::BitmapConstRef<byte, N> &bitmap, const char *filename, YDirection outputYDirection) {
|
bool saveImageText(const msdfgen::BitmapConstRef<byte, N> &bitmap, const char *filename, YDirection outputYDirection) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (FILE *f = fopen(filename, "wb")) {
|
if (FILE *f = fopen(filename, "wb")) {
|
||||||
|
success = true;
|
||||||
for (int y = 0; y < bitmap.height; ++y) {
|
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);
|
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) {
|
for (int x = 0; x < N*bitmap.width; ++x)
|
||||||
fprintf(f, x ? " %02X" : "%02X", (unsigned) *p++);
|
success &= fprintf(f, x ? " %02X" : "%02X", (unsigned) *p++) > 0;
|
||||||
}
|
success &= fprintf(f, "\n") > 0;
|
||||||
fprintf(f, "\n");
|
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
@ -157,12 +157,12 @@ template <int N>
|
||||||
bool saveImageText(const msdfgen::BitmapConstRef<float, N> &bitmap, const char *filename, YDirection outputYDirection) {
|
bool saveImageText(const msdfgen::BitmapConstRef<float, N> &bitmap, const char *filename, YDirection outputYDirection) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (FILE *f = fopen(filename, "wb")) {
|
if (FILE *f = fopen(filename, "wb")) {
|
||||||
|
success = true;
|
||||||
for (int y = 0; y < bitmap.height; ++y) {
|
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);
|
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) {
|
for (int x = 0; x < N*bitmap.width; ++x)
|
||||||
fprintf(f, x ? " %g" : "%g", *p++);
|
success &= fprintf(f, x ? " %g" : "%g", *p++) > 0;
|
||||||
}
|
success &= fprintf(f, "\n") > 0;
|
||||||
fprintf(f, "\n");
|
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue