equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the plugins of the Qt Toolkit. |
7 ** This file is part of the plugins of the Qt Toolkit. |
8 ** |
8 ** |
468 const QSize size = transform.mapRect(QRect(0, 0, w, h)).size(); |
468 const QSize size = transform.mapRect(QRect(0, 0, w, h)).size(); |
469 if (size.isEmpty()) |
469 if (size.isEmpty()) |
470 return QPixmap(); |
470 return QPixmap(); |
471 |
471 |
472 QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); |
472 QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType); |
|
473 data->setSerialNumber(++global_ser_no); |
473 DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; |
474 DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; |
474 data->alpha = alpha; |
475 data->alpha = alpha; |
475 if (alpha) { |
476 if (alpha) { |
476 flags = DSBLIT_BLEND_ALPHACHANNEL; |
477 flags = DSBLIT_BLEND_ALPHACHANNEL; |
477 } |
478 } |
549 Q_ASSERT(lockFlgs); |
550 Q_ASSERT(lockFlgs); |
550 Q_ASSERT(!lockedImage.isNull()); |
551 Q_ASSERT(!lockedImage.isNull()); |
551 return &lockedImage; |
552 return &lockedImage; |
552 } |
553 } |
553 |
554 |
|
555 |
|
556 bool QDirectFBPixmapData::scroll(int dx, int dy, const QRect &rect) |
|
557 { |
|
558 if (!dfbSurface) { |
|
559 return false; |
|
560 } |
|
561 unlockSurface(); |
|
562 DFBResult result = dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); |
|
563 if (result != DFB_OK) { |
|
564 DirectFBError("QDirectFBPixmapData::scroll", result); |
|
565 return false; |
|
566 } |
|
567 result = dfbSurface->SetPorterDuff(dfbSurface, DSPD_NONE); |
|
568 if (result != DFB_OK) { |
|
569 DirectFBError("QDirectFBPixmapData::scroll", result); |
|
570 return false; |
|
571 } |
|
572 |
|
573 const DFBRectangle source = { rect.x(), rect.y(), rect.width(), rect.height() }; |
|
574 result = dfbSurface->Blit(dfbSurface, dfbSurface, &source, source.x + dx, source.y + dy); |
|
575 if (result != DFB_OK) { |
|
576 DirectFBError("QDirectFBPixmapData::scroll", result); |
|
577 return false; |
|
578 } |
|
579 |
|
580 return true; |
|
581 } |
|
582 |
554 void QDirectFBPixmapData::invalidate() |
583 void QDirectFBPixmapData::invalidate() |
555 { |
584 { |
556 if (dfbSurface) { |
585 if (dfbSurface) { |
557 screen->releaseDFBSurface(dfbSurface); |
586 screen->releaseDFBSurface(dfbSurface); |
558 dfbSurface = 0; |
587 dfbSurface = 0; |
562 d = w = h = 0; |
591 d = w = h = 0; |
563 is_null = true; |
592 is_null = true; |
564 imageFormat = QImage::Format_Invalid; |
593 imageFormat = QImage::Format_Invalid; |
565 } |
594 } |
566 |
595 |
|
596 #ifndef QT_DIRECTFB_PLUGIN |
|
597 Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap) |
|
598 { |
|
599 const QPixmapData *data = pixmap.pixmapData(); |
|
600 if (!data || data->classId() != QPixmapData::DirectFBClass) |
|
601 return 0; |
|
602 const QDirectFBPixmapData *dfbData = static_cast<const QDirectFBPixmapData*>(data); |
|
603 return dfbData->directFBSurface(); |
|
604 } |
|
605 #endif |
|
606 |
567 QT_END_NAMESPACE |
607 QT_END_NAMESPACE |
568 |
608 |
569 #endif // QT_NO_QWS_DIRECTFB |
609 #endif // QT_NO_QWS_DIRECTFB |
570 |
|
571 |
|
572 |
|