Project: SWT
Bug 82905 drawImage doesn't honor clip rect
Reported: 2005-01-15 07:29:37 | Status: verified fixed

I tried both I20050104-1600 and 3.1M4 on different linux versions with gtk 2.2 and gtk 2.4. It seems that GC#drawImage(Image,int,int,int,int,int,int.int,int) will not honor the GC's clipping but draw over the whole client area if and only if SWT.NO_BACKGROUND is set and the image has an alpha channel. This should not happen! Steps to reproduce: I've attached a demo application which displays two custom tab stripe created by a custom canvas subclass. The first stripe uses NO_BACKGROUND. I think, that's valid (and works on Windows) because the canvas draws its own background (the real application does more than just filling it with a simple color) and otherwise, it would flicker (unfortunately, blitting alpha-images is quite slow with SWT). You will notice that in the first stripe, the tab text will vanish if you move the mouse over the tabs. This seems happen because everything is redrawn is parts of the stripe are updated and the images are drawn always and the texts only inside the clipping region. So the images overwrite the text outside of the clipping region.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java