Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 498876 - [HiDPI][Printer] GC autoScales for Printer devices at HighDPI
Summary: [HiDPI][Printer] GC autoScales for Printer devices at HighDPI
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 normal with 1 vote (vote)
Target Milestone: 4.6.2   Edit
Assignee: Niraj Modi CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 502561
Blocks:
  Show dependency tree
 
Reported: 2016-07-29 06:10 EDT by Niraj Modi CLA
Modified: 2016-11-18 12:43 EST (History)
7 users (show)

See Also:
arunkumar.thondapu: review+


Attachments
Win7: Output of Snippet318 at 200% Zoom (4.39 KB, application/pdf)
2016-07-29 06:10 EDT, Niraj Modi CLA
no flags Details
Win7: Output of Snippet318 at 100% Zoom (4.42 KB, application/pdf)
2016-07-29 06:15 EDT, Niraj Modi CLA
no flags Details
GTK3: Printout using Master at 100% (25.11 KB, application/pdf)
2016-08-23 08:02 EDT, Sravan Kumar Lakkimsetti CLA
no flags Details
GTK3: Printout using Master at 200% (27.90 KB, application/pdf)
2016-08-23 08:02 EDT, Sravan Kumar Lakkimsetti CLA
no flags Details
GTK3: Printout using attached patch at 100% (25.12 KB, application/pdf)
2016-08-23 08:03 EDT, Sravan Kumar Lakkimsetti CLA
no flags Details
GTK3: Printout using attached patch at 200% (27.63 KB, application/pdf)
2016-08-23 08:04 EDT, Sravan Kumar Lakkimsetti CLA
no flags Details
Output_Eclipse-Print_200Zoom_Ubunutu16 Latest patch. (33.39 KB, application/pdf)
2016-09-21 09:17 EDT, Niraj Modi CLA
no flags Details
Output_Snippet318_200Zoom_Ubunutu16 Latest Gerrit. (7.82 KB, application/pdf)
2016-09-21 09:21 EDT, Niraj Modi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niraj Modi CLA 2016-07-29 06:10:47 EDT
Created attachment 263380 [details]
Win7: Output of Snippet318 at 200% Zoom

Issue reproducible with Snippet318 at 200% Zoom setting on Win7, see attachment.
Comment 1 Niraj Modi CLA 2016-07-29 06:15:40 EDT
Created attachment 263381 [details]
Win7: Output of Snippet318 at 100% Zoom

Output of Snippet318 should be same at all zoom level, as we get on 100% zoom settings(see attachment)
Comment 2 Niraj Modi CLA 2016-07-29 07:13:09 EDT
AutoScaling feature is specific to Display devices and not Printer devices.
We need to introduce some mechanism to differentiate various sub-classes of Drawable, whether it's AutoScaleable or not.

One possible approach might be to introduce a new API in Drawable interface something like below:
public boolean isAutoScale ();

Which should return 'true' for Display and 'false' for Printer.
Based on this we can take a call in GC class whether to AutoScale or not.

Note:- Going by current design this problem would be present on both Win as well as GTK.
Comment 3 Eclipse Genie CLA 2016-08-12 08:12:39 EDT
New Gerrit change created: https://git.eclipse.org/r/78945
Comment 4 Sravan Kumar Lakkimsetti CLA 2016-08-23 08:01:07 EDT
Hi Niraj,

The use case I tried is 
1. Start runtime eclipse
2. Import some source code(I used snippet318)
3. Print from the file menu

Attached are the results.
Comment 5 Sravan Kumar Lakkimsetti CLA 2016-08-23 08:02:25 EDT
Created attachment 263721 [details]
GTK3: Printout using Master at 100%
Comment 6 Sravan Kumar Lakkimsetti CLA 2016-08-23 08:02:54 EDT
Created attachment 263722 [details]
GTK3: Printout using Master at 200%
Comment 7 Sravan Kumar Lakkimsetti CLA 2016-08-23 08:03:27 EDT
Created attachment 263723 [details]
GTK3: Printout using attached patch at 100%
Comment 8 Sravan Kumar Lakkimsetti CLA 2016-08-23 08:04:02 EDT
Created attachment 263724 [details]
GTK3: Printout using attached patch at 200%
Comment 9 Niraj Modi CLA 2016-09-21 09:17:52 EDT
Created attachment 264317 [details]
Output_Eclipse-Print_200Zoom_Ubunutu16 Latest patch.

(In reply to Sravan Kumar Lakkimsetti from comment #8)
> Created attachment 263724 [details]
> GTK3: Printout using attached patch at 200%

With latest gerrit patch changes, above mentioned issue is now resolved.
Comment 10 Niraj Modi CLA 2016-09-21 09:21:24 EDT
Created attachment 264318 [details]
Output_Snippet318_200Zoom_Ubunutu16 Latest Gerrit.

(In reply to Niraj Modi from comment #0)
> Created attachment 263380 [details]
> Win7: Output of Snippet318 at 200% Zoom
> 
> Issue reproducible with Snippet318 at 200% Zoom setting on Win7, see
> attachment.

With latest gerrit patch changes, above mentioned issue is now resolved.
Comment 11 Niraj Modi CLA 2016-09-23 05:34:14 EDT
Important point here:
Font scaling is not controlled by Eclipse/SWT, instead it's taken care by the underlying OS itself. That is the reason we are seeing bigger font-size printed at 200% zoom as seen on Ubuntu16 with the fix(attachment 264317 [details] and attachment 264318 [details])
Note: This is one of the design decisions we have taken for this HighDPI feature.
Comment 12 Niraj Modi CLA 2016-09-28 04:09:15 EDT
Testing/Verification on Linux for this patch moved forwards using an updated Snippet318 please refer attachment 264245 [details].
Hence this bug not blocked any more by 501414.
Comment 13 Niraj Modi CLA 2016-09-28 04:11:45 EDT
New API method introduced as part of this fix:
Drawable#isAutoScalable()

Changes pushed to master via below git commit:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=38e50f4efbbd6ad2c505d85b454c7a73f8c98ff1

Resolving now.
Comment 14 Andrey Loskutov CLA 2016-09-29 05:15:37 EDT
Commit 38e50f4efbbd6ad2c505d85b454c7a73f8c98ff1 introduces API errors in SWT.
Comment 15 Andrey Loskutov CLA 2016-09-29 05:17:22 EDT
(In reply to Andrey Loskutov from comment #14)
> Commit 38e50f4efbbd6ad2c505d85b454c7a73f8c98ff1 introduces API errors in SWT.

See http://download.eclipse.org/eclipse/downloads/drops4/N20160928-2000/apitools/analysis/html/org.eclipse.swt/report.html
Comment 16 Niraj Modi CLA 2016-09-29 06:50:56 EDT
(In reply to Andrey Loskutov from comment #15)
> (In reply to Andrey Loskutov from comment #14)
> > Commit 38e50f4efbbd6ad2c505d85b454c7a73f8c98ff1 introduces API errors in SWT.
> 
> See
> http://download.eclipse.org/eclipse/downloads/drops4/N20160928-2000/apitools/
> analysis/html/org.eclipse.swt/report.html

Looks some special care needs to be taken when we add a 'default' method w.r.t. to API tools, have added entry for the new method in API tools filter via below git commit:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2c4a456b93a9bb526c5189190687f87ce63442c0
Comment 17 Andrey Loskutov CLA 2016-09-29 07:48:26 EDT
(In reply to Niraj Modi from comment #16)
> (In reply to Andrey Loskutov from comment #15)
> > (In reply to Andrey Loskutov from comment #14)
> > > Commit 38e50f4efbbd6ad2c505d85b454c7a73f8c98ff1 introduces API errors in SWT.
> > 
> > See
> > http://download.eclipse.org/eclipse/downloads/drops4/N20160928-2000/apitools/
> > analysis/html/org.eclipse.swt/report.html
> 
> Looks some special care needs to be taken when we add a 'default' method
> w.r.t. to API tools, have added entry for the new method in API tools filter
> via below git commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=2c4a456b93a9bb526c5189190687f87ce63442c0

Still one error remains:

Description	Resource	Path	Location	Type
Missing @since tag on isAutoScalable()	Printer.java	/org.eclipse.swt/Eclipse SWT Printing/gtk/org/eclipse/swt/printing	line 464	@since tag problem
Comment 18 Niraj Modi CLA 2016-09-29 08:17:46 EDT
(In reply to Andrey Loskutov from comment #17)
> (In reply to Niraj Modi from comment #16)
> > (In reply to Andrey Loskutov from comment #15)
> Still one error remains:
> 
> Description	Resource	Path	Location	Type
> Missing @since tag on isAutoScalable()	Printer.java	/org.eclipse.swt/Eclipse
> SWT Printing/gtk/org/eclipse/swt/printing	line 464	@since tag problem

This looks like an error in API tools or JDT-UI, why to add @since again when overriding a 'default' method in implementation classes, if it's already present in the parent interface/class.
Will check on this and get back.
Comment 19 Niraj Modi CLA 2016-09-29 09:28:56 EDT
(In reply to Niraj Modi from comment #18)
> (In reply to Andrey Loskutov from comment #17)
> > (In reply to Niraj Modi from comment #16)
> > > (In reply to Andrey Loskutov from comment #15)
> > Still one error remains:
> > 
> > Description	Resource	Path	Location	Type
> > Missing @since tag on isAutoScalable()	Printer.java	/org.eclipse.swt/Eclipse
> > SWT Printing/gtk/org/eclipse/swt/printing	line 464	@since tag problem
> 
> This looks like an error in API tools or JDT-UI, why to add @since again
> when overriding a 'default' method in implementation classes, if it's
> already present in the parent interface/class.
> Will check on this and get back.

Raised Bug 502561 against API tools to track this problem.
Comment 21 Andrey Loskutov CLA 2016-10-15 03:09:59 EDT
(In reply to Niraj Modi from comment #19)
> (In reply to Niraj Modi from comment #18)
> > (In reply to Andrey Loskutov from comment #17)
> > > (In reply to Niraj Modi from comment #16)
> > > > (In reply to Andrey Loskutov from comment #15)
> > > Still one error remains:
> > > 
> > > Description	Resource	Path	Location	Type
> > > Missing @since tag on isAutoScalable()	Printer.java	/org.eclipse.swt/Eclipse
> > > SWT Printing/gtk/org/eclipse/swt/printing	line 464	@since tag problem
> > 
> > This looks like an error in API tools or JDT-UI, why to add @since again
> > when overriding a 'default' method in implementation classes, if it's
> > already present in the parent interface/class.
> > Will check on this and get back.
> 
> Raised Bug 502561 against API tools to track this problem.

Can we please mute this error? I have now workspaces with compile errors which makes me nervous. I will provide a "mute" commit in a moment.
Comment 22 Eclipse Genie CLA 2016-10-15 03:10:33 EDT
New Gerrit change created: https://git.eclipse.org/r/83288
Comment 23 Niraj Modi CLA 2016-10-18 07:12:26 EDT
(In reply to Eclipse Genie from comment #22)
> New Gerrit change created: https://git.eclipse.org/r/83288

Let's wait till M3, as bug 502561 has proposed fix targeted for M3.
Comment 24 Markus Keller CLA 2016-10-28 18:28:37 EDT
I've removed the entry from the N&N.

I first tried to translate the text into proper English, but then I realized that
a) Drawable is not considered a proper API (see Javadoc)
b) no client should actually have a need for calling this method
Comment 25 Eclipse Genie CLA 2016-11-08 03:39:02 EST
New Gerrit change created: https://git.eclipse.org/r/84642
Comment 26 Eclipse Genie CLA 2016-11-08 03:39:02 EST
New Gerrit change created: https://git.eclipse.org/r/84642
Comment 27 Niraj Modi CLA 2016-11-14 04:15:17 EST
(In reply to Markus Keller from comment #24)
> I've removed the entry from the N&N.
> 
> I first tried to translate the text into proper English, but then I realized
> that
> a) Drawable is not considered a proper API (see Javadoc)
> b) no client should actually have a need for calling this method

Thanks Markus, based on this removing the API keyword from this bug.
Comment 28 Niraj Modi CLA 2016-11-14 05:00:18 EST
Verified the fix in Oxygen IBuild: I20161113-2000
Comment 29 Niraj Modi CLA 2016-11-14 05:08:59 EST
(In reply to Eclipse Genie from comment #26)
> New Gerrit change created: https://git.eclipse.org/r/84642

Above Gerrit fails(since we have a new method and corresponding JUnit as part of single Patch), hence pushed the changes directly via below git commit to 4.6.2:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R4_6_maintenance&id=06c84738708c839d8b8abd240d414db8a63273f7
Comment 30 Niraj Modi CLA 2016-11-16 07:08:11 EST
API tooling is calling out this method changes as warning in below report:
http://download.eclipse.org/eclipse/downloads/drops4/M20161115-1315/apitools/analysis/html/org.eclipse.swt/report.html

There is already a API filter for the Drawable#isAutoScaleable() method.
We need to add corresponding API filter at the method implementations as well.

Will add the same shortly.
Comment 31 Niraj Modi CLA 2016-11-16 08:00:38 EST
Added API filters to mute the API-tool warnings, for each implementation of Drawable#isAutoScalable() for all platforms in 4.6.2 branch via below git commit:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R4_6_maintenance&id=8e151f2a3b7855b403d71799d255b14f38a2b5d0

Please note, why above api filters are needed is due to a known bug 502561 in API tooling(which is already fixed in 4.7 branch but isn't back-ported to 4.6.2)

Resolving now.
Comment 32 Niraj Modi CLA 2016-11-17 07:05:05 EST
Verified the fix in 4.6.2 MBuild: M20161116-1100 on Win7 and Ubuntu16.04
Comment 33 Markus Keller CLA 2016-11-17 14:27:54 EST
The API Filters story needs another look. Sorry that I didn't realize this in the first round.

Drawable is a beast. The interface says it's not an API, but we can't mark it as @noreference because it's used in other APIs, e.g. constructor GC(Drawable).

But we should mark methods in Drawable as @noreference. That way, we don't need API filters. API filters are only intended to work around problems in API Tools.

I've filed bug 507701 for missing API Tools problems in overriding methods, and I've added all the necessary @noreference in master: 
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=745d8bbc14c0e8471bffa73494e030f7be099e08
Comment 34 Eclipse Genie CLA 2016-11-17 14:55:02 EST
New Gerrit change created: https://git.eclipse.org/r/85235
Comment 35 Markus Keller CLA 2016-11-17 15:03:45 EST
(In reply to Eclipse Genie from comment #34)
> New Gerrit change created: https://git.eclipse.org/r/85235

This fixes the API Tools problems and correctly marks isAutoScalable as @noreference in R4_6_maintenance.

The API Tools problem that stayed after http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=8e151f2a3b7855b403d71799d255b14f38a2b5d0 (minor version should be incremented) was actually acceptable, since those methods were indeed added, and only the missing @since tag had been suppressed.