More sync

This commit is contained in:
Chuck Walbourn 2025-11-03 15:50:09 -08:00
parent 22a394bd8f
commit 1fd61e2c32

View File

@ -350,16 +350,16 @@ namespace
switch (info.GetAlphaMode()) switch (info.GetAlphaMode())
{ {
case TEX_ALPHA_MODE_OPAQUE: case TEX_ALPHA_MODE_OPAQUE:
wprintf(L" \x0e0:Opaque"); wprintf(L" \x03B1:Opaque");
break; break;
case TEX_ALPHA_MODE_PREMULTIPLIED: case TEX_ALPHA_MODE_PREMULTIPLIED:
wprintf(L" \x0e0:PM"); wprintf(L" \x03B1:PM");
break; break;
case TEX_ALPHA_MODE_STRAIGHT: case TEX_ALPHA_MODE_STRAIGHT:
wprintf(L" \x0e0:NonPM"); wprintf(L" \x03B1:NonPM");
break; break;
case TEX_ALPHA_MODE_CUSTOM: case TEX_ALPHA_MODE_CUSTOM:
wprintf(L" \x0e0:Custom"); wprintf(L" \x03B1:Custom");
break; break;
case TEX_ALPHA_MODE_UNKNOWN: case TEX_ALPHA_MODE_UNKNOWN:
break; break;
@ -481,7 +481,7 @@ namespace
return false; return false;
} }
D3D_FEATURE_LEVEL featureLevels[] = const D3D_FEATURE_LEVEL featureLevels[] =
{ {
D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_1,
@ -533,7 +533,7 @@ namespace
hr = pAdapter->GetDesc(&desc); hr = pAdapter->GetDesc(&desc);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
wprintf(L"[Using Direct3D on \"%ls\"]\n\n", desc.Description); wprintf(L"\n[Using Direct3D on \"%ls\"]\n\n", desc.Description);
} }
} }
} }
@ -1021,7 +1021,7 @@ namespace
float bestScore = FLT_MAX; float bestScore = FLT_MAX;
for (size_t y = maxsize; y > 0; y >>= 1) for (size_t y = maxsize; y > 0; y >>= 1)
{ {
float score = fabsf((float(x) / float(y)) - origAR); const float score = fabsf((float(x) / float(y)) - origAR);
if (score < bestScore) if (score < bestScore)
{ {
bestScore = score; bestScore = score;
@ -1038,7 +1038,7 @@ namespace
float bestScore = FLT_MAX; float bestScore = FLT_MAX;
for (size_t x = maxsize; x > 0; x >>= 1) for (size_t x = maxsize; x > 0; x >>= 1)
{ {
float score = fabsf((float(x) / float(y)) - origAR); const float score = fabsf((float(x) / float(y)) - origAR);
if (score < bestScore) if (score < bestScore)
{ {
bestScore = score; bestScore = score;
@ -1075,7 +1075,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
std::locale::global(std::locale("")); std::locale::global(std::locale(""));
// Initialize COM (needed for WIC) // Initialize COM (needed for WIC)
HRESULT hr = hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (FAILED(hr)) if (FAILED(hr))
{ {
wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr)); wprintf(L"Failed to initialize COM (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
@ -1241,7 +1241,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
case OPT_WIDTH: case OPT_WIDTH:
if (swscanf_s(pValue, L"%zu", &width) != 1) if (swscanf_s(pValue, L"%zu", &width) != 1)
{ {
wprintf(L"Invalid value specified with -w (%ls)\n", pValue); wprintf(L"Invalid value specified with -w (%ls)\n\n", pValue);
PrintUsage();
return 1; return 1;
} }
break; break;
@ -1249,7 +1250,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
case OPT_HEIGHT: case OPT_HEIGHT:
if (swscanf_s(pValue, L"%zu", &height) != 1) if (swscanf_s(pValue, L"%zu", &height) != 1)
{ {
wprintf(L"Invalid value specified with -h (%ls)\n", pValue); wprintf(L"Invalid value specified with -h (%ls)\n\n", pValue);
PrintUsage();
return 1; return 1;
} }
break; break;
@ -1262,6 +1264,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
if (!format) if (!format)
{ {
wprintf(L"Invalid value specified with -f (%ls)\n", pValue); wprintf(L"Invalid value specified with -f (%ls)\n", pValue);
PrintUsage();
return 1; return 1;
} }
} }
@ -1543,7 +1546,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
#ifdef USE_LIBJPEG #ifdef USE_LIBJPEG
else if (_wcsicmp(ext.c_str(), L".jpg") == 0 || _wcsicmp(ext.c_str(), L".jpeg") == 0) else if (_wcsicmp(ext.c_str(), L".jpg") == 0 || _wcsicmp(ext.c_str(), L".jpeg") == 0)
{ {
hr = LoadFromJPEGFile(curpath.c_str(), &info, *image); hr = LoadFromJPEGFile(curpath.c_str(), JPEG_FLAGS_NONE, &info, *image);
if (FAILED(hr)) if (FAILED(hr))
{ {
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr)); wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
@ -1554,7 +1557,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
#ifdef USE_LIBPNG #ifdef USE_LIBPNG
else if (_wcsicmp(ext.c_str(), L".png") == 0) else if (_wcsicmp(ext.c_str(), L".png") == 0)
{ {
hr = LoadFromPNGFile(curpath.c_str(), &info, *image); hr = LoadFromPNGFile(curpath.c_str(), PNG_FLAGS_NONE, &info, *image);
if (FAILED(hr)) if (FAILED(hr))
{ {
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr)); wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
@ -1613,7 +1616,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
hr = ConvertToSinglePlane(img, nimg, info, *timage); hr = ConvertToSinglePlane(img, nimg, info, *timage);
if (FAILED(hr)) if (FAILED(hr))
{ {
wprintf(L" FAILED [converttosingleplane] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr)); wprintf(L" FAILED [converttosingleplane] (%08X%ls)\n",
static_cast<unsigned int>(hr), GetErrorDesc(hr));
return 1; return 1;
} }
@ -1635,7 +1639,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
// --- Decompress -------------------------------------------------------------- // --- Decompress --------------------------------------------------------------
if (IsCompressed(info.format)) if (IsCompressed(info.format))
{ {
const Image* img = image->GetImage(0, 0, 0); auto img = image->GetImage(0, 0, 0);
assert(img); assert(img);
const size_t nimg = image->GetImageCount(); const size_t nimg = image->GetImageCount();
@ -1646,7 +1650,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
return 1; return 1;
} }
hr = Decompress(img, nimg, info, DXGI_FORMAT_UNKNOWN /* picks good default */, *timage.get()); hr = Decompress(img, nimg, info, DXGI_FORMAT_UNKNOWN /* picks good default */, *timage);
if (FAILED(hr)) if (FAILED(hr))
{ {
wprintf(L" FAILED [decompress] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr)); wprintf(L" FAILED [decompress] (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));