Port Cocoa plugin to new backing store interface.
This commit is contained in:
parent
6ce6b8a378
commit
cf1a53cf3c
@ -4,7 +4,7 @@ DESTDIR = $$QT.gui.plugins/platforms
|
||||
|
||||
OBJECTIVE_SOURCES = main.mm \
|
||||
qcocoaintegration.mm \
|
||||
qcocoawindowsurface.mm \
|
||||
qcocoabackingstore.mm \
|
||||
qcocoawindow.mm \
|
||||
qnsview.mm \
|
||||
qcocoaautoreleasepool.mm \
|
||||
@ -14,7 +14,7 @@ OBJECTIVE_SOURCES = main.mm \
|
||||
|
||||
|
||||
OBJECTIVE_HEADERS = qcocoaintegration.h \
|
||||
qcocoawindowsurface.h \
|
||||
qcocoabackingstore.h \
|
||||
qcocoawindow.h \
|
||||
qnsview.h \
|
||||
qcocoaautoreleasepool.h \
|
||||
|
@ -39,27 +39,27 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QWINDOWSURFACE_COCOA_H
|
||||
#define QWINDOWSURFACE_COCOA_H
|
||||
#ifndef QBACKINGSTORE_COCOA_H
|
||||
#define QBACKINGSTORE_COCOA_H
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
#include "qcocoawindow.h"
|
||||
#include "qnsview.h"
|
||||
|
||||
#include <QtGui/private/qwindowsurface_p.h>
|
||||
#include <QPlatformBackingStore>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QCocoaWindowSurface : public QWindowSurface
|
||||
class QCocoaBackingStore : public QPlatformBackingStore
|
||||
{
|
||||
public:
|
||||
QCocoaWindowSurface(QWindow *window, WId wid);
|
||||
~QCocoaWindowSurface();
|
||||
QCocoaBackingStore(QWindow *window);
|
||||
~QCocoaBackingStore();
|
||||
|
||||
QPaintDevice *paintDevice();
|
||||
void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset);
|
||||
void resize (const QSize &size);
|
||||
void resize (const QSize &size, const QRegion &);
|
||||
|
||||
private:
|
||||
QCocoaWindow *m_cocoaWindow;
|
@ -39,7 +39,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qcocoawindowsurface.h"
|
||||
#include "qcocoabackingstore.h"
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtGui/QPainter>
|
||||
@ -55,10 +55,9 @@ QRect flipedRect(const QRect &sourceRect,int height)
|
||||
return flippedRect;
|
||||
}
|
||||
|
||||
QCocoaWindowSurface::QCocoaWindowSurface(QWindow *window, WId wId)
|
||||
: QWindowSurface(window)
|
||||
QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
|
||||
: QPlatformBackingStore(window)
|
||||
{
|
||||
Q_UNUSED(wId);
|
||||
m_cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
|
||||
|
||||
const QRect geo = window->geometry();
|
||||
@ -67,17 +66,17 @@ QCocoaWindowSurface::QCocoaWindowSurface(QWindow *window, WId wId)
|
||||
m_image = new QImage(window->geometry().size(),QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
QCocoaWindowSurface::~QCocoaWindowSurface()
|
||||
QCocoaBackingStore::~QCocoaBackingStore()
|
||||
{
|
||||
delete m_image;
|
||||
}
|
||||
|
||||
QPaintDevice *QCocoaWindowSurface::paintDevice()
|
||||
QPaintDevice *QCocoaBackingStore::paintDevice()
|
||||
{
|
||||
return m_image;
|
||||
}
|
||||
|
||||
void QCocoaWindowSurface::flush(QWindow *widget, const QRegion ®ion, const QPoint &offset)
|
||||
void QCocoaBackingStore::flush(QWindow *widget, const QRegion ®ion, const QPoint &offset)
|
||||
{
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(offset);
|
||||
@ -88,9 +87,8 @@ void QCocoaWindowSurface::flush(QWindow *widget, const QRegion ®ion, const QP
|
||||
[m_cocoaWindow->m_windowSurfaceView displayRect:rect];
|
||||
}
|
||||
|
||||
void QCocoaWindowSurface::resize(const QSize &size)
|
||||
void QCocoaBackingStore::resize(const QSize &size, const QRegion &)
|
||||
{
|
||||
QWindowSurface::resize(size);
|
||||
delete m_image;
|
||||
m_image = new QImage(size,QImage::Format_ARGB32_Premultiplied);
|
||||
NSSize newSize = NSMakeSize(size.width(),size.height());
|
@ -79,7 +79,7 @@ public:
|
||||
QPixmapData *createPixmapData(QPixmapData::PixelType type) const;
|
||||
QPlatformWindow *createPlatformWindow(QWindow *window) const;
|
||||
QPlatformGLContext *createPlatformGLContext(const QGuiGLFormat &glFormat, QPlatformGLContext *share) const;
|
||||
QWindowSurface *createWindowSurface(QWindow *widget, WId winId) const;
|
||||
QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const;
|
||||
|
||||
QList<QPlatformScreen *> screens() const { return mScreens; }
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "qcocoaintegration.h"
|
||||
|
||||
#include "qcocoawindow.h"
|
||||
#include "qcocoawindowsurface.h"
|
||||
#include "qcocoabackingstore.h"
|
||||
#include "qcocoanativeinterface.h"
|
||||
|
||||
#include <QtPlatformSupport/5.0.0/QtPlatformSupport/private/qbasicunixfontdatabase_p.h>
|
||||
@ -117,9 +117,9 @@ QPlatformGLContext *QCocoaIntegration::createPlatformGLContext(const QGuiGLForma
|
||||
return new QCocoaGLContext(glFormat, share);
|
||||
}
|
||||
|
||||
QWindowSurface *QCocoaIntegration::createWindowSurface(QWindow *window, WId winId) const
|
||||
QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *window) const
|
||||
{
|
||||
return new QCocoaWindowSurface(window, winId);
|
||||
return new QCocoaBackingStore(window, winId);
|
||||
}
|
||||
|
||||
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
QCocoaGLContext *currentContext() const;
|
||||
|
||||
private:
|
||||
friend class QCocoaWindowSurface;
|
||||
friend class QCocoaBackingStore;
|
||||
NSWindow *m_nsWindow;
|
||||
QNSView *m_contentView;
|
||||
NSView *m_windowSurfaceView;
|
||||
|
Loading…
Reference in New Issue
Block a user