XRenderPicture::XRenderPicture(QPixmap pix)
{
    if (Extensions::nonNativePixmaps()) {
        Pixmap xPix = XCreatePixmap(display(), rootWindow(), pix.width(), pix.height(), pix.depth());
        QPixmap tempPix = QPixmap::fromX11Pixmap(xPix, QPixmap::ExplicitlyShared);
        tempPix.fill(Qt::transparent);
        QPainter p(&tempPix);
        p.drawPixmap(QPoint(0, 0), pix);
        p.end();
        d = new XRenderPictureData(createPicture(tempPix.handle(), tempPix.depth()));
        XFreePixmap(display(), xPix);
    } else {
        d = new XRenderPictureData(createPicture(pix.handle(), pix.depth()));
    }
}
Esempio n. 2
0
Decode_Status VaapiDecoderFake::decode(VideoDecodeBuffer *buffer)
{
    if (m_first) {
        m_first = false;
        return DECODE_FORMAT_CHANGE;
    }
    PicturePtr picture = createPicture(buffer->timeStamp);
    if (!picture)
        return DECODE_MEMORY_FAIL;
    return outputPicture(picture);
}
Esempio n. 3
0
bool VaapiDecoderVP8::allocNewPicture()
{
    m_currentPicture = createPicture(m_currentPTS);

    if (!m_currentPicture)
        return false;

    DEBUG ("alloc new picture: %p with surface ID: %x",
         m_currentPicture.get(), m_currentPicture->getSurfaceID());

    return true;
}
Esempio n. 4
0
void initMenuRender()
{

    Background = createPicture(BACKGROUNDPATH,0,0,1);

    choixJeu = createButton("Play",100,150,5);
    choixStat = createButton("Statistic",100,210,5);
    choixQuit = createButton("Exit",100,270,5);

    choixJeu.callback = *CMode;
    choixQuit.callback = *CGameQuit;
    choixStat.callback = *CStat;

    renderinitialised=1;
}
void RenderSVGResourceClipper::drawClipMaskContent(GraphicsContext* context, const FloatRect& targetBoundingBox)
{
    ASSERT(context);

    AffineTransform contentTransformation;
    if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
        contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox.y());
        contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetBoundingBox.height());
        context->concatCTM(contentTransformation);
    }

    if (!m_clipContentPicture) {
        SubtreeContentTransformScope contentTransformScope(contentTransformation);
        createPicture(context);
    }

    context->drawPicture(m_clipContentPicture.get());
}
Esempio n. 6
0
bool VaapiDecoderVP8::allocNewPicture()
{
    m_currentPicture = createPicture(m_currentPTS);

    if (!m_currentPicture)
        return false;

    SurfacePtr surface = m_currentPicture->getSurface();
    ASSERT(m_frameWidth && m_frameHeight);
    if (!surface->resize(m_frameWidth, m_frameHeight)) {
        ASSERT(0 && "frame size is bigger than internal surface resolution");
        return false;
    }

    DEBUG ("alloc new picture: %p with surface ID: %x",
         m_currentPicture.get(), m_currentPicture->getSurfaceID());

    return true;
}
Esempio n. 7
0
Decode_Status VaapiDecoderH265::decodeSlice(H265NalUnit *nalu)
{
    SharedPtr<H265SliceHdr> currSlice(new H265SliceHdr(), h265SliceHdrFree);
    H265SliceHdr* slice = currSlice.get();
    H265ParserResult result;
    Decode_Status status;

    memset(slice, 0, sizeof(H265SliceHdr));
    result = h265_parser_parse_slice_hdr(m_parser, nalu, slice);
    if (result == H265_PARSER_ERROR) {
        return DECODE_INVALID_DATA;
    }
    if (result == H265_PARSER_BROKEN_LINK) {
        return DECODE_SUCCESS;
    }
    status = ensureContext(slice->pps->sps);
    if (status != DECODE_SUCCESS) {
        return status;
    }
    if (slice->first_slice_segment_in_pic_flag) {
        status = decodeCurrent();
        if (status != DECODE_SUCCESS)
            return status;
        m_current = createPicture(slice, nalu);
        if (m_noRaslOutputFlag && isRasl(nalu))
            return DECODE_SUCCESS;
        if (!m_current || !m_dpb.init(m_current, slice, nalu, m_newStream))
            return DECODE_INVALID_DATA;
        if (!fillPicture(m_current, slice) || !fillIqMatrix(m_current, slice))
            return DECODE_FAIL;
    }
    if (!m_current)
        return DECODE_FAIL;
    if (!fillSlice(m_current, slice, nalu))
        return DECODE_FAIL;
    if (!slice->dependent_slice_segment_flag)
        std::swap(currSlice, m_prevSlice);
    return status;

}
Esempio n. 8
0
Decode_Status VaapiDecoderVP9::decode(const Vp9FrameHdr* hdr, const uint8_t* data, uint32_t size, uint64_t timeStamp)
{


    Decode_Status ret;
    ret = ensureContext(hdr);
    if (ret != DECODE_SUCCESS)
        return ret;

    PicturePtr picture = createPicture(timeStamp);
    if (!picture)
        return DECODE_MEMORY_FAIL;
    if (!picture->getSurface()->resize(hdr->width, hdr->height)) {
        ERROR("resize to %dx%d failed", hdr->width, hdr->height);
        return DECODE_MEMORY_FAIL;
    }

    if (hdr->show_existing_frame) {
        SurfacePtr& surface = m_reference[hdr->frame_to_show];
        if (!surface) {
            ERROR("frame to show is invalid, idx = %d", hdr->frame_to_show);
            return DECODE_SUCCESS;
        }
        picture->setSurface(surface);
        return outputPicture(picture);
    }

    if (!ensurePicture(picture, hdr))
        return DECODE_FAIL;
    if (!ensureSlice(picture, data, size))
        return DECODE_FAIL;
    ret = picture->decode();
    if (ret != DECODE_SUCCESS)
        return ret;
    updateReference(picture, hdr);
    if (hdr->show_frame)
        return outputPicture(picture);
    return DECODE_SUCCESS;
}
Esempio n. 9
0
void XImlib2Image::createWindow()
{	
    createPicture();

    DesktopConfig * dConfig =
		    dynamic_cast<DesktopConfig *>(config);
    

    XSetWindowAttributes attr;
    attr.background_pixmap = ParentRelative;
    attr.backing_store = Always;
    attr.override_redirect = True;
    attr.save_under = True;
    attr.cursor = XCreateFontCursor(display, dConfig->getCursorOver());
  
    attr.event_mask = SubstructureRedirectMask |
                      SubstructureNotifyMask   |
                      ButtonPressMask          |
                      ButtonReleaseMask        |
                      PointerMotionMask        |
                      EnterWindowMask          |
                      PropertyChangeMask       |
                      LeaveWindowMask           |
                      ExposureMask;
    
    window = XCreateWindow( display,
                            rootWindow,
                            0,
                            0,
                            width,
                            height,
                            0,
                            depth,
                            CopyFromParent,
                            CopyFromParent,
			    CWSaveUnder|CWBackPixmap|CWBackingStore|CWOverrideRedirect|CWEventMask| CWCursor,
                            &attr );  
    shapeWindow();
}
Esempio n. 10
0
XRenderPicture::XRenderPicture(Pixmap pix, int depth)
    : d(new XRenderPictureData(createPicture(pix, depth)))
{
}
Esempio n. 11
0
XRenderPicture::XRenderPicture( QPixmap pix )
    : d( new XRenderPictureData( createPicture( pix.handle(), pix.depth())))
    {
    }
Esempio n. 12
0
void PreviewCursor::load(const QString &name, const QString &theme)
{
    Display *dpy = QPaintDevice::x11AppDisplay();

    if(m_pict)
        XRenderFreePicture(dpy, m_pict);
    if(m_handle)
        XFreeCursor(dpy, m_handle);
    m_pict = 0;
    m_handle = 0;
    m_width = m_height = 0;

    // Load the preview cursor image
    XcursorImage *image = XcursorLibraryLoadImage(name.latin1(), theme.latin1(), previewSize);

    // If the theme doesn't have this cursor, load the default cursor for now
    if(!image)
        image = XcursorLibraryLoadImage("left_ptr", theme.latin1(), previewSize);

    // TODO The old classic X cursors
    if(!image)
        return;

    // Auto-crop the image (some cursor themes use a fixed image size
    //   for all cursors, and doing this results in correctly centered images)
    cropCursorImage(image);

    m_pict = createPicture(image);
    m_width = image->width;
    m_height = image->height;

    // Scale the image if its height is greater than 2x the requested size
    if(m_height > previewSize * 2.0)
    {
        double factor = double(previewSize * 2.0 / m_height);
        XTransform xform = {{{XDoubleToFixed(1.0), XDoubleToFixed(0), XDoubleToFixed(0)},
                             {XDoubleToFixed(0), XDoubleToFixed(1.0), XDoubleToFixed(0)},
                             {XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(factor)}}};
        XRenderSetPictureTransform(dpy, m_pict, &xform);
        m_width = int(m_width * factor);
        m_height = int(m_height * factor);
    }

    // We don't need this image anymore
    XcursorImageDestroy(image);

    // Load the actual cursor we will use
    int size = XcursorGetDefaultSize(dpy);
    XcursorImages *images = XcursorLibraryLoadImages(name.latin1(), theme.latin1(), size);

    if(images)
    {
        m_handle = XcursorImagesLoadCursor(dpy, images);
        XcursorImagesDestroy(images);
    }
    else
    {
        images = XcursorLibraryLoadImages("left_ptr", theme.latin1(), size);
        m_handle = XcursorImagesLoadCursor(dpy, images);
        XcursorImagesDestroy(images);
    }
}