Move utility functions into glUtils

Move utility functions into glUtils so they can be shared
between GLESv1 and GLESv2 codecs.

Change-Id: I673b316395604e4288412e7ace328076812d4cc1
This commit is contained in:
Jacky Romano
2011-04-10 22:29:18 +03:00
parent 27c128d701
commit 3c2aa9b931
3 changed files with 37 additions and 35 deletions

View File

@@ -54,4 +54,35 @@ extern "C" {
};
#endif
namespace GLUtils {
template <class T> void minmax(T *indices, int count, int *min, int *max) {
*min = -1;
*max = -1;
T *ptr = indices;
for (int i = 0; i < count; i++) {
if (*min == -1 || *ptr < *min) *min = *ptr;
if (*max == -1 || *ptr > *max) *max = *ptr;
ptr++;
}
}
template <class T> void shiftIndices(T *indices, int count, int offset) {
T *ptr = indices;
for (int i = 0; i < count; i++) {
*ptr += offset;
ptr++;
}
}
template <class T> void shiftIndices(T *src, T *dst, int count, int offset)
{
for (int i = 0; i < count; i++) {
*dst = *src + offset;
dst++;
src++;
}
}
}; // namespace GLUtils
#endif