#include <epoxy/egl.h>
#endif
+#include <math.h>
+
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
typedef struct {
cairo_region_union (region, damage);
cairo_region_destroy (damage);
- ww = gdk_surface_get_width (surface) * gdk_surface_get_scale_factor (surface);
- wh = gdk_surface_get_height (surface) * gdk_surface_get_scale_factor (surface);
+ ww = (int) ceil (gdk_surface_get_width (surface) * gdk_surface_get_scale (surface));
+ wh = (int) ceil (gdk_surface_get_height (surface) * gdk_surface_get_scale (surface));
gdk_gl_context_make_current (context);
EGLint *heap_rects = NULL;
int i, j, n_rects = cairo_region_num_rectangles (painted);
int surface_height = gdk_surface_get_height (surface);
- int scale = gdk_surface_get_scale_factor (surface);
+ double scale = gdk_surface_get_scale (surface);
EGLint *rects;
if (n_rects < G_N_ELEMENTS (stack_rects) / 4)
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (painted, i, &rect);
- rects[j++] = rect.x * scale;
- rects[j++] = (surface_height - rect.height - rect.y) * scale;
- rects[j++] = rect.width * scale;
- rects[j++] = rect.height * scale;
+ rects[j++] = (int) floor (rect.x * scale);
+ rects[j++] = (int) floor ((surface_height - rect.height - rect.y) * scale);
+ rects[j++] = (int) ceil (rect.width * scale);
+ rects[j++] = (int) ceil (rect.height * scale);
}
priv->eglSwapBuffersWithDamage (gdk_display_get_egl_display (display), egl_surface, rects, n_rects);
g_free (heap_rects);
if (impl->display_server.egl_window)
wl_egl_window_resize (impl->display_server.egl_window,
- width * gdk_fractional_scale_to_int (scale),
- height * gdk_fractional_scale_to_int (scale), 0, 0);
+ gdk_fractional_scale_scale (scale, width),
+ gdk_fractional_scale_scale (scale, height),
+ 0, 0);
gdk_surface_invalidate_rect (surface, NULL);
{
impl->display_server.egl_window =
wl_egl_window_create (impl->display_server.wl_surface,
- surface->width * gdk_fractional_scale_to_int (&impl->scale),
- surface->height * gdk_fractional_scale_to_int (&impl->scale));
+ gdk_fractional_scale_scale (&impl->scale, surface->width),
+ gdk_fractional_scale_scale (&impl->scale, surface->height));
gdk_surface_set_egl_native_window (surface, impl->display_server.egl_window);
}
}