////////////////////////////////////////////////////////////////////////// \brief host texture fetch read specific texel value out of range coords are mirrored \param[in] t texture raw data \param[in] w texture width \param[in] h texture height \param[in] s texture stride \param[in] x x coord of the point to fetch value at \param[in] y y coord of the point to fetch value at \ret
| 101 | /// \return fetched value |
| 102 | /////////////////////////////////////////////////////////////////////////////// |
| 103 | inline float Tex2Di(const float *src, int w, int h, int s, int x, int y) |
| 104 | { |
| 105 | if (x < 0) |
| 106 | x = abs(x + 1); |
| 107 | |
| 108 | if (y < 0) |
| 109 | y = abs(y + 1); |
| 110 | |
| 111 | if (x >= w) |
| 112 | x = w * 2 - x - 1; |
| 113 | |
| 114 | if (y >= h) |
| 115 | y = h * 2 - y - 1; |
| 116 | |
| 117 | return src[x + y * s]; |
| 118 | } |
| 119 | |
| 120 | /////////////////////////////////////////////////////////////////////////////// |
| 121 | /// \brief resize image |
no test coverage detected