Skip to content

Commit

Permalink
blit_impl.hpp: Fix incorrect assumption
Browse files Browse the repository at this point in the history
Turns out we can have fills of length 1
  • Loading branch information
glebm committed Jun 15, 2024
1 parent 5ff588d commit 2c8b0cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/engine/render/blit_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace devilution {

DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitFillDirect(uint8_t *dst, unsigned length, uint8_t color)
{
DVL_ASSUME(length >= 2);
DVL_ASSUME(length != 0);
std::memset(dst, color, length);
}

Expand All @@ -41,7 +41,7 @@ struct BlitDirect {

DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitFillWithMap(uint8_t *dst, unsigned length, uint8_t color, const uint8_t *DVL_RESTRICT colorMap)
{
DVL_ASSUME(length >= 2);
DVL_ASSUME(length != 0);
std::memset(dst, colorMap[color], length);
}

Expand All @@ -53,7 +53,7 @@ DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitPixelsWithMap(uint8_t *DVL_RESTRICT

DVL_ALWAYS_INLINE DVL_ATTRIBUTE_HOT void BlitFillBlended(uint8_t *dst, unsigned length, uint8_t color)
{
DVL_ASSUME(length >= 2);
DVL_ASSUME(length != 0);
std::for_each(DEVILUTIONX_BLIT_EXECUTION_POLICY dst, dst + length, [tbl = paletteTransparencyLookup[color]](uint8_t &dstColor) {
dstColor = tbl[dstColor];
});
Expand Down

0 comments on commit 2c8b0cb

Please sign in to comment.