renderer: Remove get_content_size hook
Now that we can reliably access buffer dimensions from weston_buffer, and gl-renderer isn't doing strange things with buffer widths, just use that. The renderer interface is now unused and can be deleted. Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
@@ -4580,8 +4580,7 @@ weston_surface_set_label_func(struct weston_surface *surface,
|
||||
*
|
||||
* Retrieves the raw surface content size in pixels for the given surface.
|
||||
* This is the whole content size in buffer pixels. If the surface
|
||||
* has no content or the renderer does not implement this feature,
|
||||
* zeroes are returned.
|
||||
* has no content, zeroes are returned.
|
||||
*
|
||||
* This function is used to determine the buffer size needed for
|
||||
* a weston_surface_copy_content() call.
|
||||
@@ -4590,15 +4589,15 @@ WL_EXPORT void
|
||||
weston_surface_get_content_size(struct weston_surface *surface,
|
||||
int *width, int *height)
|
||||
{
|
||||
struct weston_renderer *rer = surface->compositor->renderer;
|
||||
struct weston_buffer *buffer = surface->buffer_ref.buffer;
|
||||
|
||||
if (!rer->surface_get_content_size) {
|
||||
if (buffer) {
|
||||
*width = buffer->width;
|
||||
*height = buffer->height;
|
||||
} else {
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
rer->surface_get_content_size(surface, width, height);
|
||||
}
|
||||
|
||||
/** Get the bounding box of a surface and its subsurfaces
|
||||
|
||||
@@ -57,10 +57,6 @@ struct weston_renderer {
|
||||
void (*attach)(struct weston_surface *es, struct weston_buffer *buffer);
|
||||
void (*destroy)(struct weston_compositor *ec);
|
||||
|
||||
/** See weston_surface_get_content_size() */
|
||||
void (*surface_get_content_size)(struct weston_surface *surface,
|
||||
int *width, int *height);
|
||||
|
||||
/** See weston_surface_copy_content() */
|
||||
int (*surface_copy_content)(struct weston_surface *surface,
|
||||
void *target, size_t size,
|
||||
|
||||
@@ -810,21 +810,6 @@ pixman_renderer_destroy(struct weston_compositor *ec)
|
||||
ec->renderer = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
pixman_renderer_surface_get_content_size(struct weston_surface *surface,
|
||||
int *width, int *height)
|
||||
{
|
||||
struct pixman_surface_state *ps = get_surface_state(surface);
|
||||
|
||||
if (ps->image) {
|
||||
*width = pixman_image_get_width(ps->image);
|
||||
*height = pixman_image_get_height(ps->image);
|
||||
} else {
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
pixman_renderer_surface_copy_content(struct weston_surface *surface,
|
||||
void *target, size_t size,
|
||||
@@ -896,8 +881,6 @@ pixman_renderer_init(struct weston_compositor *ec)
|
||||
renderer->base.flush_damage = pixman_renderer_flush_damage;
|
||||
renderer->base.attach = pixman_renderer_attach;
|
||||
renderer->base.destroy = pixman_renderer_destroy;
|
||||
renderer->base.surface_get_content_size =
|
||||
pixman_renderer_surface_get_content_size;
|
||||
renderer->base.surface_copy_content =
|
||||
pixman_renderer_surface_copy_content;
|
||||
ec->renderer = &renderer->base;
|
||||
|
||||
@@ -3061,22 +3061,6 @@ out:
|
||||
es->is_opaque = false;
|
||||
}
|
||||
|
||||
static void
|
||||
gl_renderer_surface_get_content_size(struct weston_surface *surface,
|
||||
int *width, int *height)
|
||||
{
|
||||
struct gl_surface_state *gs = get_surface_state(surface);
|
||||
struct weston_buffer *buffer = gs->buffer_ref.buffer;
|
||||
|
||||
if (!buffer) {
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
} else {
|
||||
*width = gs->buffer_ref.buffer->width;
|
||||
*height = gs->buffer_ref.buffer->height;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
pack_color(pixman_format_code_t format, float *c)
|
||||
{
|
||||
@@ -3137,7 +3121,8 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
|
||||
|
||||
assert(buffer);
|
||||
|
||||
gl_renderer_surface_get_content_size(surface, &cw, &ch);
|
||||
cw = buffer->width;
|
||||
ch = buffer->height;
|
||||
|
||||
switch (buffer->type) {
|
||||
case WESTON_BUFFER_SOLID:
|
||||
@@ -3745,8 +3730,6 @@ gl_renderer_display_create(struct weston_compositor *ec,
|
||||
gr->base.flush_damage = gl_renderer_flush_damage;
|
||||
gr->base.attach = gl_renderer_attach;
|
||||
gr->base.destroy = gl_renderer_destroy;
|
||||
gr->base.surface_get_content_size =
|
||||
gl_renderer_surface_get_content_size;
|
||||
gr->base.surface_copy_content = gl_renderer_surface_copy_content;
|
||||
gr->base.fill_buffer_info = gl_renderer_fill_buffer_info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user