int[] computePolyline(int left, int top, int right, int bottom) { int height = bottom - top; // can be any number int width = 2 * height; // must be even int peaks = Compatibility.ceil(right - left, width); if (peaks == 0 && right - left > 2) { peaks = 1; } int length = ((2 * peaks) + 1) * 2; if (length < 0) return new int[0]; int[] coordinates = new int[length]; for (int i = 0; i < peaks; i++) { int index = 4 * i; coordinates[index] = left + (width * i); coordinates[index+1] = bottom; coordinates[index+2] = coordinates[index] + width / 2; coordinates[index+3] = top; } coordinates[length-2] = left + (width * peaks); coordinates[length-1] = bottom; return coordinates; }
/** * Returns the NLS'ed message for the given argument. * * @param key the key to look up * @return the message for the given key * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the key is null</li> * </ul> */ public static String getMessage(String key) { return Compatibility.getMessage(key); }
/** * Adds a line to the end of the line indexes array. Increases the size of the array if necessary. * <code>lineCount</code> is updated to reflect the new entry. * <p> * * @param start the start of the line * @param length the length of the line */ void addLineIndex(int start, int length) { int size = lines.length; if (lineCount == size) { // expand the lines by powers of 2 int[][] newLines = new int[size+Compatibility.pow2(expandExp)][2]; System.arraycopy(lines, 0, newLines, 0, size); lines = newLines; expandExp++; } int[] range = new int[] {start, length}; lines[lineCount] = range; lineCount++; } /**
if (Compatibility.fileExists (mozillaPath, "components/libwidget_gtk.so")) { //$NON-NLS-1$ browser.dispose (); SWT.error (SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$
Point getScreenDPI () { int widthMM = OS.gdk_screen_width_mm (); int width = OS.gdk_screen_width (); int dpi = Compatibility.round (254 * width, widthMM * 10); return new Point (dpi, dpi); }
InputStream stream = null; try { stream = Compatibility.newFileInputStream(filename); return load(stream); } catch (IOException e) {
OutputStream stream = null; try { stream = Compatibility.newFileOutputStream(filename); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e);
Compatibility.interrupt();
switch (loader.compression) { case 0: os = Compatibility.newDeflaterOutputStream(baos, NO_COMPRESSION); break; case 1: os = Compatibility.newDeflaterOutputStream(baos, BEST_SPEED); break; case 3: os = Compatibility.newDeflaterOutputStream(baos, BEST_COMPRESSION); break; default: os = Compatibility.newDeflaterOutputStream(baos, DEFAULT_COMPRESSION); break;
if (Compatibility.fileExists (mozillaPath, "components/libwidget_gtk.so")) { //$NON-NLS-1$ browser.dispose (); SWT.error (SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$
Point getScreenDPI () { int widthMM = OS.gdk_screen_width_mm (); int width = OS.gdk_screen_width (); int dpi = Compatibility.round (254 * width, widthMM * 10); return new Point (dpi, dpi); }
stream = Compatibility.newFileInputStream(filename); return load(stream); } catch (IOException e) {
stream = Compatibility.newFileOutputStream(filename); } catch (IOException e) { SWT.error(SWT.ERROR_IO, e);
Compatibility.interrupt();
switch (loader.compression) { case 0: os = Compatibility.newDeflaterOutputStream(baos, NO_COMPRESSION); break; case 1: os = Compatibility.newDeflaterOutputStream(baos, BEST_SPEED); break; case 3: os = Compatibility.newDeflaterOutputStream(baos, BEST_COMPRESSION); break; default: os = Compatibility.newDeflaterOutputStream(baos, DEFAULT_COMPRESSION); break;
/** * Returns the NLS'ed message for the given argument. * * @param key the key to look up * @return the message for the given key * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the key is null</li> * </ul> */ public static String getMessage(String key) { return Compatibility.getMessage(key); }
int[] computePolyline(int left, int top, int right, int bottom) { int height = bottom - top; // can be any number int width = 2 * height; // must be even int peaks = Compatibility.ceil(right - left, width); if (peaks == 0 && right - left > 2) { peaks = 1; } int length = ((2 * peaks) + 1) * 2; if (length < 0) return new int[0]; int[] coordinates = new int[length]; for (int i = 0; i < peaks; i++) { int index = 4 * i; coordinates[index] = left + (width * i); coordinates[index+1] = bottom; coordinates[index+2] = coordinates[index] + width / 2; coordinates[index+3] = top; } coordinates[length-2] = left + (width * peaks); coordinates[length-1] = bottom; return coordinates; }
if (Compatibility.fileExists (mozillaPath, "components/libwidget_gtk.so")) { //$NON-NLS-1$ browser.dispose (); SWT.error (SWT.ERROR_NO_HANDLES, null, " [Mozilla GTK2 required (GTK1.2 detected)]"); //$NON-NLS-1$