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

Bug 331388

Summary: [Carbon][GC] gc.drawImage(Image, int , int , int , int , int , int , int , int ) do not work.
Product: [Eclipse Project] Platform Reporter: alf <lihedl>
Component: SWTAssignee: Project Inbox <swt-triaged>
Status: RESOLVED WONTFIX QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: eclipse.felipe, kleind, lihedl, linyunz, mukund, Silenio_Quarti, skovatch
Version: 3.6.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Sample code none

Description alf CLA 2010-11-29 20:55:41 EST
Build Identifier: 

This appears to be a bug in SWT on a Mac.  If you have an image that is being drawn on a Canvas, and the image changes, then calling the scaling gc.drawImage () call does not update the Canvas.  No SWTError or Exceptions are thrown.  
Here is an example of the call:
gc.drawImage (offscreenImage, 0, 0, imageSize.width, imageSize.height, 0, 0, smallerWidth, smallerHeight);

Attached is a small sample that illustrates the problem.  The sample is a little convoluted because whenever you draw into an Image object you have to be very careful not to read and write to the image at the same time, hence the MUTEX object.  
To demonstrate the problem, resize the canvas.  If the canvas is larger than 400x400, then the image will change every second.  If it gets smaller than the 400x400 then the image stops being updated. 

An additional note:  
if you change the source width and height slightly in the drawImage call, then this problem goes away.  i.e. add "-1" to imageSize.width in the drawImage call. 

I tested this in carbon 3.4 and 3.5 and cocoa 3.6, this sample work well. But in carbon 3.6.1, it does not work.


Reproducible: Always

Steps to Reproduce:
1. Download Attached sample depending on swt-3.6.1-carbon-macosx.
2. Run MainApp.java in Java application.
3. Change shell size. If the shell is larger than 400x400, then the image will change every second.  If it gets smaller than the 400x400 then the image stops being updated.
Comment 1 alf CLA 2010-11-29 20:59:09 EST
Created attachment 184089 [details]
Sample code
Comment 2 Scott Kovatch CLA 2010-12-06 14:56:27 EST
Carbon is not being updated for 3.7. As this works in Cocoa I'm closing as WONTFIX.