modules/graphics/src/main/java/com/sun/javafx/iio/common/RoughScaler.java

Print this page




 107     public boolean putSourceScanline(byte[] scanline, int off) {
 108         if (off < 0) {
 109             throw new IllegalArgumentException("off < 0!");
 110         }
 111 
 112         if (destLine < destHeight) {
 113             if (sourceLine == nextSourceLine) {
 114                 assert destBuf.hasArray() : "destBuf.hasArray() == false => destBuf is direct";
 115                 byte[] dest = destBuf.array();
 116 
 117                 int destOffset = destLine * destWidth * numBands;
 118 
 119                 int doff = destOffset;
 120                 for (int i = 0; i < destWidth; i++) {
 121                     int sourceOffset = off + this.colPositions[i] * numBands;
 122                     for (int j = 0; j < numBands; j++) {
 123                         dest[doff++] = scanline[sourceOffset + j];
 124                     }
 125                 }
 126 
 127                 while ((int) (++destLine * scaleY) == sourceLine) {


 128                     System.arraycopy(dest, destOffset, dest, doff, destWidth * numBands);
 129                     doff += destWidth * numBands;
 130                 }
 131 
 132                 nextSourceLine = (int) (destLine * scaleY);
 133             }
 134 
 135             ++sourceLine;
 136         }
 137 
 138         return destLine == destHeight;
 139     }
 140 }


 107     public boolean putSourceScanline(byte[] scanline, int off) {
 108         if (off < 0) {
 109             throw new IllegalArgumentException("off < 0!");
 110         }
 111 
 112         if (destLine < destHeight) {
 113             if (sourceLine == nextSourceLine) {
 114                 assert destBuf.hasArray() : "destBuf.hasArray() == false => destBuf is direct";
 115                 byte[] dest = destBuf.array();
 116 
 117                 int destOffset = destLine * destWidth * numBands;
 118 
 119                 int doff = destOffset;
 120                 for (int i = 0; i < destWidth; i++) {
 121                     int sourceOffset = off + this.colPositions[i] * numBands;
 122                     for (int j = 0; j < numBands; j++) {
 123                         dest[doff++] = scanline[sourceOffset + j];
 124                     }
 125                 }
 126 
 127                 while ((int) (++destLine * scaleY) == sourceLine &&
 128                         destLine < destHeight)
 129                 {
 130                     System.arraycopy(dest, destOffset, dest, doff, destWidth * numBands);
 131                     doff += destWidth * numBands;
 132                 }
 133 
 134                 nextSourceLine = (int) (destLine * scaleY);
 135             }
 136 
 137             ++sourceLine;
 138         }
 139 
 140         return destLine == destHeight;
 141     }
 142 }