diff options
| author | Sravan Kumar Lakkimsetti | 2019-05-10 06:19:28 +0000 |
|---|---|---|
| committer | Sravan Kumar Lakkimsetti | 2019-05-13 04:58:11 +0000 |
| commit | dc1c87761283776c92e73ef411a8c7586b45e3ef (patch) | |
| tree | 868ed684debce4e4c93cefb61b35c684c09f26a6 | |
| parent | 90994ba8d30730d4d070f1dfea01a26aeff32e58 (diff) | |
| download | eclipse.platform.ui-dc1c87761283776c92e73ef411a8c7586b45e3ef.tar.gz eclipse.platform.ui-dc1c87761283776c92e73ef411a8c7586b45e3ef.tar.xz eclipse.platform.ui-dc1c87761283776c92e73ef411a8c7586b45e3ef.zip | |
Bug 544569 - CSSRenderingUtils.rotate method should not depend on pixels
in hidpi
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=544569#c8 for the description of the changes
Change-Id: I98f605a64d367a20bce5472d19259d681fe1319f
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
25 files changed, 78 insertions, 11 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/CSSRenderingUtils.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/CSSRenderingUtils.java index b2307e16669..e993c51a8f4 100644 --- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/CSSRenderingUtils.java +++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/CSSRenderingUtils.java @@ -50,8 +50,12 @@ public class CSSRenderingUtils { private static final String FRAME_IMAGE_PROP = "frame-image"; + private static final String FRAME_IMAGE_ROTATE_PROP = "frame-image-rotated"; + private static final String HANDLE_IMAGE_PROP = "handle-image"; + private static final String HANDLE_IMAGE_ROTATE_PROP = "handle-image-rotated"; + // NOTE: The CSS engine 'owns' the image it returns (it caches it) // so we have to cache any rotated versions to match private Map<Image, Image> rotatedImageMap = new HashMap<>(); @@ -61,9 +65,23 @@ public class CSSRenderingUtils { Integer[] frameInts = new Integer[4]; Image frameImage = createImage(toFrame, classId, FRAME_IMAGE_PROP, frameInts); - if (vertical && frameImage != null) - frameImage = rotateImage(toFrame.getDisplay(), frameImage, - frameInts); + if (vertical && frameImage != null) { + Image frameImageRotated = createImage(toFrame, classId, FRAME_IMAGE_ROTATE_PROP, frameInts); + if (frameImageRotated != null) { + frameImage = frameImageRotated; + if (frameInts != null) { + int tmp; + tmp = frameInts[0]; + frameInts[0] = frameInts[2]; + frameInts[2] = tmp; + tmp = frameInts[1]; + frameInts[1] = frameInts[3]; + frameInts[3] = tmp; + } + } else { + frameImage = rotateImage(toFrame.getDisplay(), frameImage, frameInts); + } + } Image handleImage = createImage(toFrame, classId, HANDLE_IMAGE_PROP, null); @@ -78,9 +96,14 @@ public class CSSRenderingUtils { } - if (vertical && handleImage != null) - handleImage = rotateImage(toFrame.getDisplay(), handleImage, null); - + if (vertical && handleImage != null) { + Image handleImageRotated = createImage(toFrame, classId, HANDLE_IMAGE_ROTATE_PROP, null); + if (handleImageRotated != null) { + handleImage = handleImageRotated; + } else { + handleImage = rotateImage(toFrame.getDisplay(), handleImage, null); + } + } if (frameImage != null) { ImageBasedFrame frame = new ImageBasedFrame(toFrame.getParent(), toFrame, vertical, draggable); @@ -268,8 +291,12 @@ public class CSSRenderingUtils { Image handleImage = createImage(toFrame, classId, HANDLE_IMAGE_PROP, null); if (vertical && handleImage != null) { - handleImage = rotateImage(toFrame.getDisplay(), - handleImage, null); + Image handleImageRotated = createImage(toFrame, classId, HANDLE_IMAGE_ROTATE_PROP, null); + if (handleImageRotated != null) { + handleImage = handleImageRotated; + } else { + handleImage = rotateImage(toFrame.getDisplay(), handleImage, null); + } } if (handleImage != null) { frame.setImages(null, null, handleImage); @@ -297,15 +324,33 @@ public class CSSRenderingUtils { Image frameImage = createImage(toFrame, classId, FRAME_IMAGE_PROP, frameInts); if (vertical && frameImage != null) { - frameImage = rotateImage(toFrame.getDisplay(), frameImage, + Image frameImageRotated = createImage(toFrame, classId, FRAME_IMAGE_ROTATE_PROP, frameInts); + if (frameImageRotated != null) { + frameImage = frameImageRotated; + if (frameInts != null) { + int tmp; + tmp = frameInts[0]; + frameInts[0] = frameInts[2]; + frameInts[2] = tmp; + tmp = frameInts[1]; + frameInts[1] = frameInts[3]; + frameInts[3] = tmp; + } + } else { + frameImage = rotateImage(toFrame.getDisplay(), frameImage, frameInts); + } } Image handleImage = createImage(toFrame, classId, HANDLE_IMAGE_PROP, null); if (vertical && handleImage != null) { - handleImage = rotateImage(toFrame.getDisplay(), - handleImage, null); + Image handleImageRotated = createImage(toFrame, classId, HANDLE_IMAGE_ROTATE_PROP, null); + if (handleImageRotated != null) { + handleImage = handleImageRotated; + } else { + handleImage = rotateImage(toFrame.getDisplay(), handleImage, null); + } } if (frameImage != null) { frame.setImages(frameImage, frameInts, handleImage); diff --git a/bundles/org.eclipse.ui.themes/css/e4-dark.css b/bundles/org.eclipse.ui.themes/css/e4-dark.css index 299fae38c38..e5cb1592da4 100644 --- a/bundles/org.eclipse.ui.themes/css/e4-dark.css +++ b/bundles/org.eclipse.ui.themes/css/e4-dark.css @@ -74,6 +74,8 @@ CTabItem.busy { .MToolControl.TrimStack { /*frame-image: url(./gtkTSFrame.png);*/ handle-image: url(./dragHandle.png); + /*frame-image-rotated: url(./gtkTSFrame-rotated.png);*/ + handle-image-rotated: url(./dragHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4-dark_mac.css b/bundles/org.eclipse.ui.themes/css/e4-dark_mac.css index 14711b7c4f3..8b2dc09e301 100644 --- a/bundles/org.eclipse.ui.themes/css/e4-dark_mac.css +++ b/bundles/org.eclipse.ui.themes/css/e4-dark_mac.css @@ -80,6 +80,8 @@ CTabItem.busy { .MToolControl.TrimStack { /*frame-image: url(./gtkTSFrame.png);*/ handle-image: url(./dragHandle.png); + /*frame-image-rotated: url(./gtkTSFrame-rotated.png);*/ + handle-image-rotated: url(./dragHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4-dark_mac1013.css b/bundles/org.eclipse.ui.themes/css/e4-dark_mac1013.css index 60254b99d79..1ebc5cfe9aa 100644 --- a/bundles/org.eclipse.ui.themes/css/e4-dark_mac1013.css +++ b/bundles/org.eclipse.ui.themes/css/e4-dark_mac1013.css @@ -82,6 +82,8 @@ CTabItem.busy { .MToolControl.TrimStack { /*frame-image: url(./gtkTSFrame.png);*/ handle-image: url(./dragHandle.png); + /*frame-image-rotated: url(./gtkTSFrame-rotated.png);*/ + handle-image-rotated: url(./dragHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4-dark_win.css b/bundles/org.eclipse.ui.themes/css/e4-dark_win.css index f9045fedc91..35932fcd52b 100644 --- a/bundles/org.eclipse.ui.themes/css/e4-dark_win.css +++ b/bundles/org.eclipse.ui.themes/css/e4-dark_win.css @@ -119,6 +119,8 @@ CTabItem.busy { .MToolControl.TrimStack { /*frame-image: url(./gtkTSFrame.png);*/ handle-image: url(./dragHandle.png); + /*frame-image-rotated: url(./gtkTSFrame-rotated.png);*/ + handle-image-rotated: url(./dragHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4_basestyle.css b/bundles/org.eclipse.ui.themes/css/e4_basestyle.css index 719a77b4bd1..a5f85c41831 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_basestyle.css +++ b/bundles/org.eclipse.ui.themes/css/e4_basestyle.css @@ -177,6 +177,8 @@ CTabItem:selected { .MToolControl.TrimStack { frame-image: url(./winXPTSFrame.png); handle-image: url(./winXPHandle.png); + frame-image-rotated: url(./winXPTSFrame-rotated.png); + handle-image-rotated: url(./winXPHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4_classic_win7.css b/bundles/org.eclipse.ui.themes/css/e4_classic_win7.css index c075970b006..5ac1e955e20 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_classic_win7.css +++ b/bundles/org.eclipse.ui.themes/css/e4_classic_win7.css @@ -63,6 +63,8 @@ CTabItem:selected { .MToolControl.TrimStack { frame-image: url(./winClassicTSFrame.png); handle-image: url(./winClassicHandle.png); + frame-image-rotated: url(./winClassicTSFrame-rotated.png); + handle-image-rotated: url(./winClassicHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4_classic_winxp.css b/bundles/org.eclipse.ui.themes/css/e4_classic_winxp.css index c075970b006..5ac1e955e20 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_classic_winxp.css +++ b/bundles/org.eclipse.ui.themes/css/e4_classic_winxp.css @@ -63,6 +63,8 @@ CTabItem:selected { .MToolControl.TrimStack { frame-image: url(./winClassicTSFrame.png); handle-image: url(./winClassicHandle.png); + frame-image-rotated: url(./winClassicTSFrame-rotated.png); + handle-image-rotated: url(./winClassicHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css b/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css index b2c14ad6740..3af33eafa18 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css +++ b/bundles/org.eclipse.ui.themes/css/e4_default_gtk.css @@ -93,6 +93,8 @@ ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_OUTLINE_COLOR { .MToolControl.TrimStack { frame-image: url(./gtkTSFrame.png); handle-image: url(./gtkHandle.png); + frame-image-rotated: url(./gtkTSFrame-rotated.png); + handle-image-rotated: url(./gtkHandle-rotated.png); } #PerspectiveSwitcher { diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_mac.css b/bundles/org.eclipse.ui.themes/css/e4_default_mac.css index fa7f9460074..180c9718c12 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_default_mac.css +++ b/bundles/org.eclipse.ui.themes/css/e4_default_mac.css @@ -58,6 +58,8 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR { .MToolControl.TrimStack { frame-image: url(./macTSFrame.png); handle-image: url(./macHandle.png); + frame-image-rotated: url(./macTSFrame-rotated.png); + handle-image-rotated: url(./macHandle-rotated.png); frame-cuts: 5px 1px 5px 16px; } diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css b/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css index 7dc7ae0babc..98e399cc526 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css +++ b/bundles/org.eclipse.ui.themes/css/e4_default_mru_on_win7.css @@ -43,6 +43,8 @@ ColorDefinition#org-eclipse-ui-workbench-ACTIVE_TAB_OUTER_KEYLINE_COLOR { .MToolControl.TrimStack { frame-image: url(./win7TSFrame.png); handle-image: url(./win7Handle.png); + frame-image-rotated: url(./win7TSFrame-rotated.png); + handle-image-rotated: url(./win7Handle-rotated.png); } .MTrimBar#org-eclipse-ui-main-toolbar { diff --git a/bundles/org.eclipse.ui.themes/css/e4_default_win.css b/bundles/org.eclipse.ui.themes/css/e4_default_win.css index 9b0382d696d..09de8962065 100644 --- a/bundles/org.eclipse.ui.themes/css/e4_default_win.css +++ b/bundles/org.eclipse.ui.themes/css/e4_default_win.css @@ -73,6 +73,8 @@ ColorDefinition#org-eclipse-ui-workbench-INACTIVE_TAB_BG_END { .MToolControl.TrimStack { frame-image: url(./win7TSFrame.png); handle-image: url(./win7Handle.png); + frame-image-rotated: url(./win7TSFrame-rotated.png); + handle-image-rotated: url(./win7Handle-rotated.png); } #PerspectiveSwitcher { diff --git a/bundles/org.eclipse.ui.themes/images/dragHandle-rotated.png b/bundles/org.eclipse.ui.themes/images/dragHandle-rotated.png Binary files differnew file mode 100644 index 00000000000..5f70dbd7f2b --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/dragHandle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/gtkHandle-rotated.png b/bundles/org.eclipse.ui.themes/images/gtkHandle-rotated.png Binary files differnew file mode 100644 index 00000000000..366c05bb496 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/gtkHandle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/gtkTSFrame-rotated.png b/bundles/org.eclipse.ui.themes/images/gtkTSFrame-rotated.png Binary files differnew file mode 100644 index 00000000000..a3bd1da43d9 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/gtkTSFrame-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/macHandle-rotated.png b/bundles/org.eclipse.ui.themes/images/macHandle-rotated.png Binary files differnew file mode 100644 index 00000000000..4494ce5ad72 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/macHandle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/macTSFrame-rotated.png b/bundles/org.eclipse.ui.themes/images/macTSFrame-rotated.png Binary files differnew file mode 100644 index 00000000000..3be3ae12c72 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/macTSFrame-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/win7Handle-rotated.png b/bundles/org.eclipse.ui.themes/images/win7Handle-rotated.png Binary files differnew file mode 100644 index 00000000000..39871a567e0 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/win7Handle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/win7TSFrame-rotated.png b/bundles/org.eclipse.ui.themes/images/win7TSFrame-rotated.png Binary files differnew file mode 100644 index 00000000000..491035c6baf --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/win7TSFrame-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/winClassicHandle-rotated.png b/bundles/org.eclipse.ui.themes/images/winClassicHandle-rotated.png Binary files differnew file mode 100644 index 00000000000..1e92a09239b --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/winClassicHandle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/winClassicTSFrame-rotated.png b/bundles/org.eclipse.ui.themes/images/winClassicTSFrame-rotated.png Binary files differnew file mode 100644 index 00000000000..1bf7cd60008 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/winClassicTSFrame-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/winXPBluHandle-rotated.png b/bundles/org.eclipse.ui.themes/images/winXPBluHandle-rotated.png Binary files differnew file mode 100644 index 00000000000..42a64ce8c2e --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/winXPBluHandle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/winXPBluTSFrame-rotated.png b/bundles/org.eclipse.ui.themes/images/winXPBluTSFrame-rotated.png Binary files differnew file mode 100644 index 00000000000..c679cbb961c --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/winXPBluTSFrame-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/winXPHandle-rotated.png b/bundles/org.eclipse.ui.themes/images/winXPHandle-rotated.png Binary files differnew file mode 100644 index 00000000000..9d437c9a412 --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/winXPHandle-rotated.png diff --git a/bundles/org.eclipse.ui.themes/images/winXPTSFrame-rotated.png b/bundles/org.eclipse.ui.themes/images/winXPTSFrame-rotated.png Binary files differnew file mode 100644 index 00000000000..00d64ec386c --- /dev/null +++ b/bundles/org.eclipse.ui.themes/images/winXPTSFrame-rotated.png |
