diff --git a/DirectXTex/filters.h b/DirectXTex/filters.h index 2b32039..ebf9852 100644 --- a/DirectXTex/filters.h +++ b/DirectXTex/filters.h @@ -76,6 +76,8 @@ inline void _CreateLinearFilter(_In_ size_t source, _In_ size_t dest, _In_ bool ptrdiff_t isrcB = ptrdiff_t(srcB); ptrdiff_t isrcA = isrcB - 1; + float weight = 1.0f + float(isrcB) - srcB; + if (isrcA < 0) { isrcA = (wrap) ? (ptrdiff_t(source) - 1) : 0; @@ -86,8 +88,6 @@ inline void _CreateLinearFilter(_In_ size_t source, _In_ size_t dest, _In_ bool isrcB = (wrap) ? 0 : (ptrdiff_t(source) - 1); } - float weight = 1.0f + float(isrcB) - srcB; - auto& entry = lf[u]; entry.u0 = size_t(isrcA); entry.weight0 = weight;