diff options
author | Silenio Quarti <silenio> | 2005-05-19 19:24:50 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2005-05-19 19:24:50 +0000 |
commit | 6079b58ee7045c020f911594524a48a4bc5cb888 (patch) | |
tree | c9157e08edd3cd04e89314ae7dfbd1722d88fa37 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Decorations.java | |
parent | fc59b19065f60bbcb485c797c7ff1561e9bb73f6 (diff) | |
download | eclipse.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.java | 47 |
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); } } |