|
17 | 17 | import org.eclipse.swt.accessibility.*;
|
18 | 18 | import org.eclipse.swt.events.*;
|
19 | 19 | import org.eclipse.swt.graphics.*;
|
20 |
| -import org.eclipse.swt.internal.*; |
21 |
| -import org.eclipse.swt.internal.DPIUtil.*; |
22 | 20 | import org.eclipse.swt.widgets.*;
|
23 | 21 |
|
24 | 22 | /**
|
@@ -720,24 +718,25 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
|
720 | 718 | return trim;
|
721 | 719 | }
|
722 | 720 | Image createButtonImage(Display display, int button) {
|
723 |
| - GC tempGC = new GC (this); |
724 |
| - Point size = renderer.computeSize(button, SWT.NONE, tempGC, SWT.DEFAULT, SWT.DEFAULT); |
725 |
| - tempGC.dispose(); |
726 |
| - |
727 |
| - Rectangle trim = renderer.computeTrim(button, SWT.NONE, 0, 0, 0, 0); |
728 |
| - Image image = new Image (display, size.x - trim.width, size.y - trim.height); |
729 |
| - GC gc = new GC (image); |
730 |
| - Color transColor = renderer.parent.getBackground(); |
731 |
| - gc.setBackground(transColor); |
732 |
| - gc.fillRectangle(image.getBounds()); |
733 |
| - renderer.draw(button, SWT.NONE, new Rectangle(trim.x, trim.y, size.x, size.y), gc); |
734 |
| - gc.dispose (); |
735 |
| - |
736 |
| - final ImageData imageData = image.getImageData (DPIUtil.getDeviceZoom ()); |
737 |
| - imageData.transparentPixel = imageData.palette.getPixel(transColor.getRGB()); |
738 |
| - image.dispose(); |
739 |
| - image = new Image(display, new AutoScaleImageDataProvider(display, imageData, DPIUtil.getDeviceZoom())); |
740 |
| - return image; |
| 721 | + return new Image(display, (ImageDataProvider) zoom -> { |
| 722 | + GC tempGC = new GC (CTabFolder.this); |
| 723 | + Point size = renderer.computeSize(button, SWT.NONE, tempGC, SWT.DEFAULT, SWT.DEFAULT); |
| 724 | + tempGC.dispose(); |
| 725 | + |
| 726 | + Rectangle trim = renderer.computeTrim(button, SWT.NONE, 0, 0, 0, 0); |
| 727 | + Image image = new Image (display, size.x - trim.width, size.y - trim.height); |
| 728 | + GC gc = new GC (image); |
| 729 | + Color transColor = renderer.parent.getBackground(); |
| 730 | + gc.setBackground(transColor); |
| 731 | + gc.fillRectangle(image.getBounds()); |
| 732 | + renderer.draw(button, SWT.NONE, new Rectangle(trim.x, trim.y, size.x, size.y), gc); |
| 733 | + gc.dispose (); |
| 734 | + |
| 735 | + final ImageData imageData = image.getImageData (zoom); |
| 736 | + imageData.transparentPixel = imageData.palette.getPixel(transColor.getRGB()); |
| 737 | + image.dispose(); |
| 738 | + return imageData; |
| 739 | + }); |
741 | 740 | }
|
742 | 741 |
|
743 | 742 | private void notifyItemCountChange() {
|
|
0 commit comments