Consider scale factor when rendering views

This commit is contained in:
Drew DeVault 2017-10-22 23:19:21 -04:00
parent 03c0d41ca9
commit a7446792a1
7 changed files with 32 additions and 6 deletions

View file

@ -29,8 +29,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
if (version >= WL_OUTPUT_MODE_SINCE_VERSION) {
struct wlr_output_mode *mode;
wl_list_for_each(mode, &output->modes, link) {
// TODO: mode->flags should just be preferred
uint32_t flags = mode->flags;
uint32_t flags = mode->flags & ~WL_OUTPUT_MODE_PREFERRED;
if (output->current_mode == mode) {
flags |= WL_OUTPUT_MODE_CURRENT;
}
@ -45,6 +44,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
}
}
if (version >= WL_OUTPUT_SCALE_SINCE_VERSION) {
wlr_log(L_DEBUG, "Sending scale");
wl_output_send_scale(resource, output->scale);
}
if (version >= WL_OUTPUT_DONE_SINCE_VERSION) {

View file

@ -649,14 +649,14 @@ void wlr_surface_get_matrix(struct wlr_surface *surface,
float (*matrix)[16],
const float (*projection)[16],
const float (*transform)[16]) {
int width = surface->texture->width / surface->current->scale;
int height = surface->texture->height / surface->current->scale;
int width = surface->texture->width;
int height = surface->texture->height;
float scale[16];
wlr_matrix_identity(matrix);
if (transform) {
wlr_matrix_mul(matrix, transform, matrix);
}
wlr_matrix_scale(&scale, width, height, 1);
wlr_matrix_scale(&scale, width, height, surface->current->scale);
wlr_matrix_mul(matrix, &scale, matrix);
wlr_matrix_mul(projection, matrix, matrix);
}
@ -894,3 +894,16 @@ struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface,
return NULL;
}
void wlr_surface_send_enter(struct wlr_surface *surface,
struct wlr_output *output) {
struct wl_client *client = wl_resource_get_client(surface->resource);
struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) {
if (client == wl_resource_get_client(resource)) {
wlr_log(L_DEBUG, "sending output enter");
wl_surface_send_enter(surface->resource, resource);
break;
}
}
}