Skip to content

Commit

Permalink
Make get_row_pitch able to handle very tall textures. Fixes #4. (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarioSamo authored Jul 18, 2024
1 parent 4629460 commit 06f1d3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ddspp.h
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ namespace ddspp
// Shift width by mipmap index, round to next block size and round to next byte (for the rare less than 1 byte per pixel formats)
// E.g. width = 119, mip = 3, BC1 compression
// ((((119 >> 2) + 4 - 1) / 4) * 64) / 8 = 64 bytes
return ((((width >> mip) + blockWidth - 1) / blockWidth) * bitsPerPixelOrBlock + 7) / 8;
return ((((((width >> mip) > 1) ? (width >> mip) : 1) + blockWidth - 1) / blockWidth) * bitsPerPixelOrBlock + 7) / 8;
}

// Returns number of bytes for each row of a given mip. Valid range is [0, desc.numMips)
Expand Down

0 comments on commit 06f1d3f

Please sign in to comment.