diff options
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.gldebugger')
2 files changed, 7 insertions, 3 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/SwtUtils.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/SwtUtils.java index 750d36a..a7c960d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/SwtUtils.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/SwtUtils.java @@ -20,10 +20,14 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Control; public class SwtUtils { - public static int getFontWidth(Control c) { + /** Minimum Character width in pixels. */ + private static final int MIN_CHAR_WIDTH = 10; + + /** Returns the font width if it is greater than {@link #MIN_CHAR_WIDTH}. */ + public static int getApproximateFontWidth(Control c) { GC gc = new GC(c); int avgCharWidth = gc.getFontMetrics().getAverageCharWidth(); gc.dispose(); - return avgCharWidth; + return Math.max(avgCharWidth, MIN_CHAR_WIDTH); } } diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java index db69ffe..3364c5b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java +++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/editors/GLFunctionTraceViewer.java @@ -268,7 +268,7 @@ public class GLFunctionTraceViewer extends EditorPart implements ISelectionProvi mFrameSelectionSpinner = new Spinner(c, SWT.BORDER); gd = new GridData(); // width to hold atleast 6 digits - gd.widthHint = SwtUtils.getFontWidth(mFrameSelectionSpinner) * 6; + gd.widthHint = SwtUtils.getApproximateFontWidth(mFrameSelectionSpinner) * 6; mFrameSelectionSpinner.setLayoutData(gd); mFrameSelectionSpinner.setMinimum(1); |