summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/gen4_render.c4
-rw-r--r--src/sna/gen5_render.c4
-rw-r--r--src/sna/gen6_render.c4
-rw-r--r--src/sna/gen7_render.c26
4 files changed, 30 insertions, 8 deletions
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 67f7b64e..e40a1b7b 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -1379,10 +1379,10 @@ gen4_render_video(struct sna *sna,
#endif
src_scale_x = (float)src_width / dst_width / frame->width;
- src_offset_x = frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
+ src_offset_x = (float)frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
src_scale_y = (float)src_height / dst_height / frame->height;
- src_offset_y = frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
+ src_offset_y = (float)frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
box = REGION_RECTS(dstRegion);
nbox = REGION_NUM_RECTS(dstRegion);
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 8c8a996f..8b50d22e 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1363,10 +1363,10 @@ gen5_render_video(struct sna *sna,
#endif
src_scale_x = (float)src_width / dst_width / frame->width;
- src_offset_x = frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
+ src_offset_x = (float)frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
src_scale_y = (float)src_height / dst_height / frame->height;
- src_offset_y = frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
+ src_offset_y = (float)frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
box = REGION_RECTS(dstRegion);
nbox = REGION_NUM_RECTS(dstRegion);
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 8d15bd80..64eccc51 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -1651,10 +1651,10 @@ gen6_render_video(struct sna *sna,
#endif
src_scale_x = (float)src_width / dst_width / frame->width;
- src_offset_x = frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
+ src_offset_x = (float)frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
src_scale_y = (float)src_height / dst_height / frame->height;
- src_offset_y = frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
+ src_offset_y = (float)frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
box = REGION_RECTS(dstRegion);
nbox = REGION_NUM_RECTS(dstRegion);
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 4453797f..80fa872e 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1792,17 +1792,39 @@ gen7_render_video(struct sna *sna,
pix_yoff = 0;
#endif
+ DBG(("%s: src=(%d, %d)x(%d, %d); frame=(%dx%d), dst=(%dx%d)\n",
+ __FUNCTION__,
+ frame->src.x1, frame->src.y1,
+ src_width, src_height,
+ dst_width, dst_height,
+ frame->width, frame->height));
+
src_scale_x = (float)src_width / dst_width / frame->width;
- src_offset_x = frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
+ src_offset_x = (float)frame->src.x1 / frame->width - dstRegion->extents.x1 * src_scale_x;
src_scale_y = (float)src_height / dst_height / frame->height;
- src_offset_y = frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
+ src_offset_y = (float)frame->src.y1 / frame->height - dstRegion->extents.y1 * src_scale_y;
+
+ DBG(("%s: scale=(%f, %f), offset=(%f, %f)\n",
+ __FUNCTION__,
+ src_scale_x, src_scale_y,
+ src_offset_x, src_offset_y));
box = REGION_RECTS(dstRegion);
nbox = REGION_NUM_RECTS(dstRegion);
while (nbox--) {
BoxRec r;
+ DBG(("%s: dst=(%d, %d), (%d, %d) + (%d, %d); src=(%f, %f), (%f, %f)\n",
+ __FUNCTION__,
+ box->x1, box->y1,
+ box->x2, box->y2,
+ pix_xoff, pix_yoff,
+ box->x1 * src_scale_x + src_offset_x,
+ box->y1 * src_scale_y + src_offset_y,
+ box->x2 * src_scale_x + src_offset_x,
+ box->y2 * src_scale_y + src_offset_y));
+
r.x1 = box->x1 + pix_xoff;
r.x2 = box->x2 + pix_xoff;
r.y1 = box->y1 + pix_yoff;