Skip to content

Commit da83558

Browse files
author
Chuck Walbourn
committed
Fix writing 16bpp
1 parent 6ec386f commit da83558

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎Auxiliary/DirectXTexPNG.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ namespace
354354
using_srgb = true;
355355
[[fallthrough]];
356356
case DXGI_FORMAT_B8G8R8X8_UNORM:
357+
using_bgr = true;
357358
strip_alpha = true;
358359
color_type = PNG_COLOR_TYPE_RGB;
359360
break;
@@ -370,12 +371,15 @@ namespace
370371
PNG_INTERLACE_NONE,
371372
PNG_COMPRESSION_TYPE_DEFAULT,
372373
PNG_FILTER_TYPE_DEFAULT);
374+
373375
png_write_info(st, info);
374376

375377
if (strip_alpha)
376378
png_set_filler(st, 0, PNG_FILLER_AFTER);
377379
if (using_bgr)
378380
png_set_bgr(st);
381+
if (bit_depth == 16)
382+
png_set_swap(st);
379383

380384
if (color_type != PNG_COLOR_TYPE_GRAY)
381385
{

0 commit comments

Comments
 (0)