Exemple #1
0
bool MdpCtrl::setPosition(const overlay::utils::Dim& d,
        int fbw, int fbh)
{
    // Validatee against FB size
    if(!d.check(fbw, fbh)) {
        ALOGE("MdpCtrl setPosition failed dest dim violate screen limits");
        return false;
    }

    ovutils::Dim dim(d);
    ovutils::Dim ovsrcdim = getSrcRectDim();
    // Scaling of upto a max of 8 times supported
    if(dim.w >(ovsrcdim.w * ovutils::HW_OV_MAGNIFICATION_LIMIT)){
        dim.w = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.w;
        dim.x = (fbw - dim.w) / 2;
    }
    if(dim.h >(ovsrcdim.h * ovutils::HW_OV_MAGNIFICATION_LIMIT)) {
        dim.h = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.h;
        dim.y = (fbh - dim.h) / 2;
    }

    //dim.even_out();
    setDstRectDim(dim);
    return true;
}
void MdpCtrl::doTransform() {
    setRotationFlags();
    utils::Whf whf = getSrcWhf();
    utils::Dim dim = getSrcRectDim();
    utils::preRotateSource(mOrientation, whf, dim);
    setSrcWhf(whf);
    setSrcRectDim(dim);
}
Exemple #3
0
bool MdpCtrl::setPosition(const overlay::utils::Dim& d,
        int fbw, int fbh)
{
    ovutils::Dim dim(d);
    ovutils::Dim ovsrcdim = getSrcRectDim();
    // Scaling of upto a max of 20 times supported
    if(dim.w >(ovsrcdim.w * ovutils::HW_OV_MAGNIFICATION_LIMIT)){
        dim.w = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.w;
        dim.x = (fbw - dim.w) / 2;
    }
    if(dim.h >(ovsrcdim.h * ovutils::HW_OV_MAGNIFICATION_LIMIT)) {
        dim.h = ovutils::HW_OV_MAGNIFICATION_LIMIT * ovsrcdim.h;
        dim.y = (fbh - dim.h) / 2;
    }

    setDstRectDim(dim);
    return true;
}
Exemple #4
0
bool MdpCtrl::setCrop(const utils::Dim& cdim) {
    utils::Dim d(cdim);
    const utils::Whf ovwhf = getSrcWhf();
    int udata = getUserData();
    switch(udata) {
        case MDP_ROT_NOP:
            break; // nothing to do here
        case MDP_ROT_90:
        case MDP_ROT_90 | MDP_FLIP_UD:
        case MDP_ROT_90 | MDP_FLIP_LR:
            {
                if (ovwhf.w < (d.y + d.h)) {
                    ALOGE("MdpCtrl setCrop failed ROT 90 udata=%d",
                            udata);
                    d.dump();
                    this->dump();
                    return false;
                }
                uint32_t tmp = d.x;
                d.x = ovwhf.w - (d.y + d.h);
                d.y = tmp;
                utils::swap(d.w, d.h);
            }break;
        case MDP_ROT_270:
            {
                if (ovwhf.h < (d.x + d.w)) {
                    ALOGE("MdpCtrl setCrop failed ROT 270 udata=%d",
                            udata);
                    d.dump();
                    this->dump();
                    return false;
                }
                uint32_t tmp = d.y;
                d.y = ovwhf.h - (d.x + d.w);
                d.x = tmp;
                utils::swap(d.w, d.h);
            }break;
        case MDP_ROT_180:
            {
                if ((ovwhf.h < (d.y + d.h)) ||
                        (ovwhf.w < ( d.x + d.w))) {
                    ALOGE("MdpCtrl setCrop failed ROT 180 udata=%d",
                            udata);
                    d.dump();
                    this->dump();
                    return false;
                }
                d.x = ovwhf.w - (d.x + d.w);
                d.y = ovwhf.h - (d.y + d.h);
            }break;
        default:
            if(!(udata & (MDP_FLIP_UD | MDP_FLIP_LR))) {
                ALOGE("MdpCtrl setCrop unknown rot %d", udata);
                return false;
            }
    }

    if(getSrcRectDim() == d) {
        return true; // Nothing to do here
    }

    utils::normalizeCrop(d.x, d.w);
    utils::normalizeCrop(d.y, d.h);

    setSrcRectDim(d);

    return true;
}