Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Yan2019-03-27 16:59:53 +0000
committerAlexander Kurtakov2019-03-29 09:23:47 +0000
commit719370e9e5d83ce319f5ebade0ff5ecb80cf8497 (patch)
tree1d8fb5e1e1368d7e7c86490a7f31e119e988c7fd /bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
parentd364c7461368ec6221b5d5c5f1905901a5cd742e (diff)
downloadeclipse.platform.swt-719370e9e5d83ce319f5ebade0ff5ecb80cf8497.tar.gz
eclipse.platform.swt-719370e9e5d83ce319f5ebade0ff5ecb80cf8497.tar.xz
eclipse.platform.swt-719370e9e5d83ce319f5ebade0ff5ecb80cf8497.zip
Bug 545032 - [GTK] Implement native ImageLoader
Implement ImageLoader on GTK with native GdkPixbuf API rather than using Java implementation. Loading images: 1) Load InputStream (or FileInputStream) into byte array 2) Write byte array to GdkPixbufLoader 3) Get GdkPixbufAnimation from loader 4) Use pixbufToImageData method to convert GdkPixbuf(s) from GdkPixbufAnimation into ImageData objects to store. Known issue: * GdkPixbuf abstracts away differences between interlaced v.s. regular images, which means ImageLoaderEvent cannot be triggered for partially loaded images. This breaks test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener:d. The workaround is to explicitly check the 29th byte of a PNG file, if it is zero then it is not interlaced so no ImageLoaderEvent is triggered. Saving images 1) implemented conversion from ImageData to GdkPixbuf 2) use gdk_pixbuf_save_to_bufferv to write to pixbuf to byte array which is used to write to OutputStream * Currently supports all image formats specified in SWT API, could be extended to more formats that GdkPixbuf API supports. Performance: - Loading 2MB image takes ~100ms with native implementation where as before takes ~300ms with java implementation Change-Id: If8fdc3e06f36d8747a7ccdfa1940751a9d196757 Signed-off-by: Xi Yan <xixiyan@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 675554b9b1..2a7bb8538a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -122,17 +122,31 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1monitor_1get_1workarea",
"_1gdk_1pango_1context_1get",
"_1gdk_1pango_1layout_1get_1clip_1region",
+ "_1gdk_1pixbuf_1animation_1get_1iter",
+ "_1gdk_1pixbuf_1animation_1get_1static_1image",
+ "_1gdk_1pixbuf_1animation_1is_1static_1image",
+ "_1gdk_1pixbuf_1animation_1iter_1advance",
+ "_1gdk_1pixbuf_1animation_1iter_1get_1delay_1time",
+ "_1gdk_1pixbuf_1animation_1iter_1get_1pixbuf",
+ "_1gdk_1pixbuf_1copy",
"_1gdk_1pixbuf_1copy_1area",
+ "_1gdk_1pixbuf_1format_1get_1name",
+ "_1gdk_1pixbuf_1get_1bits_1per_1sample",
+ "_1gdk_1pixbuf_1get_1byte_1length",
"_1gdk_1pixbuf_1get_1has_1alpha",
"_1gdk_1pixbuf_1get_1height",
+ "_1gdk_1pixbuf_1get_1n_1channels",
"_1gdk_1pixbuf_1get_1pixels",
"_1gdk_1pixbuf_1get_1rowstride",
"_1gdk_1pixbuf_1get_1width",
"_1gdk_1pixbuf_1loader_1close",
+ "_1gdk_1pixbuf_1loader_1get_1animation",
+ "_1gdk_1pixbuf_1loader_1get_1format",
"_1gdk_1pixbuf_1loader_1get_1pixbuf",
"_1gdk_1pixbuf_1loader_1new",
"_1gdk_1pixbuf_1loader_1write",
"_1gdk_1pixbuf_1new",
+ "_1gdk_1pixbuf_1new_1from_1data",
"_1gdk_1pixbuf_1new_1from_1file",
"_1gdk_1pixbuf_1save_1to_1bufferv",
"_1gdk_1pixbuf_1scale_1simple",
@@ -1227,6 +1241,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1filename_1to_1uri",
"_1g_1filename_1to_1utf8",
"_1g_1free",
+ "_1g_1get_1current_1time",
"_1g_1hash_1table_1get_1values",
"_1g_1icon_1new_1for_1string",
"_1g_1icon_1to_1string",
@@ -1301,6 +1316,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1string_1free",
"_1g_1string_1new_1len",
"_1g_1strtod",
+ "_1g_1time_1val_1add",
"_1g_1timeout_1add",
"_1g_1type_1add_1interface_1static",
"_1g_1type_1class_1peek",

Back to the top