コード例 #1
0
ファイル: objectgroup.cpp プロジェクト: vcarluer/Belle
void ObjectGroup::resize(int x, int y)
{
    int prevWidth = this->width();
    int prevHeight = this->height();
    int prevY = this->y();

    Object::resize(x, y);
    if (this->height() < minHeight()) {
        this->setY(prevY);
        this->setHeight(minHeight());
    }

    this->alignObjects();
}
コード例 #2
0
ファイル: history_media.cpp プロジェクト: Emadpres/tdesktop
QSize HistoryMedia::countCurrentSize(int newWidth) {
	return QSize(qMin(newWidth, maxWidth()), minHeight());
}
コード例 #3
0
bool ExynosMPP::isProcessingSupported(hwc_layer_1_t &layer, int format,
        bool local_path, int loc_out_downscale)
{
    if (local_path && loc_out_downscale == 0)
        return false;

    if (isUsingMSC() && local_path)
        return false;

    private_handle_t *handle = private_handle_t::dynamicCast(layer.handle);

    int max_w = maxWidth(layer);
    int max_h = maxHeight(layer);
    int min_w = minWidth(layer);
    int min_h = minHeight(layer);
    int crop_max_w = 0;
    int crop_max_h = 0;

    if (isUsingMSC()) {
        crop_max_w = 8192;
        crop_max_h = 8192;
    } else {
        crop_max_w = isRotated(layer) ? 2016 : 4800;
        crop_max_h = isRotated(layer) ? 2016 : 3344;
    }
    int crop_min_w = isRotated(layer) ? 32: 64;
    int crop_min_h = isRotated(layer) ? 64: 32;

    int srcAlign = sourceAlign(handle->format);
    int dstAlign;
    if (local_path)
        dstAlign = destinationAlign(HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M);
    else
        dstAlign = destinationAlign(HAL_PIXEL_FORMAT_BGRA_8888);

    int maxDstWidth;
    int maxDstHeight;

    bool rot90or270 = !!(layer.transform & HAL_TRANSFORM_ROT_90);
    // n.b.: HAL_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_90 |
    //                               HAL_TRANSFORM_ROT_180

    int src_w = WIDTH(layer.sourceCropf), src_h = HEIGHT(layer.sourceCropf);
    int dest_w, dest_h;
    if (rot90or270) {
        dest_w = HEIGHT(layer.displayFrame);
        dest_h = WIDTH(layer.displayFrame);
    } else {
        dest_w = WIDTH(layer.displayFrame);
        dest_h = HEIGHT(layer.displayFrame);
    }

    if (getDrmMode(handle->flags) != NO_DRM)
        alignCropAndCenter(dest_w, dest_h, NULL,
                GSC_DST_CROP_W_ALIGNMENT_RGB888);

    int max_downscale = local_path ? loc_out_downscale : 16;
    maxDstWidth = 2560;
    maxDstHeight = 1600;
    int max_upscale = 8;

    /* check whether GSC can handle with local path */
    if (local_path) {
        /* GSC OTF can't handle rot90 or rot270 */
        if (!rotationSupported(rot90or270))
            return 0;
        /*
         * if display co-ordinates are out of the lcd resolution,
         * skip that scenario to OpenGL.
         * GSC OTF can't handle such scenarios.
         */
        if (layer.displayFrame.left < 0 || layer.displayFrame.top < 0 ||
            layer.displayFrame.right > mDisplay->mXres || layer.displayFrame.bottom > mDisplay->mYres)
            return 0;

        /* GSC OTF can't handle GRALLOC_USAGE_PROTECTED layer */
        if (getDrmMode(handle->flags) != NO_DRM)
            return 0;

        return isFormatSupportedByGsc(format) &&
            isFormatSupportedByGscOtf(format) &&
            mDisplay->mHwc->mS3DMode == S3D_MODE_DISABLED &&
            paritySupported(dest_w, dest_h) &&
            handle->stride <= max_w &&
            src_w <= dest_w * max_downscale &&
            dest_w <= maxDstWidth &&
            dest_w <= src_w * max_upscale &&
            handle->vstride <= max_h &&
            src_h <= dest_h * max_downscale &&
            dest_h <= maxDstHeight &&
            dest_h <= src_h * max_upscale &&
            src_w <= crop_max_w &&
            src_h <= crop_max_h &&
            src_w >= crop_min_w &&
            src_h >= crop_min_h;
     }

    bool need_gsc_op_twice = false;
    if (getDrmMode(handle->flags) != NO_DRM) {
        need_gsc_op_twice = ((dest_w > src_w * max_upscale) ||
                                   (dest_h > src_h * max_upscale)) ? true : false;
        if (need_gsc_op_twice)
            max_upscale = 8 * 8;
    } else {
        if (!mDisplay->mHasDrmSurface) {
            need_gsc_op_twice = false;
            max_upscale = 8;
        }
    }

    if (getDrmMode(handle->flags) != NO_DRM) {
        /* make even for gscaler */
        layer.sourceCropf.top = (unsigned int)layer.sourceCropf.top & ~1;
        layer.sourceCropf.left = (unsigned int)layer.sourceCropf.left & ~1;
        layer.sourceCropf.bottom = (unsigned int)layer.sourceCropf.bottom & ~1;
        layer.sourceCropf.right = (unsigned int)layer.sourceCropf.right & ~1;
    }

    /* check whether GSC can handle with M2M */
    return isFormatSupportedByGsc(format) &&
            src_w >= min_w &&
            src_h >= min_h &&
            isDstCropWidthAligned(dest_w) &&
            handle->stride <= max_w &&
            handle->stride % srcAlign == 0 &&
            src_w < dest_w * max_downscale &&
            dest_w <= src_w * max_upscale &&
            handle->vstride <= max_h &&
            handle->vstride % srcAlign == 0 &&
            src_h < dest_h * max_downscale &&
            dest_h <= src_h * max_upscale &&
            // per 46.2
            (!rot90or270 || (unsigned int)layer.sourceCropf.top % 2 == 0) &&
            (!rot90or270 || (unsigned int)layer.sourceCropf.left % 2 == 0) &&
            src_w <= crop_max_w &&
            src_h <= crop_max_h &&
            src_w >= crop_min_w &&
            src_h >= crop_min_h;
            // per 46.3.1.6
}