diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp index 767b3ee..6f6fca5 100644 --- a/libcopybit/copybit.cpp +++ b/libcopybit/copybit.cpp @@ -156,7 +156,8 @@ static void set_rects(struct copybit_context_t *dev, const struct copybit_rect_t *dst, const struct copybit_rect_t *src, const struct copybit_rect_t *scissor, - uint32_t padding) { + uint32_t horiz_padding, + uint32_t vert_padding) { struct copybit_rect_t clip; intersect(&clip, scissor, dst); @@ -183,19 +184,20 @@ static void set_rects(struct copybit_context_t *dev, } MULDIV(&e->src_rect.x, &e->src_rect.w, src->r - src->l, W); MULDIV(&e->src_rect.y, &e->src_rect.h, src->b - src->t, H); + if (dev->mFlags & COPYBIT_TRANSFORM_FLIP_V) { if (dev->mFlags & COPYBIT_TRANSFORM_ROT_90) { - e->src_rect.x = e->src.width - (e->src_rect.x + e->src_rect.w) - padding; + e->src_rect.x = e->src.width - (e->src_rect.x + e->src_rect.w) - horiz_padding; }else{ - e->src_rect.y = e->src.height - (e->src_rect.y + e->src_rect.h); + e->src_rect.y = e->src.height - (e->src_rect.y + e->src_rect.h) - vert_padding; } } if (dev->mFlags & COPYBIT_TRANSFORM_FLIP_H) { if (dev->mFlags & COPYBIT_TRANSFORM_ROT_90) { - e->src_rect.y = e->src.height - (e->src_rect.y + e->src_rect.h); + e->src_rect.y = e->src.height - (e->src_rect.y + e->src_rect.h) - vert_padding; }else{ - e->src_rect.x = e->src.width - (e->src_rect.x + e->src_rect.w) - padding; + e->src_rect.x = e->src.width - (e->src_rect.x + e->src_rect.w) - horiz_padding; } } } @@ -398,7 +400,7 @@ static int stretch_copybit( set_infos(ctx, req, flags); set_image(&req->dst, dst); set_image(&req->src, src); - set_rects(ctx, req, dst_rect, src_rect, &clip, src->padding); + set_rects(ctx, req, dst_rect, src_rect, &clip, src->horiz_padding, src->vert_padding); if (req->src_rect.w<=0 || req->src_rect.h<=0) continue;