MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / clampToEdge

Function clampToEdge

Source/Falcor/Utils/UI/PixelZoom.cpp:34–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace Falcor
33{
34static void clampToEdge(float2& pix, uint32_t width, uint32_t height, uint32_t offset)
35{
36 float2 posOffset = pix + float2(offset, offset);
37 float2 negOffset = pix - float2(offset, offset);
38
39 // x
40 if (posOffset.x > width)
41 {
42 pix.x = pix.x - (posOffset.x - width);
43 }
44 else if (negOffset.x < 0)
45 {
46 pix.x = pix.x - negOffset.x;
47 }
48
49 // y
50 if (posOffset.y > height)
51 {
52 pix.y = pix.y - (posOffset.y - height);
53 }
54 else if (negOffset.y < 0)
55 {
56 pix.y = pix.y - negOffset.y;
57 }
58}
59
60PixelZoom::PixelZoom(ref<Device> pDevice, const Fbo* pBackbuffer) : mpDevice(pDevice)
61{

Callers 1

renderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected