STBIR_EDGE_ZERO
This commit is contained in:
parent
732fec68ee
commit
9a1d34843e
@ -94,6 +94,7 @@ typedef enum
|
|||||||
STBIR_EDGE_CLAMP = 1,
|
STBIR_EDGE_CLAMP = 1,
|
||||||
STBIR_EDGE_REFLECT = 2,
|
STBIR_EDGE_REFLECT = 2,
|
||||||
STBIR_EDGE_WRAP = 3,
|
STBIR_EDGE_WRAP = 3,
|
||||||
|
STBIR_EDGE_ZERO = 4,
|
||||||
} stbir_edge;
|
} stbir_edge;
|
||||||
|
|
||||||
// This function adds the ability to specify how requests to sample off the edge of the image are handled.
|
// This function adds the ability to specify how requests to sample off the edge of the image are handled.
|
||||||
@ -593,6 +594,9 @@ static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
|
|||||||
{
|
{
|
||||||
switch (edge)
|
switch (edge)
|
||||||
{
|
{
|
||||||
|
case STBIR_EDGE_ZERO:
|
||||||
|
return 0;
|
||||||
|
|
||||||
case STBIR_EDGE_CLAMP:
|
case STBIR_EDGE_CLAMP:
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return 0;
|
return 0;
|
||||||
@ -600,7 +604,7 @@ static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
|
|||||||
if (n >= max)
|
if (n >= max)
|
||||||
return max - 1;
|
return max - 1;
|
||||||
|
|
||||||
return n;
|
return n; // NOTREACHED
|
||||||
|
|
||||||
case STBIR_EDGE_REFLECT:
|
case STBIR_EDGE_REFLECT:
|
||||||
{
|
{
|
||||||
@ -621,7 +625,7 @@ static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
|
|||||||
return max2 - n - 1;
|
return max2 - n - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
case STBIR_EDGE_WRAP:
|
case STBIR_EDGE_WRAP:
|
||||||
@ -636,6 +640,7 @@ static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
|
|||||||
|
|
||||||
return (m);
|
return (m);
|
||||||
}
|
}
|
||||||
|
return n; // NOTREACHED
|
||||||
|
|
||||||
default:
|
default:
|
||||||
STBIR__UNIMPLEMENTED("Unimplemented edge type");
|
STBIR__UNIMPLEMENTED("Unimplemented edge type");
|
||||||
|
Loading…
Reference in New Issue
Block a user