diff options
author | Marc-Andre Laperle | 2014-10-10 22:30:29 +0000 |
---|---|---|
committer | Marc-Andre Laperle | 2014-10-14 20:37:13 +0000 |
commit | 702e4cb08517329f0cf4b87a33a4ad5d365f0908 (patch) | |
tree | 82516db49f2599ec8e47401cda39f8dbd79e4c90 /lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse | |
parent | ce085c293222491298c5eb7bd628048a33477cc8 (diff) | |
download | org.eclipse.linuxtools-702e4cb08517329f0cf4b87a33a4ad5d365f0908.tar.gz org.eclipse.linuxtools-702e4cb08517329f0cf4b87a33a4ad5d365f0908.tar.xz org.eclipse.linuxtools-702e4cb08517329f0cf4b87a33a4ad5d365f0908.zip |
lttng: Some performance improvements to the Resources view
On Linux/GTK, calls to getSystemColor, getFontMetrics and gc.stringExtent are
quite expensive. This patch minimizes those calls. As a future improvement,
we should look into optimizing calls to TimeGraphControl.getXForTime because it
calls Control.getSize() which is slow as well.
Change-Id: I63460e305d8de458dbee4b6cb162b6cf04e77054
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/34743
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Diffstat (limited to 'lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse')
-rw-r--r-- | lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java index 9793994f83..06131b22cd 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java +++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java @@ -314,6 +314,10 @@ public class Utils { * @since 2.0 */ public static int drawText(GC gc, String text, int x, int y, int width, boolean isCentered, boolean isTransparent) { + if (width < 1) { + return 0; + } + int len = text.length(); int textWidth = 0; boolean isReallyCentered = isCentered; |