summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2005-05-19 19:24:50 +0000
committerSilenio Quarti <silenio>2005-05-19 19:24:50 +0000
commit6079b58ee7045c020f911594524a48a4bc5cb888 (patch)
treec9157e08edd3cd04e89314ae7dfbd1722d88fa37 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
parentfc59b19065f60bbcb485c797c7ff1561e9bb73f6 (diff)
downloadeclipse.platform.swt-6079b58ee7045c020f911594524a48a4bc5cb888.tar.gz
eclipse.platform.swt-6079b58ee7045c020f911594524a48a4bc5cb888.tar.xz
eclipse.platform.swt-6079b58ee7045c020f911594524a48a4bc5cb888.zip
removing calls to gtk_image_get_pixel and cleanup code
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java47
1 files changed, 1 insertions, 46 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
index 00d8321fc6..3d76b795c9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java
@@ -165,54 +165,9 @@ protected void checkSubclass () {
void _setImages (Image [] images) {
int /*long*/ pixbufs = 0;
if (images != null) {
- int /*long*/ colormap = OS.gdk_colormap_get_system ();
for (int i = 0; i < images.length; i++) {
Image image = images [i];
- int [] w = new int [1], h = new int [1];
- OS.gdk_drawable_get_size (image.pixmap, w, h);
- int /*long*/ pixbuf;
- boolean hasMask = image.mask != 0;
- if (hasMask) {
- pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, true, 8, w [0], h [0]);
- if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
- int /*long*/ gdkMaskImagePtr = OS.gdk_drawable_get_image (image.mask, 0, 0, w [0], h [0]);
- if (gdkMaskImagePtr == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- int stride = OS.gdk_pixbuf_get_rowstride (pixbuf);
- int /*long*/ pixels = OS.gdk_pixbuf_get_pixels (pixbuf);
- byte [] line = new byte [stride];
- for (int y = 0; y < h [0]; y++) {
- int /*long*/ offset = pixels + (y * stride);
- OS.memmove (line, offset, stride);
- for (int x = 0; x < w [0]; x++) {
- if (OS.gdk_image_get_pixel (gdkMaskImagePtr, x, y) == 0) {
- line[x*4+3] = 0;
- }
- }
- OS.memmove (offset, line, stride);
- }
- OS.g_object_unref (gdkMaskImagePtr);
- } else {
- ImageData data = image.getImageData ();
- boolean hasAlpha = data.getTransparencyType () == SWT.TRANSPARENCY_ALPHA;
- pixbuf = OS.gdk_pixbuf_new (OS.GDK_COLORSPACE_RGB, hasAlpha, 8, w [0], h [0]);
- if (pixbuf == 0) SWT.error (SWT.ERROR_NO_HANDLES);
- OS.gdk_pixbuf_get_from_drawable (pixbuf, image.pixmap, colormap, 0, 0, 0, 0, w [0], h [0]);
- if (hasAlpha) {
- byte [] alpha = data.alphaData;
- int stride = OS.gdk_pixbuf_get_rowstride (pixbuf);
- int /*long*/ pixels = OS.gdk_pixbuf_get_pixels (pixbuf);
- byte [] line = new byte [stride];
- for (int y = 0; y < h [0]; y++) {
- int /*long*/ offset = pixels + (y * stride);
- OS.memmove (line, offset, stride);
- for (int x = 0; x < w [0]; x++) {
- line [x*4+3] = alpha [y*w [0]+x];
- }
- OS.memmove (offset, line, stride);
- }
- }
- }
+ int /*long*/ pixbuf = Display.createPixbuf (image);
pixbufs = OS.g_list_append (pixbufs, pixbuf);
}
}