Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 492296

Summary: [HiDPI][Cocoa] GC.copyArea() copies only low resolution image even if high resolution display is used
Product: [Eclipse Project] Platform Reporter: Tim Mueller <legendaerer>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: VERIFIED FIXED QA Contact: Arun Thondapu <arunkumar.thondapu>
Severity: normal    
Priority: P3 CC: arunkumar.thondapu, cyzhdl, ericwill, lshanmug, niraj.modi, peter, sravankumarl
Version: 4.5.2Flags: arunkumar.thondapu: review+
Target Milestone: 4.6.1   
Hardware: Macintosh   
OS: Mac OS X   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=497947
Whiteboard:
Bug Depends on:    
Bug Blocks: 495269    
Attachments:
Description Flags
Win7: Output of Snippet215_Snippet95 at 150%_Zoom
none
patch none

Description Tim Mueller CLA 2016-04-23 06:38:00 EDT
GC.copyArea() creates only a low resolution image of the screen, even if high resolution retina display is used on the Mac. The resulting image has only the amount of pixels that a normal resolution display provides.

This means 4 screen pixels are compressed to one pixel in the image delivered by GC.copyArea() in case it is a Mac with retina display. While this behavior keeps compatibility of the result of this call between Macs with retina display snd Macs with normal displays there are cases where the high resolution image is desired.

Although the GC.copyArea() was fixed in bug 387755 to copy the right area if a retina display is used on the Mac, it should be changed to deliver a full resolution image on Macs with retina display.

I cannot tell how this call behaves on Windows HiDPI displays, but this case should also be considered.

As part of the general work on better support of HiDPI displays, this API should also be reworked.
Comment 1 Lakshmi P Shanmugam CLA 2016-05-02 08:17:16 EDT
Tried this with Eclipse 4.6M6. 
Snippet 215 creates a low resolution image. But, Snippet 95 creates a high res image. Will investigate this for 4.6.1.
Comment 2 Lakshmi P Shanmugam CLA 2016-05-03 05:17:01 EDT
(In reply to Tim Mueller from comment #0)
> I cannot tell how this call behaves on Windows HiDPI displays, but this case
> should also be considered.
> 
Niraj/Sravan can you try this on Windows/GTK with HiDPI displays?
Comment 3 Niraj Modi CLA 2016-05-03 08:09:04 EDT
Created attachment 261426 [details]
Win7: Output of Snippet215_Snippet95 at 150%_Zoom

(In reply to Lakshmi Shanmugam from comment #2)
> (In reply to Tim Mueller from comment #0)
> > I cannot tell how this call behaves on Windows HiDPI displays, but this case
> > should also be considered.
> > 
> Niraj/Sravan can you try this on Windows/GTK with HiDPI displays?

Windows GC.copyArea() is already adapted for HighDPI use during M6 timeframe.

On Windows output of both Snippet95 & Snippet215 looks fine at 150% zoom, refer attachment.
Comment 4 Lakshmi P Shanmugam CLA 2016-06-14 08:10:20 EDT
Created attachment 262433 [details]
patch

The patch adds a high resolution representation for the image when on retina/high res display. Removed version checks and code for older OSX versions. 
The patch has to be tested on a non-retina Mac.
Also, the code to adding high resolution representation in copyArea() can be removed if this code is directly added in the Image constructor (as part of Bug 489451).
Comment 6 Arun Thondapu CLA 2016-08-23 15:27:37 EDT
(In reply to Lakshmi Shanmugam from comment #5)
> Pushed changes to master >
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=9f1686cd5fbf015a2c6d70406a01b2a5e3d52149

Backported to 4.6.1 via http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R4_6_maintenance&id=c78bd6efd551a0180463bab688cf818be6614cdd
Comment 7 Arun Thondapu CLA 2016-08-25 14:19:56 EDT
Verified in 4.6.1.M20160824-0059.
Comment 8 Lakshmi P Shanmugam CLA 2017-06-14 05:40:00 EDT
*** Bug 392307 has been marked as a duplicate of this bug. ***