summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
diff options
context:
space:
mode:
authorAlexander Kurtakov <akurtako@redhat.com>2012-11-14 11:44:06 +0200
committerAlexander Kurtakov <akurtako@redhat.com>2012-11-14 11:44:06 +0200
commit7d46d43cd21b835d179c72bde7bab59e61f13803 (patch)
treebde3cb0bec6bf2bc3d791cce062b69b8f96b1249 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
parentf0c3863919f76488edb06642c9a462968a147799 (diff)
downloadeclipse.platform.swt-7d46d43cd21b835d179c72bde7bab59e61f13803.tar.gz
eclipse.platform.swt-7d46d43cd21b835d179c72bde7bab59e61f13803.tar.xz
eclipse.platform.swt-7d46d43cd21b835d179c72bde7bab59e61f13803.zip
Bug 393856 - Consider using pango_layout_get_pixel_size
Binding for the function added and used where possible. This allows to not convert them after fetching via OS.PANGO_PIXELS calls.
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 355da7ed54..67662fd23e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -409,13 +409,13 @@ Point getSize (int maxWidth) {
int [] w = new int [1], h = new int [1];
if (layoutText != 0) {
OS.pango_layout_set_width (layoutText, -1);
- OS.pango_layout_get_size (layoutText, w, h);
- textWidth = OS.PANGO_PIXELS (w [0]);
+ OS.pango_layout_get_pixel_size (layoutText, w, h);
+ textWidth = w [0];
}
if (layoutMessage != 0) {
OS.pango_layout_set_width (layoutMessage, -1);
- OS.pango_layout_get_size (layoutMessage, w, h);
- messageWidth = OS.PANGO_PIXELS (w [0]);
+ OS.pango_layout_get_pixel_size (layoutMessage, w, h);
+ messageWidth = w [0];
}
int messageTrim = 2 * INSET + 2 * BORDER + 2 * PADDING;
boolean hasImage = layoutText != 0 && (style & (SWT.ICON_ERROR | SWT.ICON_INFORMATION | SWT.ICON_WARNING)) != 0;
@@ -424,13 +424,13 @@ Point getSize (int maxWidth) {
int textHeight = 0, messageHeight = 0;
if (layoutText != 0) {
OS.pango_layout_set_width (layoutText, (maxWidth - textTrim) * OS.PANGO_SCALE);
- OS.pango_layout_get_size (layoutText, w, h);
- textHeight = OS.PANGO_PIXELS (h [0]);
+ OS.pango_layout_get_pixel_size (layoutText, w, h);
+ textHeight = h [0];
}
if (layoutMessage != 0) {
OS.pango_layout_set_width (layoutMessage, (maxWidth - messageTrim) * OS.PANGO_SCALE);
- OS.pango_layout_get_size (layoutMessage, w, h);
- messageHeight = OS.PANGO_PIXELS (h [0]);
+ OS.pango_layout_get_pixel_size (layoutMessage, w, h);
+ messageHeight = h [0];
}
int height = 2 * BORDER + 2 * PADDING + messageHeight;
if (layoutText != 0) height += Math.max (IMAGE_SIZE, textHeight) + 2 * PADDING;
@@ -533,8 +533,8 @@ void drawTooltip (long /*int*/ cr) {
OS.gdk_cairo_set_source_color(cairo,foreground.handle);
Cairo.cairo_move_to(cairo, x,y );
OS.pango_cairo_show_layout(cairo, layoutText);
- OS.pango_layout_get_size (layoutText, w, h);
- y += 2 * PADDING + Math.max (IMAGE_SIZE, OS.PANGO_PIXELS (h [0]));
+ OS.pango_layout_get_pixel_size (layoutText, w, h);
+ y += 2 * PADDING + Math.max (IMAGE_SIZE, h [0]);
}
if (layoutMessage != 0) {
x = BORDER + PADDING + INSET;
@@ -576,8 +576,8 @@ void drawTooltip (long /*int*/ cr) {
OS.gdk_gc_set_foreground (gdkGC, foreground.handle);
OS.gdk_draw_layout (window, gdkGC, x, y, layoutText);
int [] w = new int [1], h = new int [1];
- OS.pango_layout_get_size (layoutText, w, h);
- y += 2 * PADDING + Math.max (IMAGE_SIZE, OS.PANGO_PIXELS (h [0]));
+ OS.pango_layout_get_pixel_size (layoutText, w, h);
+ y += 2 * PADDING + Math.max (IMAGE_SIZE, h [0]);
}
if (layoutMessage != 0) {
x = BORDER + PADDING + INSET;