Skip to content

Commit 402afc0

Browse files
committed
Create 24-bit image surface
1 parent 9b654a5 commit 402afc0

File tree

1 file changed

+5
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics

1 file changed

+5
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,11 @@ void init(int width, int height) {
12601260
this.type = SWT.BITMAP;
12611261

12621262
/* Create the pixmap */
1263-
surface = Cairo.cairo_image_surface_create(Cairo.CAIRO_FORMAT_ARGB32, width, height);
1263+
if (GTK.GTK4) {
1264+
surface = Cairo.cairo_image_surface_create(Cairo.CAIRO_FORMAT_RGB24, width, height);
1265+
} else {
1266+
surface = GDK.gdk_window_create_similar_surface(GDK.gdk_get_default_root_window(), Cairo.CAIRO_CONTENT_COLOR, width, height);
1267+
}
12641268
if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES);
12651269
// When we create a blank image we need to set it to 100 in GTK3 as we draw using 100% scale.
12661270
// Cairo will take care of scaling for us when image needs to be scaled.

0 commit comments

Comments
 (0)