From d8fc8aa585ed791ea90a52b953dbd7335248e845 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 11 Sep 2011 14:54:20 +0200 Subject: [directfb] Rename class from WindowSurface to BackingStore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Catch up with the naming by renaming the file from windowsurface to backingstore, update the class names and include files. Change-Id: I1b16826b60c19490946a77f61518e18f8099adce Reviewed-by: Jørgen Lind --- src/plugins/platforms/directfb/directfb.pro | 4 +- .../platforms/directfb/qdirectfbbackingstore.cpp | 140 +++++++++++++++++++++ .../platforms/directfb/qdirectfbbackingstore.h | 77 ++++++++++++ .../platforms/directfb/qdirectfbintegration.cpp | 4 +- src/plugins/platforms/directfb/qdirectfbwindow.cpp | 2 +- .../platforms/directfb/qdirectfbwindowsurface.cpp | 140 --------------------- .../platforms/directfb/qdirectfbwindowsurface.h | 77 ------------ 7 files changed, 222 insertions(+), 222 deletions(-) create mode 100644 src/plugins/platforms/directfb/qdirectfbbackingstore.cpp create mode 100644 src/plugins/platforms/directfb/qdirectfbbackingstore.h delete mode 100644 src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp delete mode 100644 src/plugins/platforms/directfb/qdirectfbwindowsurface.h (limited to 'src/plugins') diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 2ec4efabc8..af95bd372c 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -16,14 +16,14 @@ LIBS += $$DIRECTFB_LIBS SOURCES = main.cpp \ qdirectfbintegration.cpp \ - qdirectfbwindowsurface.cpp \ + qdirectfbbackingstore.cpp \ qdirectfbblitter.cpp \ qdirectfbconvenience.cpp \ qdirectfbinput.cpp \ qdirectfbcursor.cpp \ qdirectfbwindow.cpp HEADERS = qdirectfbintegration.h \ - qdirectfbwindowsurface.h \ + qdirectfbbackingstore.h \ qdirectfbblitter.h \ qdirectfbconvenience.h \ qdirectfbinput.h \ diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp new file mode 100644 index 0000000000..736c9bc8c9 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdirectfbbackingstore.h" +#include "qdirectfbintegration.h" +#include "qdirectfbblitter.h" +#include "qdirectfbconvenience.h" +#include + +#include + +QT_BEGIN_NAMESPACE + +QDirectFbBackingStore::QDirectFbBackingStore(QWindow *window) + : QPlatformBackingStore(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) +{ + + IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); + + DFBWindowID id(window->winId()); + IDirectFBWindow *dfbWindow; + + layer->GetWindow(layer,id,&dfbWindow); + + dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); +//WRONGSIZE + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface); + m_pmdata = new QDirectFbBlitterPlatformPixmap; + m_pmdata->setBlittable(blitter); + m_pixmap = new QPixmap(m_pmdata); +} + +QDirectFbBackingStore::~QDirectFbBackingStore() +{ + delete m_pixmap; +} + +QPaintDevice *QDirectFbBackingStore::paintDevice() +{ + return m_pixmap; +} + +void QDirectFbBackingStore::flush(QWindow *, const QRegion ®ion, const QPoint &offset) +{ + m_pmdata->blittable()->unlock(); + + QVector rects = region.rects(); + for (int i = 0 ; i < rects.size(); i++) { + const QRect rect = rects.at(i); + DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; + m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); + } +} + +void QDirectFbBackingStore::resize(const QSize &size, const QRegion& reg) +{ + QPlatformBackingStore::resize(size, reg); + + //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable + m_dfbSurface->AddRef(m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(size,m_dfbSurface); + m_pmdata->setBlittable(blitter); +} + +static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) +{ + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); + const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; + surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); +} + +bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy) +{ + m_pmdata->blittable()->unlock(); + + if (!m_dfbSurface || area.isEmpty()) + return false; + m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); + if (area.rectCount() == 1) { + scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); + } else { + const QVector rects = area.rects(); + const int n = rects.size(); + for (int i=0; i +#include + +#include + +QT_BEGIN_NAMESPACE + +class QDirectFbBackingStore : public QPlatformBackingStore +{ +public: + QDirectFbBackingStore(QWindow *window); + ~QDirectFbBackingStore(); + + QPaintDevice *paintDevice(); + void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size, const QRegion &staticContents); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + void lockSurfaceToImage(); + + QPixmap *m_pixmap; + QBlittablePlatformPixmap *m_pmdata; + + IDirectFBSurface *m_dfbSurface; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 803d2f5dac..ab0db78a40 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qdirectfbintegration.h" -#include "qdirectfbwindowsurface.h" +#include "qdirectfbbackingstore.h" #include "qdirectfbblitter.h" #include "qdirectfbconvenience.h" #include "qdirectfbcursor.h" @@ -143,7 +143,7 @@ QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const QPlatformBackingStore *QDirectFbIntegration::createPlatformBackingStore(QWindow *window) const { - return new QDirectFbWindowSurface(window); + return new QDirectFbBackingStore(window); } QPlatformFontDatabase *QDirectFbIntegration::fontDatabase() const diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index e75291b5c1..c81c6d74da 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -42,7 +42,7 @@ #include "qdirectfbwindow.h" #include "qdirectfbinput.h" -#include "qdirectfbwindowsurface.h" +#include "qdirectfbbackingstore.h" #include diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp deleted file mode 100644 index ab355c48f4..0000000000 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdirectfbwindowsurface.h" -#include "qdirectfbintegration.h" -#include "qdirectfbblitter.h" -#include "qdirectfbconvenience.h" -#include - -#include - -QT_BEGIN_NAMESPACE - -QDirectFbWindowSurface::QDirectFbWindowSurface(QWindow *window) - : QPlatformBackingStore(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) -{ - - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - - DFBWindowID id(window->winId()); - IDirectFBWindow *dfbWindow; - - layer->GetWindow(layer,id,&dfbWindow); - - dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); -//WRONGSIZE - QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface); - m_pmdata = new QDirectFbBlitterPlatformPixmap; - m_pmdata->setBlittable(blitter); - m_pixmap = new QPixmap(m_pmdata); -} - -QDirectFbWindowSurface::~QDirectFbWindowSurface() -{ - delete m_pixmap; -} - -QPaintDevice *QDirectFbWindowSurface::paintDevice() -{ - return m_pixmap; -} - -void QDirectFbWindowSurface::flush(QWindow *, const QRegion ®ion, const QPoint &offset) -{ - m_pmdata->blittable()->unlock(); - - QVector rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); - DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; - m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); - } -} - -void QDirectFbWindowSurface::resize(const QSize &size, const QRegion& reg) -{ - QPlatformBackingStore::resize(size, reg); - - //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable - m_dfbSurface->AddRef(m_dfbSurface); - QDirectFbBlitter *blitter = new QDirectFbBlitter(size,m_dfbSurface); - m_pmdata->setBlittable(blitter); -} - -static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) -{ - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; - surface->Flip(surface, ®ion, DFBSurfaceFlipFlags(DSFLIP_BLIT)); -} - -bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - m_pmdata->blittable()->unlock(); - - if (!m_dfbSurface || area.isEmpty()) - return false; - m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); - if (area.rectCount() == 1) { - scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); - } else { - const QVector rects = area.rects(); - const int n = rects.size(); - for (int i=0; i -#include - -#include - -QT_BEGIN_NAMESPACE - -class QDirectFbWindowSurface : public QPlatformBackingStore -{ -public: - QDirectFbWindowSurface(QWindow *window); - ~QDirectFbWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - void resize (const QSize &size, const QRegion &staticContents); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - void lockSurfaceToImage(); - - QPixmap *m_pixmap; - QBlittablePlatformPixmap *m_pmdata; - - IDirectFBSurface *m_dfbSurface; -}; - -QT_END_NAMESPACE - -#endif -- cgit v1.2.3