libcopybit: Disable copybit blending for opaque layers

This change disables copybit blending when surface flinger sets
HWC_BLENDING_NONE for a layer.

Change-Id: Ie86a2d5c9e3d3dab1bc7a0a3cc31bff7afe604da
This commit is contained in:
Jeykumar Sankaran 2012-01-05 18:56:27 -08:00 committed by Andrew Sutherland
parent ea94363fde
commit dadd73f13f
2 changed files with 5 additions and 2 deletions

View File

@ -1276,7 +1276,10 @@ static int stretch_copybit(
struct copybit_rect_t const *src_rect,
struct copybit_region_t const *region)
{
return stretch_copybit_internal(dev, dst, src, dst_rect, src_rect, region, true);
struct copybit_context_t* ctx = (struct copybit_context_t*)dev;
bool needsBlending = (ctx->blitState.global_alpha != 0);
return stretch_copybit_internal(dev, dst, src, dst_rect, src_rect,
region, needsBlending);
}
/** Perform a blit type operation */

View File

@ -1100,7 +1100,7 @@ static int drawLayerUsingCopybit(hwc_composer_device_t *dev, hwc_layer_t *layer,
copybit->set_parameter(copybit, COPYBIT_FRAMEBUFFER_HEIGHT, renderBuffer->height);
copybit->set_parameter(copybit, COPYBIT_TRANSFORM, layer->transform);
copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA,
(layer->blending == HWC_BLENDING_NONE) ? 0xFF : layer->alpha);
(layer->blending == HWC_BLENDING_NONE) ? 0x0 : layer->alpha);
copybit->set_parameter(copybit, COPYBIT_PREMULTIPLIED_ALPHA,
(layer->blending == HWC_BLENDING_PREMULT)? COPYBIT_ENABLE : COPYBIT_DISABLE);
err = copybit->stretch(copybit, &dst, &src, &dstRect, &srcRect, &copybitRegion);