diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java index 650828a46d..18eab61ff6 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/JPEGQuantizationTable.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * + * http://www.eclipse.org/legal/epl-v10.html + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -61,8 +61,8 @@ public int[] getQuantizationTablesKeys() { int totalLength = getSegmentLength() - 2; int ofs = 4; while (totalLength > 64) { - int tq = (reference[ofs] & 0xFF) % 16; - int pq = (reference[ofs] & 0xFF) / 16; + int tq = reference[ofs] & 0xF; + int pq = (reference[ofs] & 0xFF) >> 4; if (pq == 0) { ofs += 65; totalLength -= 65; @@ -90,10 +90,10 @@ public int[][] getQuantizationTablesValues() { int ofs = 4; while (totalLength > 64) { int[] qk = new int[64]; - int pq = (reference[ofs] & 0xFF) / 16; + int pq = (reference[ofs] & 0xFF) >> 4; if (pq == 0) { for (int i = 0; i < qk.length; i++) { - qk[i] = reference[ofs + i + 1]; + qk[i] = reference[ofs + i + 1] & 0xFF; } ofs += 65; totalLength -= 65; @@ -134,8 +134,8 @@ public void scaleBy(int qualityFactor) { int totalLength = getSegmentLength() - 2; int ofs = 4; while (totalLength > 64) { -// int tq = (reference[ofs] & 0xFF) % 16; - int pq = (reference[ofs] & 0xFF) / 16; +// int tq = reference[ofs] & 0xFF; + int pq = (reference[ofs] & 0xFF) >> 4; if (pq == 0) { for (int i = ofs + 1; i <= ofs + 64; i++) { int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100; @@ -150,8 +150,8 @@ public void scaleBy(int qualityFactor) { int temp = (((reference[i] & 0xFF) * 256 + (reference[i + 1] & 0xFF)) * qFactor + 50) / 100; if (temp <= 0) temp = 1; if (temp > 32767) temp = 32767; - reference[i] = (byte)(temp / 256); - reference[i + 1] = (byte)(temp % 256); + reference[i] = (byte)(temp >> 8); + reference[i + 1] = (byte)(temp & 0xFF); } ofs += 129; totalLength -= 129; |