MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / ShiftNegative1DRegion

Function ShiftNegative1DRegion

deps/LLGL/sources/Core/Image.cpp:186–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184/* ----- Pixels ----- */
185
186static bool ShiftNegative1DRegion(std::int32_t& dstOffset, std::uint32_t dstExtent, std::int32_t& srcOffset, std::uint32_t& srcExtent)
187{
188 if (dstOffset < 0)
189 {
190 auto dstOffsetInv = static_cast<std::uint32_t>(-dstOffset);
191 if (dstOffsetInv < srcExtent)
192 {
193 /* Reduce source region extent, and clamp destination offset to zero */
194 srcExtent -= dstOffsetInv;
195 srcOffset -= dstOffset;
196 dstOffset = 0;
197 }
198 else
199 {
200 /* Shift operation will set the extent to zero, so no blitting is necessary */
201 return false;
202 }
203 }
204
205 if (static_cast<std::uint32_t>(dstOffset) + srcExtent > dstExtent)
206 {
207 auto shift = static_cast<std::uint32_t>(dstOffset) + srcExtent - dstExtent;
208 if (shift < srcExtent)
209 {
210 /* Reduce source region extent */
211 srcExtent -= shift;
212 }
213 else
214 {
215 /* Shift operation will set the extent to zero, so no blitting is necessary */
216 return false;
217 }
218 }
219
220 return true;
221}
222
223static bool Overlap1DRegion(std::int32_t dstOffset, std::int32_t srcOffset, std::uint32_t extent)
224{

Callers 1

BlitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected