}
static inline struct vertex2f
-calc_topleft(struct vertex2f inv_size, struct pipe_video_rect rect)
+calc_topleft(struct vertex2f size, struct pipe_video_rect rect)
{
- struct vertex2f res = { rect.x * inv_size.x, rect.y * inv_size.y };
+ struct vertex2f res = { rect.x / size.x, rect.y / size.y };
return res;
}
static inline struct vertex2f
-calc_bottomright(struct vertex2f inv_size, struct pipe_video_rect rect)
+calc_bottomright(struct vertex2f size, struct pipe_video_rect rect)
{
- struct vertex2f res = { (rect.x + rect.w) * inv_size.x, (rect.y + rect.h) * inv_size.y };
+ struct vertex2f res = { (rect.x + rect.w) / size.x, (rect.y + rect.h) / size.y };
return res;
}
calc_src_and_dst(struct vl_compositor_layer *layer, unsigned width, unsigned height,
struct pipe_video_rect src, struct pipe_video_rect dst)
{
- struct vertex2f inv_size = { 1.0f / width, 1.0f / height };
+ struct vertex2f size = { width, height };
- layer->src.tl = calc_topleft(inv_size, src);
- layer->src.br = calc_bottomright(inv_size, src);
- layer->dst.tl = calc_topleft(inv_size, dst);
- layer->dst.br = calc_bottomright(inv_size, dst);
+ layer->src.tl = calc_topleft(size, src);
+ layer->src.br = calc_bottomright(size, src);
+ layer->dst.tl = calc_topleft(size, dst);
+ layer->dst.br = calc_bottomright(size, dst);
}
static void