Skip to content

Commit

Permalink
Unrelated warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Nov 8, 2020
1 parent 3e06eac commit 7391abc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions ext/native/tools/atlastool.cpp
Expand Up @@ -462,8 +462,8 @@ void RasterizeFonts(const FontReferenceList &fontRefs, vector<CharRange> &ranges
} else {
dist = -closest.find_closest(ctx, cty, 1);
}
dist = dist / supersample * distmult + 127.5;
dist = floor(dist + 0.5);
dist = dist / supersample * distmult + 127.5f;
dist = floor(dist + 0.5f);
if (dist < 0) dist = 0;
if (dist > 255) dist = 255;

Expand Down Expand Up @@ -564,7 +564,7 @@ struct FontDesc {
}
}

height = metrics_height / 64.0 / supersample;
height = metrics_height / 64.0f / supersample;
}

void OutputSelf(FILE *fil, float tw, float th, const vector<Data> &results) const {
Expand Down Expand Up @@ -987,7 +987,7 @@ int main(int argc, char **argv) {
fwrite(&header, 1, sizeof(header), meta);
// For each image
for (int i = 0; i < (int)images.size(); i++) {
AtlasImage atlas_image = images[i].ToAtlasImage(dest.width(), dest.height(), results);
AtlasImage atlas_image = images[i].ToAtlasImage((float)dest.width(), (float)dest.height(), results);
fwrite(&atlas_image, 1, sizeof(atlas_image), meta);
}
// For each font
Expand All @@ -998,7 +998,7 @@ int main(int argc, char **argv) {
fwrite(&font_header, 1, sizeof(font_header), meta);
auto ranges = font.GetRanges();
fwrite(ranges.data(), sizeof(AtlasCharRange), ranges.size(), meta);
auto chars = font.GetChars(dest.width(), dest.height(), results);
auto chars = font.GetChars((float)dest.width(), (float)dest.height(), results);
fwrite(chars.data(), sizeof(AtlasChar), chars.size(), meta);
}
fclose(meta);
Expand All @@ -1010,7 +1010,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < (int)fonts.size(); i++) {
FontDesc &xfont = fonts[i];
xfont.ComputeHeight(results, distmult);
xfont.OutputSelf(cpp_file, dest.width(), dest.height(), results);
xfont.OutputSelf(cpp_file, (float)dest.width(), (float)dest.height(), results);
}

if (fonts.size()) {
Expand All @@ -1024,7 +1024,7 @@ int main(int argc, char **argv) {
if (images.size()) {
fprintf(cpp_file, "const AtlasImage %s_images[%i] = {\n", atlas_name, (int)images.size());
for (int i = 0; i < (int)images.size(); i++) {
images[i].OutputSelf(cpp_file, dest.width(), dest.height(), results);
images[i].OutputSelf(cpp_file, (float)dest.width(), (float)dest.height(), results);
}
fprintf(cpp_file, "};\n");
}
Expand Down
6 changes: 3 additions & 3 deletions ext/native/tools/atlastool/atlastool.vcxproj
Expand Up @@ -70,7 +70,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
Expand All @@ -90,7 +90,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>../../../../;../../ext;../../;../../../../ext;../prebuilt</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
Expand All @@ -108,4 +108,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

0 comments on commit 7391abc

Please sign in to comment.