Exemplo n.º 1
0
void Layer::setGeometry(
    const sp<const DisplayDevice>& hw,
        HWComposer::HWCLayerInterface& layer)
{
    LayerBaseClient::setGeometry(hw, layer);

    // enable this layer
    layer.setSkip(false);

    // we can't do alpha-fade with the hwc HAL
    const State& s(drawingState());
    if (s.alpha < 0xFF) {
        layer.setSkip(true);
    }

    if (isSecure() && !hw->isSecure()) {
        layer.setSkip(true);
    }

    /*
     * Transformations are applied in this order:
     * 1) buffer orientation/flip/mirror
     * 2) state transformation (window manager)
     * 3) layer orientation (screen orientation)
     * (NOTE: the matrices are multiplied in reverse order)
     */

    const Transform bufferOrientation(mCurrentTransform);
    const Transform tr(hw->getTransform() * s.transform * bufferOrientation);

    // this gives us only the "orientation" component of the transform
    const uint32_t finalTransform = tr.getOrientation();

    // we can only handle simple transformation
    if (finalTransform & Transform::ROT_INVALID) {
        layer.setSkip(true);
    } else {
        layer.setTransform(finalTransform);
    }
    layer.setCrop(computeBufferCrop());

    // [MTK] {{{
    hwc_color_t color;
    color.a = s.alpha;
    layer.setFillColor(color);
    layer.setTransform(finalTransform);
    layer.setIdentity(getIdentity());
    layer.setMatrix(tr);
    layer.setSecure((isSecure() || isProtected()));
    // [MTK] }}}
}