width = gdk_surface_get_width (surface);
height = gdk_surface_get_height (surface);
- cairo_surface = _gdk_wayland_display_create_shm_surface (display_wayland,
- width, height,
- gdk_surface_get_scale_factor (surface));
+ cairo_surface = gdk_wayland_display_create_shm_surface (display_wayland,
+ width, height,
+ &GDK_FRACTIONAL_SCALE_INIT_INT (gdk_surface_get_scale_factor (surface)));
buffer = _gdk_wayland_shm_surface_get_wl_buffer (cairo_surface);
wl_buffer_add_listener (buffer, &buffer_listener, cairo_surface);
gdk_wayland_cairo_context_add_surface (self, cairo_surface);
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
if (surface == NULL)
{
- surface = _gdk_wayland_display_create_shm_surface (display,
- gdk_texture_get_width (texture),
- gdk_texture_get_height (texture),
- 1);
+ surface = gdk_wayland_display_create_shm_surface (display,
+ gdk_texture_get_width (texture),
+ gdk_texture_get_height (texture),
+ &GDK_FRACTIONAL_SCALE_INIT_INT (1));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
struct wl_shm_pool *pool;
struct wl_buffer *buffer;
GdkWaylandDisplay *display;
- uint32_t scale;
+ GdkFractionalScale scale;
} GdkWaylandCairoSurfaceData;
static int
}
cairo_surface_t *
-_gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
- int width,
- int height,
- guint scale)
+gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
+ int width,
+ int height,
+ const GdkFractionalScale *scale)
{
GdkWaylandCairoSurfaceData *data;
cairo_surface_t *surface = NULL;
cairo_status_t status;
+ int scaled_width, scaled_height;
int stride;
data = g_new (GdkWaylandCairoSurfaceData, 1);
data->display = display;
data->buffer = NULL;
- data->scale = scale;
+ data->scale = *scale;
- stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width * scale);
+ scaled_width = gdk_fractional_scale_scale (scale, width);
+ scaled_height = gdk_fractional_scale_scale (scale, height);
+ stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, scaled_width);
data->pool = create_shm_pool (display->shm,
- height * scale * stride,
+ scaled_height * stride,
&data->buf_length,
&data->buf);
if (G_UNLIKELY (data->pool == NULL))
surface = cairo_image_surface_create_for_data (data->buf,
CAIRO_FORMAT_ARGB32,
- width * scale,
- height * scale,
+ scaled_width,
+ scaled_height,
stride);
data->buffer = wl_shm_pool_create_buffer (data->pool, 0,
- width * scale, height * scale,
+ scaled_width, scaled_height,
stride, WL_SHM_FORMAT_ARGB8888);
cairo_surface_set_user_data (surface, &gdk_wayland_shm_surface_cairo_key,
data, gdk_wayland_cairo_surface_destroy);
- cairo_surface_set_device_scale (surface, scale, scale);
+ cairo_surface_set_device_scale (surface,
+ gdk_fractional_scale_to_double (scale),
+ gdk_fractional_scale_to_double (scale));
status = cairo_surface_status (surface);
if (status != CAIRO_STATUS_SUCCESS)
guint current_image_index,
guint *next_image_delay);
-void gdk_wayland_surface_sync (GdkSurface *surface);
-void gdk_wayland_surface_commit (GdkSurface *surface);
-void gdk_wayland_surface_notify_committed (GdkSurface *surface);
-void gdk_wayland_surface_request_frame (GdkSurface *surface);
-gboolean gdk_wayland_surface_has_surface (GdkSurface *surface);
+void gdk_wayland_surface_sync (GdkSurface *surface);
+void gdk_wayland_surface_commit (GdkSurface *surface);
+void gdk_wayland_surface_notify_committed (GdkSurface *surface);
+void gdk_wayland_surface_request_frame (GdkSurface *surface);
+gboolean gdk_wayland_surface_has_surface (GdkSurface *surface);
void gdk_wayland_surface_attach_image (GdkSurface *surface,
cairo_surface_t *cairo_surface,
const cairo_region_t *damage);
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
GdkSeat *seat);
-cairo_surface_t * _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
- int width,
- int height,
- guint scale);
+cairo_surface_t * gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
+ int width,
+ int height,
+ const GdkFractionalScale *scale);
struct wl_buffer *_gdk_wayland_shm_surface_get_wl_buffer (cairo_surface_t *surface);
gboolean _gdk_wayland_is_shm_surface (cairo_surface_t *surface);
#pragma once
+#include "gdkprivate-wayland.h"
+
typedef enum _PopupState
{
POPUP_STATE_IDLE,
gint64 pending_frame_counter;
GdkFractionalScale scale;
+ gboolean buffer_is_fractional;
gboolean buffer_scale_dirty;
gboolean viewport_dirty;