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

Bug 321359

Summary: Purple-icons drawing image with cairo in Solaris-sparc (big-endian)
Product: [Eclipse Project] Platform Reporter: Silenio Quarti <Silenio_Quarti>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe
Version: 3.6Flags: eclipse.felipe: review+
Target Milestone: 3.6.1   
Hardware: PC   
OS: Solaris-GTK   
Whiteboard:
Attachments:
Description Flags
fix none

Description Silenio Quarti CLA 2010-07-30 11:16:15 EDT
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;


public class Test {
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);

	shell.addListener(SWT.Paint, new Listener() {
		public void handleEvent(Event event) {
			GC gc = event.gc;
			Image image = new Image(gc.getDevice(), 100, 100);
			GC imageGC = new GC(image);
			imageGC.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_RED));
//			imageGC.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_GREEN));
//			imageGC.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_BLUE));
			imageGC.fillRectangle(image.getBounds());
			imageGC.dispose();
			
			ImageData data = image.getImageData();
			for (int y = 0; y < data.height; y++) {
				for (int x = 0; x < data.width; x++) {
					data.setAlpha(x, y, 0xFF);
				}
			}
			image.dispose();
			image = new Image(gc.getDevice(), data);
			
			gc.setAdvanced(true);
			System.out.println(gc.getAdvanced());
			gc.drawImage(image, 100, 100);
			
			image.dispose();
		}
	});

	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 1 Silenio Quarti CLA 2010-07-30 11:25:25 EDT
Created attachment 175586 [details]
fix
Comment 2 Silenio Quarti CLA 2010-07-30 11:27:45 EDT
Need to consider the native endianness when creating the cairo surface.

Fixed > 20100730.
Comment 3 Silenio Quarti CLA 2010-07-30 12:03:11 EDT
Felipe, please review for 3.6.1. Same patch applies.
Comment 4 Silenio Quarti CLA 2010-07-30 12:12:38 EDT
Patch has been released to R3_6_maintenance.