[PATCH 3/3] add resize filter interface support
Zhao Halley
halley.zhao at intel.com
Fri Jun 8 02:33:58 PDT 2012
---
src/compositor.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/compositor.h | 1 +
2 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index a768ba6..365cc39 100755
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -251,6 +251,8 @@ weston_surface_create(struct weston_compositor *compositor)
weston_matrix_init(&surface->transform.position.matrix);
pixman_region32_init(&surface->transform.boundingbox);
surface->geometry.dirty = 1;
+ surface->min_filter = WL_SURFACE_RESIZE_SAMPLING_LINEAR;
+ surface->mag_filter = WL_SURFACE_RESIZE_SAMPLING_LINEAR;
return surface;
}
@@ -1471,6 +1473,56 @@ surface_set_input_region(struct wl_client *client,
weston_compositor_schedule_repaint(surface->compositor);
}
+static void
+surface_get_render_attr_caps(struct wl_client *client,
+ struct wl_resource *resource, uint32_t attr_type, uint32_t *attr_values)
+{
+ switch (attr_type) {
+ case WL_SURFACE_RESIZE_FILTER_MAG:
+ case WL_SURFACE_RESIZE_FILTER_MIN:
+ *attr_values = WL_SURFACE_RESIZE_SAMPLING_NEAREST | WL_SURFACE_RESIZE_SAMPLING_LINEAR;
+ break;
+ default:
+ *attr_values = 0;
+ break;
+ }
+}
+
+static void
+surface_get_render_attr(struct wl_client *client,
+ struct wl_resource *resource, uint32_t attr_type, uint32_t *attr_value)
+{
+ struct weston_surface *surface = resource->data;
+ switch (attr_type) {
+ case WL_SURFACE_RESIZE_FILTER_MAG:
+ *attr_value = surface->mag_filter;
+ break;
+ case WL_SURFACE_RESIZE_FILTER_MIN:
+ *attr_value = surface->min_filter;
+ break;
+ default:
+ *attr_value = 0;
+ break;
+ }
+}
+
+static void
+surface_set_render_attr(struct wl_client *client,
+ struct wl_resource *resource, uint32_t attr_type, uint32_t attr_value)
+{
+ struct weston_surface *surface = resource->data;
+ switch (attr_type) {
+ case WL_SURFACE_RESIZE_FILTER_MAG:
+ surface->mag_filter = attr_value;
+ break;
+ case WL_SURFACE_RESIZE_FILTER_MIN:
+ surface->min_filter = attr_value;
+ break;
+ default:
+ break;
+ }
+}
+
static const struct wl_surface_interface surface_interface = {
surface_destroy,
surface_attach,
@@ -1478,7 +1530,10 @@ static const struct wl_surface_interface surface_interface = {
surface_damage,
surface_frame,
surface_set_opaque_region,
- surface_set_input_region
+ surface_set_input_region,
+ surface_get_render_attr_caps,
+ surface_set_render_attr,
+ surface_get_render_attr,
};
static void
diff --git a/src/compositor.h b/src/compositor.h
index 14747f6..4702059 100755
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -400,6 +400,7 @@ struct weston_surface {
* are the sx and sy paramerters supplied to surface::attach .
*/
void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy);
+ enum wl_surface_resize_sampling min_filter, mag_filter;
void *private;
};
--
1.7.5.4
More information about the wayland-devel
mailing list