@@ -350,16 +350,16 @@ namespace
350350 switch (info.GetAlphaMode ())
351351 {
352352 case TEX_ALPHA_MODE_OPAQUE:
353- wprintf (L" \x0e0 :Opaque" );
353+ wprintf (L" \x03B1 :Opaque" );
354354 break ;
355355 case TEX_ALPHA_MODE_PREMULTIPLIED:
356- wprintf (L" \x0e0 :PM" );
356+ wprintf (L" \x03B1 :PM" );
357357 break ;
358358 case TEX_ALPHA_MODE_STRAIGHT:
359- wprintf (L" \x0e0 :NonPM" );
359+ wprintf (L" \x03B1 :NonPM" );
360360 break ;
361361 case TEX_ALPHA_MODE_CUSTOM:
362- wprintf (L" \x0e0 :Custom" );
362+ wprintf (L" \x03B1 :Custom" );
363363 break ;
364364 case TEX_ALPHA_MODE_UNKNOWN:
365365 break ;
@@ -481,7 +481,7 @@ namespace
481481 return false ;
482482 }
483483
484- D3D_FEATURE_LEVEL featureLevels[] =
484+ const D3D_FEATURE_LEVEL featureLevels[] =
485485 {
486486 D3D_FEATURE_LEVEL_11_0,
487487 D3D_FEATURE_LEVEL_10_1,
@@ -533,7 +533,7 @@ namespace
533533 hr = pAdapter->GetDesc (&desc);
534534 if (SUCCEEDED (hr))
535535 {
536- wprintf (L" [Using Direct3D on \" %ls\" ]\n\n " , desc.Description );
536+ wprintf (L" \n [Using Direct3D on \" %ls\" ]\n\n " , desc.Description );
537537 }
538538 }
539539 }
@@ -1021,7 +1021,7 @@ namespace
10211021 float bestScore = FLT_MAX;
10221022 for (size_t y = maxsize; y > 0 ; y >>= 1 )
10231023 {
1024- float score = fabsf ((float (x) / float (y)) - origAR);
1024+ const float score = fabsf ((float (x) / float (y)) - origAR);
10251025 if (score < bestScore)
10261026 {
10271027 bestScore = score;
@@ -1038,7 +1038,7 @@ namespace
10381038 float bestScore = FLT_MAX;
10391039 for (size_t x = maxsize; x > 0 ; x >>= 1 )
10401040 {
1041- float score = fabsf ((float (x) / float (y)) - origAR);
1041+ const float score = fabsf ((float (x) / float (y)) - origAR);
10421042 if (score < bestScore)
10431043 {
10441044 bestScore = score;
@@ -1075,7 +1075,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
10751075 std::locale::global (std::locale (" " ));
10761076
10771077 // Initialize COM (needed for WIC)
1078- HRESULT hr = hr = CoInitializeEx (nullptr , COINIT_MULTITHREADED);
1078+ HRESULT hr = CoInitializeEx (nullptr , COINIT_MULTITHREADED);
10791079 if (FAILED (hr))
10801080 {
10811081 wprintf (L" Failed to initialize COM (%08X%ls)\n " , static_cast <unsigned int >(hr), GetErrorDesc (hr));
@@ -1241,15 +1241,17 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
12411241 case OPT_WIDTH:
12421242 if (swscanf_s (pValue, L" %zu" , &width) != 1 )
12431243 {
1244- wprintf (L" Invalid value specified with -w (%ls)\n " , pValue);
1244+ wprintf (L" Invalid value specified with -w (%ls)\n\n " , pValue);
1245+ PrintUsage ();
12451246 return 1 ;
12461247 }
12471248 break ;
12481249
12491250 case OPT_HEIGHT:
12501251 if (swscanf_s (pValue, L" %zu" , &height) != 1 )
12511252 {
1252- wprintf (L" Invalid value specified with -h (%ls)\n " , pValue);
1253+ wprintf (L" Invalid value specified with -h (%ls)\n\n " , pValue);
1254+ PrintUsage ();
12531255 return 1 ;
12541256 }
12551257 break ;
@@ -1262,6 +1264,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
12621264 if (!format)
12631265 {
12641266 wprintf (L" Invalid value specified with -f (%ls)\n " , pValue);
1267+ PrintUsage ();
12651268 return 1 ;
12661269 }
12671270 }
@@ -1543,7 +1546,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
15431546 #ifdef USE_LIBJPEG
15441547 else if (_wcsicmp (ext.c_str (), L" .jpg" ) == 0 || _wcsicmp (ext.c_str (), L" .jpeg" ) == 0 )
15451548 {
1546- hr = LoadFromJPEGFile (curpath.c_str (), &info, *image);
1549+ hr = LoadFromJPEGFile (curpath.c_str (), JPEG_FLAGS_NONE, &info, *image);
15471550 if (FAILED (hr))
15481551 {
15491552 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[])
15541557 #ifdef USE_LIBPNG
15551558 else if (_wcsicmp (ext.c_str (), L" .png" ) == 0 )
15561559 {
1557- hr = LoadFromPNGFile (curpath.c_str (), &info, *image);
1560+ hr = LoadFromPNGFile (curpath.c_str (), PNG_FLAGS_NONE, &info, *image);
15581561 if (FAILED (hr))
15591562 {
15601563 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[])
16131616 hr = ConvertToSinglePlane (img, nimg, info, *timage);
16141617 if (FAILED (hr))
16151618 {
1616- wprintf (L" FAILED [converttosingleplane] (%08X%ls)\n " , static_cast <unsigned int >(hr), GetErrorDesc (hr));
1619+ wprintf (L" FAILED [converttosingleplane] (%08X%ls)\n " ,
1620+ static_cast <unsigned int >(hr), GetErrorDesc (hr));
16171621 return 1 ;
16181622 }
16191623
@@ -1635,7 +1639,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
16351639 // --- Decompress --------------------------------------------------------------
16361640 if (IsCompressed (info.format ))
16371641 {
1638- const Image* img = image->GetImage (0 , 0 , 0 );
1642+ auto img = image->GetImage (0 , 0 , 0 );
16391643 assert (img);
16401644 const size_t nimg = image->GetImageCount ();
16411645
@@ -1646,7 +1650,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
16461650 return 1 ;
16471651 }
16481652
1649- hr = Decompress (img, nimg, info, DXGI_FORMAT_UNKNOWN /* picks good default */ , *timage. get () );
1653+ hr = Decompress (img, nimg, info, DXGI_FORMAT_UNKNOWN /* picks good default */ , *timage);
16501654 if (FAILED (hr))
16511655 {
16521656 wprintf (L" FAILED [decompress] (%08X%ls)\n " , static_cast <unsigned int >(hr), GetErrorDesc (hr));
0 commit comments