|
42 | 42 | import org.eclipse.swt.widgets.Control;
|
43 | 43 | import org.eclipse.swt.widgets.Display;
|
44 | 44 |
|
| 45 | +import org.eclipse.core.runtime.Platform.OS; |
| 46 | + |
45 | 47 | import org.eclipse.jface.text.BadLocationException;
|
46 | 48 | import org.eclipse.jface.text.IDocument;
|
47 | 49 | import org.eclipse.jface.text.IRegion;
|
@@ -687,24 +689,27 @@ private void doubleBufferPaint(GC dest) {
|
687 | 689 | }
|
688 | 690 |
|
689 | 691 | if (fBuffer == null) {
|
690 |
| - fBuffer= newFullBufferImage(size); |
| 692 | + newFullBufferImage(size); |
691 | 693 | } else {
|
692 | 694 | doPaint(visibleLines, size);
|
693 | 695 | }
|
694 | 696 | dest.drawImage(fBuffer, 0, 0);
|
695 | 697 | }
|
696 | 698 |
|
697 |
| - private Image newFullBufferImage(Point size) { |
698 |
| - ImageGcDrawer imageGcDrawer= (gc, imageWidth, imageHeight) -> { |
699 |
| - ILineRange lines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer); |
700 |
| - if (lines == null) { |
701 |
| - return; |
702 |
| - } |
703 |
| - // We redraw everything; paint directly into the buffer |
704 |
| - initializeGC(gc, 0, 0, imageWidth, imageHeight); |
705 |
| - doPaint(gc, lines); |
706 |
| - }; |
707 |
| - return new Image(fCanvas.getDisplay(), imageGcDrawer, size.x, size.y); |
| 699 | + private void newFullBufferImage(Point size) { |
| 700 | + if (OS.isLinux()) { |
| 701 | + fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); |
| 702 | + ILineRange visibleLines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer); |
| 703 | + doPaint(visibleLines, size); |
| 704 | + } else { |
| 705 | + ImageGcDrawer imageGcDrawer= (gc, imageWidth, imageHeight) -> { |
| 706 | + ILineRange lines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer); |
| 707 | + // We redraw everything; paint directly into the buffer |
| 708 | + initializeGC(gc, 0, 0, imageWidth, imageHeight); |
| 709 | + doPaint(gc, lines); |
| 710 | + }; |
| 711 | + fBuffer= new Image(fCanvas.getDisplay(), imageGcDrawer, size.x, size.y); |
| 712 | + } |
708 | 713 | }
|
709 | 714 |
|
710 | 715 | private void doPaint(ILineRange visibleLines, Point size) {
|
|
0 commit comments