From 2e18b6b9b2c37b6e50749c74234bbdb1eff23101 Mon Sep 17 00:00:00 2001 From: Prabhanjan Kandula Date: Tue, 14 Feb 2012 12:24:16 +0530 Subject: [PATCH] libcopybit : Fix calculation of copybit source rect for blit - Fix the copybit source rect calculation for 180 and 270 degrees rotation. Calculate blit rects based on the source crop. CRs-fixed: 337366 (cherry picked from commit 06aa97757bd7023234d3852801e05e077aaa1d2f) Change-Id: Iba2e230acd84271fc5649e06918824752aa90670 --- libcopybit/copybit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp index 4c02de8..aa9642b 100644 --- a/libcopybit/copybit.cpp +++ b/libcopybit/copybit.cpp @@ -189,17 +189,17 @@ static void set_rects(struct copybit_context_t *dev, 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) - horiz_padding; + e->src_rect.x = (src->l + src->r) - (e->src_rect.x + e->src_rect.w); }else{ - e->src_rect.y = e->src.height - (e->src_rect.y + e->src_rect.h) - vert_padding; + e->src_rect.y = (src->t + src->b) - (e->src_rect.y + e->src_rect.h); } } 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) - vert_padding; + e->src_rect.y = (src->t + src->b) - (e->src_rect.y + e->src_rect.h); }else{ - e->src_rect.x = e->src.width - (e->src_rect.x + e->src_rect.w) - horiz_padding; + e->src_rect.x = (src->l + src->r) - (e->src_rect.x + e->src_rect.w); } } }