Rename current, origin, scale, origin_scale

This patch renames that fields to have consistent names.
This commit is contained in:
Hardening 2013-09-18 23:56:35 +02:00 committed by Kristian Høgsberg
parent a2df51c19f
commit ff39efa5c0
14 changed files with 111 additions and 111 deletions

View File

@ -450,8 +450,8 @@ drm_output_prepare_scanout_surface(struct weston_output *_output,
if (es->geometry.x != output->base.x ||
es->geometry.y != output->base.y ||
buffer == NULL || c->gbm == NULL ||
buffer->width != output->base.current->width ||
buffer->height != output->base.current->height ||
buffer->width != output->base.current_mode->width ||
buffer->height != output->base.current_mode->height ||
output->base.transform != es->buffer_transform ||
es->transform.enabled)
return NULL;
@ -581,7 +581,7 @@ drm_output_repaint(struct weston_output *output_base,
if (!output->next)
return;
mode = container_of(output->base.current, struct drm_mode, base);
mode = container_of(output->base.current_mode, struct drm_mode, base);
if (!output->current) {
ret = drmModeSetCrtc(compositor->drm.fd, output->crtc_id,
output->next->fb_id, 0, 0,
@ -787,7 +787,7 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base,
if (es->buffer_transform != output_base->transform)
return NULL;
if (es->buffer_scale != output_base->scale)
if (es->buffer_scale != output_base->current_scale)
return NULL;
if (c->sprites_are_broken)
@ -859,7 +859,7 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base,
tbox = weston_transformed_rect(output_base->width,
output_base->height,
output_base->transform,
output_base->scale,
output_base->current_scale,
*box);
s->dest_x = tbox.x1;
s->dest_y = tbox.y1;
@ -978,8 +978,8 @@ drm_output_set_cursor(struct drm_output *output)
}
}
x = (es->geometry.x - output->base.x) * output->base.scale;
y = (es->geometry.y - output->base.y) * output->base.scale;
x = (es->geometry.x - output->base.x) * output->base.current_scale;
y = (es->geometry.y - output->base.y) * output->base.current_scale;
if (output->cursor_plane.x != x || output->cursor_plane.y != y) {
if (drmModeMoveCursor(c->drm.fd, output->crtc_id, x, y)) {
weston_log("failed to move cursor: %m\n");
@ -1100,11 +1100,11 @@ choose_mode (struct drm_output *output, struct weston_mode *target_mode)
{
struct drm_mode *tmp_mode = NULL, *mode;
if (output->base.current->width == target_mode->width &&
output->base.current->height == target_mode->height &&
(output->base.current->refresh == target_mode->refresh ||
if (output->base.current_mode->width == target_mode->width &&
output->base.current_mode->height == target_mode->height &&
(output->base.current_mode->refresh == target_mode->refresh ||
target_mode->refresh == 0))
return (struct drm_mode *)output->base.current;
return (struct drm_mode *)output->base.current_mode;
wl_list_for_each(mode, &output->base.mode_list, base.link) {
if (mode->mode_info.hdisplay == target_mode->width &&
@ -1151,13 +1151,13 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
return -1;
}
if (&drm_mode->base == output->base.current)
if (&drm_mode->base == output->base.current_mode)
return 0;
output->base.current->flags = 0;
output->base.current_mode->flags = 0;
output->base.current = &drm_mode->base;
output->base.current->flags =
output->base.current_mode = &drm_mode->base;
output->base.current_mode->flags =
WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
/* reset rendering stuff. */
@ -1439,8 +1439,8 @@ drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
int i, flags;
output->surface = gbm_surface_create(ec->gbm,
output->base.current->width,
output->base.current->height,
output->base.current_mode->width,
output->base.current_mode->height,
GBM_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT |
GBM_BO_USE_RENDERING);
@ -1477,8 +1477,8 @@ drm_output_init_egl(struct drm_output *output, struct drm_compositor *ec)
static int
drm_output_init_pixman(struct drm_output *output, struct drm_compositor *c)
{
int w = output->base.current->width;
int h = output->base.current->height;
int w = output->base.current_mode->width;
int h = output->base.current_mode->height;
unsigned int i;
/* FIXME error checking */
@ -1898,20 +1898,20 @@ create_output_for_connector(struct drm_compositor *ec,
configured = current;
if (option_current_mode && current)
output->base.current = &current->base;
output->base.current_mode = &current->base;
else if (configured)
output->base.current = &configured->base;
output->base.current_mode = &configured->base;
else if (preferred)
output->base.current = &preferred->base;
output->base.current_mode = &preferred->base;
else if (current)
output->base.current = &current->base;
output->base.current_mode = &current->base;
if (output->base.current == NULL) {
if (output->base.current_mode == NULL) {
weston_log("no available modes for %s\n", output->base.name);
goto err_free;
}
output->base.current->flags |= WL_OUTPUT_MODE_CURRENT;
output->base.current_mode->flags |= WL_OUTPUT_MODE_CURRENT;
weston_output_init(&output->base, &ec->base, x, y,
connector->mmWidth, connector->mmHeight,
@ -1944,7 +1944,7 @@ create_output_for_connector(struct drm_compositor *ec,
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
output->base.connection_internal = 1;
output->base.origin = output->base.current;
output->base.original_mode = output->base.current_mode;
output->base.start_repaint_loop = drm_output_start_repaint_loop;
output->base.repaint = drm_output_repaint;
output->base.destroy = drm_output_destroy;
@ -2287,7 +2287,7 @@ drm_compositor_set_modes(struct drm_compositor *compositor)
continue;
}
drm_mode = (struct drm_mode *) output->base.current;
drm_mode = (struct drm_mode *) output->base.current_mode;
ret = drmModeSetCrtc(compositor->drm.fd, output->crtc_id,
output->current->fb_id, 0, 0,
&output->connector_id, 1,
@ -2494,8 +2494,8 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
struct drm_output, base.link);
if (!output->recorder) {
width = output->base.current->width;
height = output->base.current->height;
width = output->base.current_mode->width;
height = output->base.current_mode->height;
output->recorder =
create_recorder(c, width, height, "capture.h264");

View File

@ -543,8 +543,8 @@ fbdev_output_create(struct fbdev_compositor *compositor,
wl_list_init(&output->base.mode_list);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current = &output->mode;
output->base.origin = &output->mode;
output->base.current_mode = &output->mode;
output->base.original_mode = &output->mode;
output->base.subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
output->base.make = "unknown";
output->base.model = output->fb_info.id;

View File

@ -107,7 +107,7 @@ headless_compositor_create_output(struct headless_compositor *c,
wl_list_init(&output->base.mode_list);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current = &output->mode;
output->base.current_mode = &output->mode;
weston_output_init(&output->base, &c->base, 0, 0, width, height,
WL_OUTPUT_TRANSFORM_NORMAL, 1);
@ -120,7 +120,7 @@ headless_compositor_create_output(struct headless_compositor *c,
output->finish_frame_timer =
wl_event_loop_add_timer(loop, finish_frame_handler, output);
output->base.origin = output->base.current;
output->base.original_mode = output->base.current_mode;
output->base.start_repaint_loop = headless_output_start_repaint_loop;
output->base.repaint = headless_output_repaint;
output->base.destroy = headless_output_destroy;

View File

@ -369,12 +369,12 @@ rdp_switch_mode(struct weston_output *output, struct weston_mode *target_mode) {
return -ENOENT;
}
if(local_mode == output->current)
if(local_mode == output->current_mode)
return 0;
output->current->flags = 0;
output->current = local_mode;
output->current->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
output->current_mode->flags = 0;
output->current_mode = local_mode;
output->current_mode->flags = WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
pixman_renderer_output_destroy(output);
pixman_renderer_output_create(output);
@ -466,7 +466,7 @@ rdp_compositor_create_output(struct rdp_compositor *c, int width, int height,
goto out_free_output_and_modes;
}
output->base.current = currentMode;
output->base.current_mode = currentMode;
weston_output_init(&output->base, &c->base, 0, 0, width, height,
WL_OUTPUT_TRANSFORM_NORMAL, 1);
@ -489,7 +489,7 @@ rdp_compositor_create_output(struct rdp_compositor *c, int width, int height,
loop = wl_display_get_event_loop(c->base.wl_display);
output->finish_frame_timer = wl_event_loop_add_timer(loop, finish_frame_handler, output);
output->base.origin = output->base.current;
output->base.original_mode = output->base.current_mode;
output->base.start_repaint_loop = rdp_output_start_repaint_loop;
output->base.repaint = rdp_output_repaint;
output->base.destroy = rdp_output_destroy;

View File

@ -369,8 +369,8 @@ rpi_output_create(struct rpi_compositor *compositor, uint32_t transform)
wl_list_init(&output->base.mode_list);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current = &output->mode;
output->base.origin = &output->mode;
output->base.current_mode = &output->mode;
output->base.original_mode = &output->mode;
output->base.subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
output->base.make = "unknown";
output->base.model = "unknown";

View File

@ -261,7 +261,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
wl_list_init(&output->base.mode_list);
wl_list_insert(&output->base.mode_list, &output->mode.link);
output->base.current = &output->mode;
output->base.current_mode = &output->mode;
weston_output_init(&output->base, &c->base, 0, 0, width, height,
WL_OUTPUT_TRANSFORM_NORMAL, 1);
@ -295,7 +295,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
&shell_surface_listener, output);
wl_shell_surface_set_toplevel(output->parent.shell_surface);
output->base.origin = output->base.current;
output->base.original_mode = output->base.current_mode;
output->base.start_repaint_loop = wayland_output_start_repaint_loop;
output->base.repaint = wayland_output_repaint;
output->base.destroy = wayland_output_destroy;

View File

@ -420,10 +420,10 @@ set_clip_for_output(struct weston_output *output_base, pixman_region32_t *region
break;
}
transformed_rect.x1 *= output_base->scale;
transformed_rect.y1 *= output_base->scale;
transformed_rect.x2 *= output_base->scale;
transformed_rect.y2 *= output_base->scale;
transformed_rect.x1 *= output_base->current_scale;
transformed_rect.y1 *= output_base->current_scale;
transformed_rect.x2 *= output_base->current_scale;
transformed_rect.y2 *= output_base->current_scale;
output_rects[i].x = transformed_rect.x1;
output_rects[i].y = transformed_rect.y1;
@ -891,8 +891,8 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
output->base.set_backlight = NULL;
output->base.set_dpms = NULL;
output->base.switch_mode = NULL;
output->base.current = &output->mode;
output->base.origin = output->base.current;
output->base.current_mode = &output->mode;
output->base.original_mode = output->base.current_mode;
output->base.make = "xwayland";
output->base.model = "none";
weston_output_init(&output->base, &c->base,

View File

@ -109,13 +109,13 @@ weston_output_switch_mode(struct weston_output *output, struct weston_mode *mode
if (ret < 0)
return ret;
output->scale = scale;
output->current_scale = scale;
pixman_region32_init(&old_output_region);
pixman_region32_copy(&old_output_region, &output->region);
/* Update output region and transformation matrix */
weston_output_transform_scale_init(output, output->transform, output->scale);
weston_output_transform_scale_init(output, output->transform, output->current_scale);
pixman_region32_init(&output->previous_damage);
pixman_region32_init_rect(&output->region, output->x, output->y,
@ -2585,7 +2585,7 @@ bind_output(struct wl_client *client,
output->transform);
if (version >= 2)
wl_output_send_scale(resource,
output->scale);
output->current_scale);
wl_list_for_each (mode, &output->mode_list, link) {
wl_output_send_mode(resource,
@ -2714,21 +2714,21 @@ weston_output_transform_scale_init(struct weston_output *output, uint32_t transf
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
/* Swap width and height */
output->width = output->current->height;
output->height = output->current->width;
output->width = output->current_mode->height;
output->height = output->current_mode->width;
break;
case WL_OUTPUT_TRANSFORM_NORMAL:
case WL_OUTPUT_TRANSFORM_180:
case WL_OUTPUT_TRANSFORM_FLIPPED:
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
output->width = output->current->width;
output->height = output->current->height;
output->width = output->current_mode->width;
output->height = output->current_mode->height;
break;
default:
break;
}
output->scale = scale;
output->current_scale = scale;
output->width /= scale;
output->height /= scale;
}
@ -2760,7 +2760,7 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c,
output->mm_width = mm_width;
output->mm_height = mm_height;
output->dirty = 1;
output->origin_scale = scale;
output->original_scale = scale;
weston_output_transform_scale_init(output, transform, scale);
weston_output_init_zoom(output);
@ -2790,8 +2790,8 @@ weston_output_transform_coordinate(struct weston_output *output,
wl_fixed_t tx, ty;
wl_fixed_t width, height;
width = wl_fixed_from_int(output->width * output->scale - 1);
height = wl_fixed_from_int(output->height * output->scale - 1);
width = wl_fixed_from_int(output->width * output->current_scale - 1);
height = wl_fixed_from_int(output->height * output->current_scale - 1);
switch(output->transform) {
case WL_OUTPUT_TRANSFORM_NORMAL:
@ -2829,8 +2829,8 @@ weston_output_transform_coordinate(struct weston_output *output,
break;
}
*x = tx / output->scale + wl_fixed_from_int(output->x);
*y = ty / output->scale + wl_fixed_from_int(output->y);
*x = tx / output->current_scale + wl_fixed_from_int(output->x);
*y = ty / output->current_scale + wl_fixed_from_int(output->y);
}
static void

View File

@ -203,11 +203,11 @@ struct weston_output {
char *make, *model, *serial_number;
uint32_t subpixel;
uint32_t transform;
int32_t scale;
int32_t current_scale;
struct weston_mode *current;
struct weston_mode *origin;
int32_t origin_scale;
struct weston_mode *current_mode;
struct weston_mode *original_mode;
int32_t original_scale;
struct wl_list mode_list;
void (*start_repaint_loop)(struct weston_output *output);

View File

@ -104,8 +104,8 @@ evdev_process_key(struct evdev_device *device, struct input_event *e, int time)
static void
evdev_process_touch(struct evdev_device *device, struct input_event *e)
{
const int screen_width = device->output->current->width;
const int screen_height = device->output->current->height;
const int screen_width = device->output->current_mode->width;
const int screen_height = device->output->current_mode->height;
switch (e->code) {
case ABS_MT_SLOT:
@ -136,8 +136,8 @@ static inline void
evdev_process_absolute_motion(struct evdev_device *device,
struct input_event *e)
{
const int screen_width = device->output->current->width;
const int screen_height = device->output->current->height;
const int screen_width = device->output->current_mode->width;
const int screen_height = device->output->current_mode->height;
switch (e->code) {
case ABS_X:

View File

@ -511,7 +511,7 @@ draw_surface(struct weston_surface *es, struct weston_output *output,
use_shader(gr, gs->shader);
shader_uniforms(gs->shader, es, output);
if (es->transform.enabled || output->zoom.active || output->scale != es->buffer_scale)
if (es->transform.enabled || output->zoom.active || output->current_scale != es->buffer_scale)
filter = GL_LINEAR;
else
filter = GL_NEAREST;
@ -583,13 +583,13 @@ texture_border(struct weston_output *output)
x[0] = -gr->border.left;
x[1] = 0;
x[2] = output->current->width;
x[3] = output->current->width + gr->border.right;
x[2] = output->current_mode->width;
x[3] = output->current_mode->width + gr->border.right;
y[0] = -gr->border.top;
y[1] = 0;
y[2] = output->current->height;
y[3] = output->current->height + gr->border.bottom;
y[2] = output->current_mode->height;
y[3] = output->current_mode->height + gr->border.bottom;
u[0] = 0.0;
u[1] = (GLfloat) gr->border.left / gr->border.width;
@ -743,9 +743,9 @@ gl_renderer_repaint_output(struct weston_output *output,
int32_t width, height;
pixman_region32_t buffer_damage, total_damage;
width = output->current->width +
width = output->current_mode->width +
output->border.left + output->border.right;
height = output->current->height +
height = output->current_mode->height +
output->border.top + output->border.bottom;
glViewport(0, 0, width, height);

View File

@ -217,7 +217,7 @@ region_global_to_output(struct weston_output *output, pixman_region32_t *region)
{
pixman_region32_translate(region, -output->x, -output->y);
transform_region (region, output->width, output->height, output->transform);
scale_region (region, output->scale);
scale_region (region, output->current_scale);
}
#define D2F(v) pixman_double_to_fixed((double)v)
@ -271,8 +271,8 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
specified buffer transform/scale */
pixman_transform_init_identity(&transform);
pixman_transform_scale(&transform, NULL,
pixman_double_to_fixed ((double)1.0/output->scale),
pixman_double_to_fixed ((double)1.0/output->scale));
pixman_double_to_fixed ((double)1.0/output->current_scale),
pixman_double_to_fixed ((double)1.0/output->current_scale));
fw = pixman_int_to_fixed(output->width);
fh = pixman_int_to_fixed(output->height);
@ -385,7 +385,7 @@ repaint_region(struct weston_surface *es, struct weston_output *output,
pixman_image_set_transform(ps->image, &transform);
if (es->transform.enabled || output->scale != es->buffer_scale)
if (es->transform.enabled || output->current_scale != es->buffer_scale)
pixman_image_set_filter(ps->image, PIXMAN_FILTER_BILINEAR, NULL, 0);
else
pixman_image_set_filter(ps->image, PIXMAN_FILTER_NEAREST, NULL, 0);
@ -711,8 +711,8 @@ pixman_renderer_output_create(struct weston_output *output)
return -1;
/* set shadow image transformation */
w = output->current->width;
h = output->current->height;
w = output->current_mode->width;
h = output->current_mode->height;
po->shadow_buffer = malloc(w * h * 4);

View File

@ -896,8 +896,8 @@ rpi_renderer_read_pixels(struct weston_output *base,
uint32_t i;
int ret;
fb_width = base->current->width;
fb_height = base->current->height;
fb_width = base->current_mode->width;
fb_height = base->current_mode->height;
DBG("%s(%u, %u, %u, %u), resource %p\n", __func__,
x, y, width, height, buffer);

View File

@ -136,8 +136,8 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
compositor->renderer->read_pixels(output,
compositor->read_format, pixels,
0, 0, output->current->width,
output->current->height);
0, 0, output->current_mode->width,
output->current_mode->height);
stride = wl_shm_buffer_get_stride(l->buffer->shm_buffer);
@ -148,16 +148,16 @@ screenshooter_frame_notify(struct wl_listener *listener, void *data)
case PIXMAN_a8r8g8b8:
case PIXMAN_x8r8g8b8:
if (compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP)
copy_bgra_yflip(d, s, output->current->height, stride);
copy_bgra_yflip(d, s, output->current_mode->height, stride);
else
copy_bgra(d, pixels, output->current->height, stride);
copy_bgra(d, pixels, output->current_mode->height, stride);
break;
case PIXMAN_x8b8g8r8:
case PIXMAN_a8b8g8r8:
if (compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP)
copy_rgba_yflip(d, s, output->current->height, stride);
copy_rgba_yflip(d, s, output->current_mode->height, stride);
else
copy_rgba(d, pixels, output->current->height, stride);
copy_rgba(d, pixels, output->current_mode->height, stride);
break;
default:
break;
@ -191,8 +191,8 @@ screenshooter_shoot(struct wl_client *client,
buffer->width = wl_shm_buffer_get_width(buffer->shm_buffer);
buffer->height = wl_shm_buffer_get_height(buffer->shm_buffer);
if (buffer->width < output->current->width ||
buffer->height < output->current->height)
if (buffer->width < output->current_mode->width ||
buffer->height < output->current_mode->height)
return;
l = malloc(sizeof *l);
@ -322,33 +322,33 @@ transform_rect(struct weston_output *output, pixman_box32_t *r)
break;
case WL_OUTPUT_TRANSFORM_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
r->x1 = output->current->width - s.y2;
r->x1 = output->current_mode->width - s.y2;
r->y1 = s.x1;
r->x2 = output->current->width - s.y1;
r->x2 = output->current_mode->width - s.y1;
r->y2 = s.x2;
break;
case WL_OUTPUT_TRANSFORM_180:
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
r->x1 = output->current->width - s.x2;
r->y1 = output->current->height - s.y2;
r->x2 = output->current->width - s.x1;
r->y2 = output->current->height - s.y1;
r->x1 = output->current_mode->width - s.x2;
r->y1 = output->current_mode->height - s.y2;
r->x2 = output->current_mode->width - s.x1;
r->y2 = output->current_mode->height - s.y1;
break;
case WL_OUTPUT_TRANSFORM_270:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
r->x1 = s.y1;
r->y1 = output->current->height - s.x2;
r->y1 = output->current_mode->height - s.x2;
r->x2 = s.y2;
r->y2 = output->current->height - s.x1;
r->y2 = output->current_mode->height - s.x1;
break;
default:
break;
}
r->x1 *= output->scale;
r->y1 *= output->scale;
r->x2 *= output->scale;
r->y2 *= output->scale;
r->x1 *= output->current_scale;
r->y1 *= output->current_scale;
r->x2 *= output->current_scale;
r->y2 *= output->current_scale;
}
static void
@ -396,14 +396,14 @@ weston_recorder_frame_notify(struct wl_listener *listener, void *data)
v[1].iov_base = r;
v[1].iov_len = n * sizeof *r;
recorder->total += writev(recorder->fd, v, 2);
stride = output->current->width;
stride = output->current_mode->width;
for (i = 0; i < n; i++) {
width = r[i].x2 - r[i].x1;
height = r[i].y2 - r[i].y1;
if (do_yflip)
y_orig = output->current->height - r[i].y2;
y_orig = output->current_mode->height - r[i].y2;
else
y_orig = r[i].y1;
@ -467,8 +467,8 @@ weston_recorder_create(struct weston_output *output, const char *filename)
recorder = malloc(sizeof *recorder);
stride = output->current->width;
size = stride * 4 * output->current->height;
stride = output->current_mode->width;
size = stride * 4 * output->current_mode->height;
recorder->frame = zalloc(size);
recorder->rect = malloc(size);
recorder->total = 0;
@ -505,8 +505,8 @@ weston_recorder_create(struct weston_output *output, const char *filename)
return;
}
header.width = output->current->width;
header.height = output->current->height;
header.width = output->current_mode->width;
header.height = output->current_mode->height;
recorder->total += write(recorder->fd, &header, sizeof header);
recorder->frame_listener.notify = weston_recorder_frame_notify;