|
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,25 @@ private void doubleBufferPaint(GC dest) { |
687 | 689 | } |
688 | 690 |
|
689 | 691 | if (fBuffer == null) { |
690 | | - fBuffer= newFullBufferImage(size); |
| 692 | + newFullBufferImage(visibleLines, 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(ILineRange visibleLines, Point size) { |
| 700 | + if (OS.isLinux()) { |
| 701 | + fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); |
| 702 | + doPaint(visibleLines, size); |
| 703 | + } else { |
| 704 | + ImageGcDrawer imageGcDrawer= (gc, imageWidth, imageHeight) -> { |
| 705 | + // We redraw everything; paint directly into the buffer |
| 706 | + initializeGC(gc, 0, 0, imageWidth, imageHeight); |
| 707 | + doPaint(gc, visibleLines); |
| 708 | + }; |
| 709 | + fBuffer= new Image(fCanvas.getDisplay(), imageGcDrawer, size.x, size.y); |
| 710 | + } |
708 | 711 | } |
709 | 712 |
|
710 | 713 | private void doPaint(ILineRange visibleLines, Point size) { |
|
0 commit comments