Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 234969 Details for
Bug 399786
[Cocoa][GTK][Win32][Retina] GC#draw*(..) needs to support high-DPI images (was: Line numbers in editors are blurry)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proof of concept patch for clear line numbers on OSX with Retina displays.
0001-Clear-LineNumbers-for-Retina-Displays-on-OSX.patch (text/plain), 4.45 KB, created by
Thomas Darimont
on 2013-08-29 11:07:40 EDT
(
hide
)
Description:
Proof of concept patch for clear line numbers on OSX with Retina displays.
Filename:
MIME Type:
Creator:
Thomas Darimont
Created:
2013-08-29 11:07:40 EDT
Size:
4.45 KB
patch
obsolete
>From 34e12419a4b6c9dbe2aa58901ae81462b36802b7 Mon Sep 17 00:00:00 2001 >From: Thomas Darimont <tdarimont@gopivotal.com> >Date: Thu, 29 Aug 2013 16:59:12 +0200 >Subject: [PATCH] Clear LineNumbers for Retina Displays on OSX > >--- > .../jface/text/source/LineNumberRulerColumn.java | 49 ++++++++++++++++------ > 1 file changed, 37 insertions(+), 12 deletions(-) > >diff --git a/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java b/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java >index 9133f22..54a9b54 100644 >--- a/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java >+++ b/src/org/eclipse/jface/text/source/LineNumberRulerColumn.java >@@ -387,6 +387,8 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > private InternalListener fInternalListener= new InternalListener(); > /** The font of this column */ > private Font fFont; >+ private int fFontScaleFactor = 2; >+ private Font fBiggerFont; > /** The indentation cache */ > private int[] fIndentation; > /** Indicates whether this column reacts on text change events */ >@@ -642,7 +644,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > > if (fFont != null) > fCanvas.setFont(fFont); >- >+ > updateNumberOfDigits(); > computeIndentations(); > return fCanvas; >@@ -670,30 +672,34 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > * @param dest the GC to draw into > */ > private void doubleBufferPaint(GC dest) { >- >+ > Point size= fCanvas.getSize(); > > if (size.x <= 0 || size.y <= 0) > return; >- >+ > if (fBuffer != null) { > Rectangle r= fBuffer.getBounds(); >- if (r.width != size.x || r.height != size.y) { >+ if (r.width != size.x * fFontScaleFactor || r.height != size.y * fFontScaleFactor) { > fBuffer.dispose(); > fBuffer= null; > } > } > if (fBuffer == null) >- fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); >- >+ fBuffer= new Image(fCanvas.getDisplay(), size.x * fFontScaleFactor, size.y * fFontScaleFactor); >+ > GC gc= new GC(fBuffer); >- gc.setFont(fCanvas.getFont()); >+ if(fBiggerFont == null) >+ fBiggerFont = newBiggerFont(fCanvas.getFont()); >+ >+ gc.setFont(fBiggerFont); >+ > if (fForeground != null) > gc.setForeground(fForeground); > > try { > gc.setBackground(getBackground(fCanvas.getDisplay())); >- gc.fillRectangle(0, 0, size.x, size.y); >+ gc.fillRectangle(0, 0, size.x * fFontScaleFactor, size.y * fFontScaleFactor); > > ILineRange visibleLines= JFaceTextUtil.getVisibleModelLines(fCachedTextViewer); > if (visibleLines == null) >@@ -704,7 +710,8 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > gc.dispose(); > } > >- dest.drawImage(fBuffer, 0, 0); >+ double f = 1.0/fFontScaleFactor; >+ dest.drawImage(fBuffer, 0,0,(int)(size.x / f),(int)(size.y / f),0,0,size.x,size.y); > } > > /** >@@ -749,7 +756,7 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > if (widgetLine == -1) > continue; > >- int lineHeight= fCachedTextWidget.getLineHeight(fCachedTextWidget.getOffsetAtLine(widgetLine)); >+ int lineHeight= fFontScaleFactor * fCachedTextWidget.getLineHeight(fCachedTextWidget.getOffsetAtLine(widgetLine)); > paintLine(line, y, lineHeight, gc, display); > y += lineHeight; > } >@@ -871,7 +878,8 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > * @see IVerticalRulerColumn#setFont(Font) > */ > public void setFont(Font font) { >- fFont= font; >+ fBiggerFont = newBiggerFont(font); >+ fFont = font; > if (fCanvas != null && !fCanvas.isDisposed()) { > fCanvas.setFont(fFont); > updateNumberOfDigits(); >@@ -879,6 +887,23 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > } > } > >+ /* >+ * Create a copy of the given font with the fontSize scaled >+ * by "fFontScaleFactor". This is necessary due to the higher >+ * resolution required for retina displays. >+ */ >+ private Font newBiggerFont(Font font) { >+ if(fBiggerFont != null){ >+ fBiggerFont.dispose(); >+ } >+ FontData[] fd = new FontData[font.getFontData().length]; >+ for(int i = 0; i < fd.length;i++){ >+ FontData current = font.getFontData()[i]; >+ fd[i] = new FontData(current.getName(),current.getHeight() * fFontScaleFactor, current.getStyle()); >+ } >+ return new Font(font.getDevice(), fd); >+ } >+ > /** > * Returns the parent (composite) ruler of this ruler column. > * >@@ -913,4 +938,4 @@ public class LineNumberRulerColumn implements IVerticalRulerColumn { > return -1; > } > >-} >\ No newline at end of file >+} >-- >1.7.12.4 (Apple Git-37) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 399786
:
234965
|
234967
| 234969 |
252595
|
252596
|
252604
|
252616
|
252811
|
257350
|
257697
|
257698
|
257785