(int srcWidth, int srcHeight, int height, int width, int[] currentArray, int[] destinationArray)
| 1927 | } |
| 1928 | |
| 1929 | boolean scaleArray(int srcWidth, int srcHeight, int height, int width, int[] currentArray, int[] destinationArray) { |
| 1930 | // Horizontal Resize |
| 1931 | int yRatio = (srcHeight << 16) / height; |
| 1932 | int xRatio = (srcWidth << 16) / width; |
| 1933 | int xPos = xRatio / 2; |
| 1934 | int yPos = yRatio / 2; |
| 1935 | |
| 1936 | // if there is more than 16bit color there is no point in using mutable |
| 1937 | // images since they won't save any memory |
| 1938 | boolean testOpaque = Display.getInstance().numColors() <= 65536 && (!opaqueTested); |
| 1939 | boolean currentOpaque = true; |
| 1940 | for (int y = 0; y < height; y++) { |
| 1941 | int srcY = yPos >> 16; |
| 1942 | getRGB(currentArray, 0, 0, srcY, srcWidth, 1); |
| 1943 | for (int x = 0; x < width; x++) { |
| 1944 | int srcX = xPos >> 16; |
| 1945 | int destPixel = x + y * width; |
| 1946 | if ((destPixel >= 0 && destPixel < destinationArray.length) && (srcX < currentArray.length)) { |
| 1947 | destinationArray[destPixel] = currentArray[srcX]; |
| 1948 | |
| 1949 | // if all the pixels have an opaque alpha channel then the image is opaque |
| 1950 | currentOpaque = testOpaque && currentOpaque && (currentArray[srcX] & 0xff000000) == 0xff000000; |
| 1951 | } |
| 1952 | xPos += xRatio; |
| 1953 | } |
| 1954 | yPos += yRatio; |
| 1955 | xPos = xRatio / 2; |
| 1956 | } |
| 1957 | if (testOpaque) { |
| 1958 | this.opaque = currentOpaque; |
| 1959 | } |
| 1960 | return opaque; |
| 1961 | } |
| 1962 | |
| 1963 | /// Returns true if this is an animated image |
| 1964 | /// |
no test coverage detected