From f3353ad3283e8bfd3ffc176b1cb5456bb5691e2e Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Thu, 13 Oct 2011 14:32:49 -0700 Subject: [PATCH] Bypass: Fix source dimensions Since the RGB buffer could be 32 aligned, use actual source dimensions. Change-Id: Ice615e34a304c864cbe8fef044e14e9f835f9359 --- libhwcomposer/hwcomposer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 844f690..1b55fdb 100755 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -390,8 +390,9 @@ static int prepareBypass(hwc_context_t *ctx, hwc_layer_t *layer, int index, LOGE("prepareBypass handle null"); return -1; } - if(hnd->width > hwcModule->fbDevice->width || - hnd->height > hwcModule->fbDevice->height) { + hwc_rect_t sourceCrop = layer->sourceCrop; + if((sourceCrop.right - sourceCrop.left) > hwcModule->fbDevice->width || + (sourceCrop.bottom - sourceCrop.top) > hwcModule->fbDevice->height) { ctx->animCount = ANIM_FRAME_COUNT; return -1; } @@ -399,8 +400,8 @@ static int prepareBypass(hwc_context_t *ctx, hwc_layer_t *layer, int index, int ret = 0; int orientation = layer->transform; overlay_buffer_info info; - info.width = hnd->width; - info.height = hnd->height; + info.width = sourceCrop.right - sourceCrop.left; + info.height = sourceCrop.bottom - sourceCrop.top; info.format = hnd->format; info.size = hnd->size; const bool useVGPipe = true; @@ -415,6 +416,7 @@ static int prepareBypass(hwc_context_t *ctx, hwc_layer_t *layer, int index, LOGE("prepareBypass setSource failed"); return -1; } + hwc_rect_t displayFrame = layer->displayFrame; ret = ovUI->setPosition(displayFrame.left, displayFrame.top, (displayFrame.right - displayFrame.left),