MCPcopy Create free account
hub / github.com/demoth/jake2 / GL_MipMap

Method GL_MipMap

client/src/main/java/jake2/client/render/fast/Image.java:970–998  ·  view source on GitHub ↗
(int[] in, int width, int height)

Source from the content-addressed store, hash-verified

968 ================
969 */
970 void GL_MipMap(int[] in, int width, int height) {
971 int i, j;
972 int[] out;
973
974 out = in;
975
976 int inIndex = 0;
977 int outIndex = 0;
978
979 int r, g, b, a;
980 int p1, p2, p3, p4;
981
982 for (i = 0; i < height; i += 2, inIndex += width) {
983 for (j = 0; j < width; j += 2, outIndex += 1, inIndex += 2) {
984
985 p1 = in[inIndex + 0];
986 p2 = in[inIndex + 1];
987 p3 = in[inIndex + width + 0];
988 p4 = in[inIndex + width + 1];
989
990 r = (((p1 >> 0) & 0xFF) + ((p2 >> 0) & 0xFF) + ((p3 >> 0) & 0xFF) + ((p4 >> 0) & 0xFF)) >> 2;
991 g = (((p1 >> 8) & 0xFF) + ((p2 >> 8) & 0xFF) + ((p3 >> 8) & 0xFF) + ((p4 >> 8) & 0xFF)) >> 2;
992 b = (((p1 >> 16) & 0xFF) + ((p2 >> 16) & 0xFF) + ((p3 >> 16) & 0xFF) + ((p4 >> 16) & 0xFF)) >> 2;
993 a = (((p1 >> 24) & 0xFF) + ((p2 >> 24) & 0xFF) + ((p3 >> 24) & 0xFF) + ((p4 >> 24) & 0xFF)) >> 2;
994
995 out[outIndex] = (r << 0) | (g << 8) | (b << 16) | (a << 24);
996 }
997 }
998 }
999
1000 /*
1001 ===============

Callers 1

GL_Upload32Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected