remove windows and mac remains from opengl component

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-09-11 14:25:23 +00:00
parent 07891e9a41
commit 600e7127a0
13 changed files with 34 additions and 403 deletions

View file

@ -96,14 +96,6 @@ inline static bool isPowerOfTwo(uint x)
} }
#endif #endif
#if defined(Q_WS_WIN)
extern Q_GUI_EXPORT bool qt_cleartype_enabled;
#endif
#ifdef Q_WS_MAC
extern bool qt_applefontsmoothing_enabled;
#endif
#if !defined(QT_MAX_CACHED_GLYPH_SIZE) #if !defined(QT_MAX_CACHED_GLYPH_SIZE)
# define QT_MAX_CACHED_GLYPH_SIZE 64 # define QT_MAX_CACHED_GLYPH_SIZE 64
#endif #endif
@ -1569,14 +1561,6 @@ namespace {
} }
#if defined(Q_WS_WIN)
static bool fontSmoothingApproximately(qreal target)
{
extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp
return (qAbs(qt_fontsmoothing_gamma - target) < 0.2);
}
#endif
static inline qreal qt_sRGB_to_linear_RGB(qreal f) static inline qreal qt_sRGB_to_linear_RGB(qreal f)
{ {
return f > 0.04045 ? qPow((f + 0.055) / 1.055, 2.4) : f / 12.92; return f > 0.04045 ? qPow((f + 0.055) / 1.055, 2.4) : f / 12.92;
@ -1742,29 +1726,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
QBrush pensBrush = q->state()->pen.brush(); QBrush pensBrush = q->state()->pen.brush();
bool srgbFrameBufferEnabled = false;
if (pensBrush.style() == Qt::SolidPattern &&
(ctx->d_ptr->extension_flags & QGLExtensions::SRGBFrameBuffer)) {
#if defined(Q_WS_MAC)
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask)
#elif defined(Q_WS_WIN)
if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1))
#else
if (false)
#endif
{
QColor c = pensBrush.color();
qreal red = qt_sRGB_to_linear_RGB(c.redF());
qreal green = qt_sRGB_to_linear_RGB(c.greenF());
qreal blue = qt_sRGB_to_linear_RGB(c.blueF());
c = QColor::fromRgbF(red, green, blue, c.alphaF());
pensBrush.setColor(c);
glEnable(FRAMEBUFFER_SRGB_EXT);
srgbFrameBufferEnabled = true;
}
}
setBrush(pensBrush); setBrush(pensBrush);
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) { if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
@ -1881,10 +1842,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
#else #else
glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data());
#endif #endif
if (srgbFrameBufferEnabled)
glDisable(FRAMEBUFFER_SRGB_EXT);
} }
void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
@ -2155,14 +2112,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
#if !defined(QT_OPENGL_ES_2) #if !defined(QT_OPENGL_ES_2)
#if defined(Q_WS_WIN) d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
if (qt_cleartype_enabled
&& (fontSmoothingApproximately(1.0) || fontSmoothingApproximately(2.1)))
#endif
#if defined(Q_WS_MAC)
if (qt_applefontsmoothing_enabled)
#endif
d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
#endif #endif
#if defined(QT_OPENGL_ES_2) #if defined(QT_OPENGL_ES_2)

View file

@ -49,10 +49,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifdef Q_WS_WIN
extern Q_GUI_EXPORT bool qt_cleartype_enabled;
#endif
QBasicAtomicInt qgltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); QBasicAtomicInt qgltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1);
QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix) QGLTextureGlyphCache::QGLTextureGlyphCache(const QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix)

View file

@ -55,8 +55,6 @@
#undef INT32 #undef INT32
#undef INT8 #undef INT8
#include "qx11info_x11.h" #include "qx11info_x11.h"
#elif defined(Q_WS_MAC)
# include <qt_mac_p.h>
#endif #endif
#include <qdatetime.h> #include <qdatetime.h>
@ -98,11 +96,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(Q_WS_X11) || defined(Q_WS_MAC) #if defined(Q_WS_X11)
QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs;
#endif
#ifdef Q_WS_X11
extern const QX11Info *qt_x11Info(const QPaintDevice *pd); extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
#endif #endif
@ -155,23 +150,6 @@ public:
} }
QPaintEngine::Type preferredPaintEngine() { QPaintEngine::Type preferredPaintEngine() {
#ifdef Q_WS_MAC
// The ATI X1600 driver for Mac OS X does not support return
// values from functions in GLSL. Since working around this in
// the GL2 engine would require a big, ugly rewrite, we're
// falling back to the GL 1 engine..
static bool mac_x1600_check_done = false;
if (!mac_x1600_check_done) {
QGLTemporaryContext *tmp = 0;
if (!QGLContext::currentContext())
tmp = new QGLTemporaryContext();
if (strstr((char *) glGetString(GL_RENDERER), "X1600"))
engineType = QPaintEngine::OpenGL;
if (tmp)
delete tmp;
mac_x1600_check_done = true;
}
#endif
if (engineType == QPaintEngine::MaxUser) { if (engineType == QPaintEngine::MaxUser) {
// No user-set engine - use the defaults // No user-set engine - use the defaults
#if defined(QT_OPENGL_ES_2) #if defined(QT_OPENGL_ES_2)
@ -1686,21 +1664,6 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
vi = 0; vi = 0;
screen = QX11Info::appScreen(); screen = QX11Info::appScreen();
#endif #endif
#if defined(Q_WS_WIN)
dc = 0;
win = 0;
threadId = 0;
pixelFormatId = 0;
cmap = 0;
hbitmap = 0;
hbitmap_hdc = 0;
#endif
#if defined(Q_WS_MAC)
# ifndef QT_MAC_USE_COCOA
update = false;
# endif
vi = 0;
#endif
#if !defined(QT_NO_EGL) #if !defined(QT_NO_EGL)
ownsEglContext = false; ownsEglContext = false;
eglContext = 0; eglContext = 0;
@ -2281,7 +2244,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu
} }
} }
#if defined(Q_WS_X11) || defined(Q_WS_MAC) #if defined(Q_WS_X11)
QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *) QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *)
{ {
return qt_extensionFuncs; return qt_extensionFuncs;
@ -3833,25 +3796,11 @@ QGLWidget::~QGLWidget()
#endif #endif
delete d->glcx; delete d->glcx;
d->glcx = 0; d->glcx = 0;
#if defined(Q_WS_WIN)
delete d->olcx;
d->olcx = 0;
#endif
#if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT) #if defined(GLX_MESA_release_buffers) && defined(QGL_USE_MESA_EXT)
if (doRelease) if (doRelease)
glXReleaseBuffersMESA(x11Display(), winId()); glXReleaseBuffersMESA(x11Display(), winId());
#endif #endif
d->cleanupColormaps(); d->cleanupColormaps();
#ifdef Q_WS_MAC
QWidget *current = parentWidget();
while (current) {
qt_widget_private(current)->glWidgets.removeAll(QWidgetPrivate::GlWidgetInfo(this));
if (current->isWindow())
break;
current = current->parentWidget();
};
#endif
} }
/*! /*!
@ -4243,45 +4192,6 @@ bool QGLWidget::event(QEvent *e)
d->recreateEglSurface(); d->recreateEglSurface();
} }
#endif #endif
#elif defined(Q_WS_WIN)
if (e->type() == QEvent::ParentChange) {
QGLContext *newContext = new QGLContext(d->glcx->requestedFormat(), this);
setContext(newContext, d->glcx);
// the overlay needs to be recreated as well
delete d->olcx;
if (isValid() && context()->format().hasOverlay()) {
d->olcx = new QGLContext(QGLFormat::defaultOverlayFormat(), this);
if (!d->olcx->create(isSharing() ? d->glcx : 0)) {
delete d->olcx;
d->olcx = 0;
d->glcx->d_func()->glFormat.setOverlay(false);
}
} else {
d->olcx = 0;
}
} else if (e->type() == QEvent::Show) {
if (!format().rgba())
d->updateColormap();
}
#elif defined(Q_WS_MAC)
if (e->type() == QEvent::MacGLWindowChange
#if 0 //(MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
&& ((QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 && isWindow())
|| QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
#endif
) {
if (d->needWindowChange) {
d->needWindowChange = false;
d->glcx->updatePaintDevice();
update();
}
return true;
# if defined(QT_MAC_USE_COCOA)
} else if (e->type() == QEvent::MacGLClearDrawable) {
d->glcx->d_ptr->clearDrawable();
# endif
}
#endif #endif
return QWidget::event(e); return QWidget::event(e);
@ -4394,9 +4304,6 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext)
QGLFormat fmt = d->glcx->requestedFormat(); QGLFormat fmt = d->glcx->requestedFormat();
fmt.setDirectRendering(false); // Direct is unlikely to work fmt.setDirectRendering(false); // Direct is unlikely to work
fmt.setDoubleBuffer(false); // We don't need dbl buf fmt.setDoubleBuffer(false); // We don't need dbl buf
#ifdef Q_WS_MAC // crash prevention on the Mac - it's unlikely to work anyway
fmt.setSampleBuffers(false);
#endif
QGLContext* ocx = d->glcx; QGLContext* ocx = d->glcx;
ocx->doneCurrent(); ocx->doneCurrent();
@ -4437,26 +4344,11 @@ QPixmap QGLWidget::renderPixmap(int w, int h, bool useContext)
QImage QGLWidget::grabFrameBuffer(bool withAlpha) QImage QGLWidget::grabFrameBuffer(bool withAlpha)
{ {
makeCurrent(); makeCurrent();
QImage res;
int w = width();
int h = height();
if (format().rgba()) { if (format().rgba()) {
res = qt_gl_read_framebuffer(QSize(w, h), format().alpha(), withAlpha); return qt_gl_read_framebuffer(size(), format().alpha(), withAlpha);
} else {
#if defined (Q_WS_WIN) && !defined(QT_OPENGL_ES)
res = QImage(w, h, QImage::Format_Indexed8);
glReadPixels(0, 0, w, h, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, res.bits());
const QVector<QColor> pal = QColormap::instance().colormap();
if (pal.size()) {
res.setColorCount(pal.size());
for (int i = 0; i < pal.size(); i++)
res.setColor(i, pal.at(i).rgb());
}
res = res.mirrored();
#endif
} }
return res; return QImage();
} }
@ -5427,28 +5319,19 @@ void QGLWidgetPrivate::initContext(QGLContext *context, const QGLWidget* shareWi
glcx = new QGLContext(QGLFormat::defaultFormat(), q); glcx = new QGLContext(QGLFormat::defaultFormat(), q);
} }
#if defined(Q_WS_X11) || defined(Q_WS_MAC) #if defined(Q_WS_X11)
Q_GLOBAL_STATIC(QString, qt_gl_lib_name) Q_GLOBAL_STATIC(QString, qt_gl_lib_name)
Q_OPENGL_EXPORT void qt_set_gl_library_name(const QString& name)
{
qt_gl_lib_name()->operator=(name);
}
Q_OPENGL_EXPORT const QString qt_gl_library_name() Q_OPENGL_EXPORT const QString qt_gl_library_name()
{ {
if (qt_gl_lib_name()->isNull()) { if (qt_gl_lib_name()->isNull()) {
#ifdef Q_WS_MAC #if defined(QT_OPENGL_ES_1)
return QLatin1String("/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib");
#else
# if defined(QT_OPENGL_ES_1)
return QLatin1String("GLES_CM"); return QLatin1String("GLES_CM");
# elif defined(QT_OPENGL_ES_2) #elif defined(QT_OPENGL_ES_2)
return QLatin1String("GLESv2"); return QLatin1String("GLESv2");
# else #else
return QLatin1String("GL"); return QLatin1String("GL");
# endif #endif
#endif // defined Q_WS_MAC
} }
return *qt_gl_lib_name(); return *qt_gl_lib_name();
} }

View file

@ -50,13 +50,7 @@
QT_BEGIN_HEADER QT_BEGIN_HEADER
#if defined(Q_WS_WIN) #if defined(QT_OPENGL_ES_1)
# include <QtCore/qt_windows.h>
#endif
#if defined(Q_WS_MAC)
# include <OpenGL/gl.h>
#elif defined(QT_OPENGL_ES_1)
# if defined(Q_OS_MAC) # if defined(Q_OS_MAC)
# include <OpenGLES/ES1/gl.h> # include <OpenGLES/ES1/gl.h>
# else # else
@ -86,37 +80,6 @@ typedef GLfloat GLdouble;
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(Q_WS_MAC) && defined (QT_BUILD_OPENGL_LIB) && !defined(QT_MAC_USE_COCOA)
#define Q_MAC_COMPAT_GL_FUNCTIONS
template <typename T>
struct QMacGLCompatTypes
{
typedef long CompatGLint;
typedef unsigned long CompatGLuint;
typedef unsigned long CompatGLenum;
};
template <>
struct QMacGLCompatTypes<long>
{
typedef int CompatGLint;
typedef unsigned int CompatGLuint;
typedef unsigned int CompatGLenum;
};
typedef QMacGLCompatTypes<GLint>::CompatGLint QMacCompatGLint;
typedef QMacGLCompatTypes<GLint>::CompatGLuint QMacCompatGLuint;
typedef QMacGLCompatTypes<GLint>::CompatGLenum QMacCompatGLenum;
#endif
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
class QGLCmap;
#endif
class QPixmap; class QPixmap;
#if defined(Q_WS_X11) && !defined(QT_OPENGL_ES) #if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
class QGLOverlayWidget; class QGLOverlayWidget;
@ -378,16 +341,10 @@ public:
protected: protected:
virtual bool chooseContext(const QGLContext* shareContext = 0); virtual bool chooseContext(const QGLContext* shareContext = 0);
#if defined(Q_WS_WIN)
virtual int choosePixelFormat(void* pfd, HDC pdc);
#endif
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1); virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
virtual void* chooseVisual(); virtual void* chooseVisual();
#endif #endif
#if defined(Q_WS_MAC)
virtual void* chooseMacVisual(GDHandle);
#endif
bool deviceIsPixmap() const; bool deviceIsPixmap() const;
bool windowCreated() const; bool windowCreated() const;
@ -427,13 +384,6 @@ private:
friend class QGLExtensions; friend class QGLExtensions;
friend class QGLTexture; friend class QGLTexture;
friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
#ifdef Q_WS_MAC
public:
void updatePaintDevice();
private:
friend class QMacGLWindowChangeEvent;
friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *);
#endif
friend class QGLFramebufferObject; friend class QGLFramebufferObject;
friend class QGLFramebufferObjectPrivate; friend class QGLFramebufferObjectPrivate;
friend class QGLFBOGLPaintDevice; friend class QGLFBOGLPaintDevice;
@ -560,9 +510,6 @@ protected:
private: private:
Q_DISABLE_COPY(QGLWidget) Q_DISABLE_COPY(QGLWidget)
#ifdef Q_WS_MAC
friend class QMacGLWindowChangeEvent;
#endif
friend class QGLDrawable; friend class QGLDrawable;
friend class QGLPixelBuffer; friend class QGLPixelBuffer;
friend class QGLPixelBufferPrivate; friend class QGLPixelBufferPrivate;

View file

@ -75,24 +75,6 @@ class QGLContext;
class QGLOverlayWidget; class QGLOverlayWidget;
class QPixmap; class QPixmap;
class QPixmapFilter; class QPixmapFilter;
#ifdef Q_WS_MAC
# ifdef qDebug
# define old_qDebug qDebug
# undef qDebug
# endif
QT_BEGIN_INCLUDE_NAMESPACE
#ifndef QT_MAC_USE_COCOA
# include <AGL/agl.h>
#endif
QT_END_INCLUDE_NAMESPACE
# ifdef old_qDebug
# undef qDebug
# define qDebug QT_NO_QDEBUG_MACRO
# undef old_qDebug
# endif
class QMacWindowChangeEvent;
#endif
#ifndef QT_NO_EGL #ifndef QT_NO_EGL
class QEglContext; class QEglContext;
#endif #endif
@ -187,18 +169,12 @@ public:
bool disable_clear_on_painter_begin; bool disable_clear_on_painter_begin;
#if defined(Q_WS_WIN) #if defined(Q_WS_X11)
void updateColormap();
QGLContext *olcx;
#elif defined(Q_WS_X11)
QGLOverlayWidget *olw; QGLOverlayWidget *olw;
#ifndef QT_NO_EGL #ifndef QT_NO_EGL
void recreateEglSurface(); void recreateEglSurface();
WId eglSurfaceWindowId; WId eglSurfaceWindowId;
#endif #endif
#elif defined(Q_WS_MAC)
QGLContext *olcx;
void updatePaintDevice();
#endif #endif
}; };
@ -332,20 +308,6 @@ public:
void syncGlState(); // Makes sure the GL context's state is what we think it is void syncGlState(); // Makes sure the GL context's state is what we think it is
void swapRegion(const QRegion &region); void swapRegion(const QRegion &region);
#if defined(Q_WS_WIN)
void updateFormatVersion();
#endif
#if defined(Q_WS_WIN)
HGLRC rc;
HDC dc;
WId win;
int pixelFormatId;
QGLCmap* cmap;
HBITMAP hbitmap;
HDC hbitmap_hdc;
Qt::HANDLE threadId;
#endif
#ifndef QT_NO_EGL #ifndef QT_NO_EGL
QEglContext *eglContext; QEglContext *eglContext;
EGLSurface eglSurface; EGLSurface eglSurface;
@ -355,13 +317,9 @@ public:
static void setExtraWindowSurfaceCreationProps(QEglProperties *props); static void setExtraWindowSurfaceCreationProps(QEglProperties *props);
#endif #endif
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
void* cx;
#endif
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
void* vi;
#endif
#if defined(Q_WS_X11) #if defined(Q_WS_X11)
void* cx;
void* vi;
void* pbuf; void* pbuf;
quint32 gpm; quint32 gpm;
int screen; int screen;
@ -370,11 +328,6 @@ public:
QGLContext::BindOptions options); QGLContext::BindOptions options);
static void destroyGlSurfaceForPixmap(QPixmapData*); static void destroyGlSurfaceForPixmap(QPixmapData*);
static void unbindPixmapFromTexture(QPixmapData*); static void unbindPixmapFromTexture(QPixmapData*);
#endif
#if defined(Q_WS_MAC)
bool update;
void *tryFormat(const QGLFormat &format);
void clearDrawable();
#endif #endif
QGLFormat glFormat; QGLFormat glFormat;
QGLFormat reqFormat; QGLFormat reqFormat;
@ -424,11 +377,7 @@ public:
static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; } static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; }
#ifdef Q_WS_WIN #if defined(Q_WS_X11)
static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); }
#endif
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
static Q_OPENGL_EXPORT QGLExtensionFuncs qt_extensionFuncs; static Q_OPENGL_EXPORT QGLExtensionFuncs qt_extensionFuncs;
static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *); static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *);
#endif #endif

View file

@ -54,18 +54,13 @@
// //
// extension prototypes // extension prototypes
#ifndef Q_WS_MAC #ifndef APIENTRYP
# ifndef APIENTRYP # ifdef APIENTRY
# ifdef APIENTRY # define APIENTRYP APIENTRY *
# define APIENTRYP APIENTRY * # else
# else # define APIENTRY
# define APIENTRY # define APIENTRYP *
# define APIENTRYP * # endif
# endif
# endif
#else
# define APIENTRY
# define APIENTRYP *
#endif #endif
#ifndef QT_NO_EGL #ifndef QT_NO_EGL

View file

@ -58,18 +58,13 @@ QT_BEGIN_NAMESPACE
typedef ptrdiff_t qgl_GLintptr; typedef ptrdiff_t qgl_GLintptr;
typedef ptrdiff_t qgl_GLsizeiptr; typedef ptrdiff_t qgl_GLsizeiptr;
#ifndef Q_WS_MAC #ifndef QGLF_APIENTRYP
# ifndef QGLF_APIENTRYP # ifdef QGLF_APIENTRY
# ifdef QGLF_APIENTRY # define QGLF_APIENTRYP QGLF_APIENTRY *
# define QGLF_APIENTRYP QGLF_APIENTRY * # else
# else # define QGLF_APIENTRY
# define QGLF_APIENTRY # define QGLF_APIENTRYP *
# define QGLF_APIENTRYP * # endif
# endif
# endif
#else
# define QGLF_APIENTRY
# define QGLF_APIENTRYP *
#endif #endif
struct QGLFunctionsPrivate; struct QGLFunctionsPrivate;

View file

@ -149,16 +149,10 @@ void QGLPixelBufferPrivate::common_init(const QSize &size, const QGLFormat &form
glDevice.setPBuffer(q); glDevice.setPBuffer(q);
qctx->d_func()->paintDevice = q; qctx->d_func()->paintDevice = q;
qctx->d_func()->valid = true; qctx->d_func()->valid = true;
#if defined(Q_WS_WIN) && !defined(QT_OPENGL_ES) #if defined(Q_WS_X11) && defined(QT_NO_EGL)
qctx->d_func()->dc = dc;
qctx->d_func()->rc = ctx;
#elif (defined(Q_WS_X11) && defined(QT_NO_EGL))
qctx->d_func()->cx = ctx; qctx->d_func()->cx = ctx;
qctx->d_func()->pbuf = (void *) pbuf; qctx->d_func()->pbuf = (void *) pbuf;
qctx->d_func()->vi = 0; qctx->d_func()->vi = 0;
#elif defined(Q_WS_MAC)
qctx->d_func()->cx = ctx;
qctx->d_func()->vi = 0;
#elif !defined(QT_NO_EGL) #elif !defined(QT_NO_EGL)
qctx->d_func()->eglContext = ctx; qctx->d_func()->eglContext = ctx;
qctx->d_func()->eglSurface = pbuf; qctx->d_func()->eglSurface = pbuf;
@ -269,7 +263,7 @@ bool QGLPixelBuffer::doneCurrent()
\sa size() \sa size()
*/ */
#if (defined(Q_WS_X11) || defined(Q_WS_WIN)) && defined(QT_NO_EGL) #if defined(Q_WS_X11) && defined(QT_NO_EGL)
GLuint QGLPixelBuffer::generateDynamicTexture() const GLuint QGLPixelBuffer::generateDynamicTexture() const
{ {
Q_D(const QGLPixelBuffer); Q_D(const QGLPixelBuffer);

View file

@ -125,8 +125,6 @@ struct GLXFBConfig {
#endif // Q_OS_HPUX #endif // Q_OS_HPUX
#elif defined(Q_WS_WIN)
DECLARE_HANDLE(HPBUFFERARB);
#elif !defined(QT_NO_EGL) #elif !defined(QT_NO_EGL)
#include <QtGui/qegl_p.h> #include <QtGui/qegl_p.h>
#endif #endif
@ -152,11 +150,6 @@ class QGLPixelBufferPrivate {
public: public:
QGLPixelBufferPrivate(QGLPixelBuffer *q) : q_ptr(q), invalid(true), qctx(0), pbuf(0), ctx(0) QGLPixelBufferPrivate(QGLPixelBuffer *q) : q_ptr(q), invalid(true), qctx(0), pbuf(0), ctx(0)
{ {
#ifdef Q_WS_WIN
dc = 0;
#elif defined(Q_WS_MACX)
share_ctx = 0;
#endif
} }
bool init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget); bool init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget);
void common_init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget); void common_init(const QSize &size, const QGLFormat &f, QGLWidget *shareWidget);
@ -175,23 +168,6 @@ public:
#if defined(Q_WS_X11) && defined(QT_NO_EGL) #if defined(Q_WS_X11) && defined(QT_NO_EGL)
GLXPbuffer pbuf; GLXPbuffer pbuf;
GLXContext ctx; GLXContext ctx;
#elif defined(Q_WS_WIN)
HDC dc;
bool has_render_texture :1;
#if !defined(QT_OPENGL_ES)
HPBUFFERARB pbuf;
HGLRC ctx;
#endif
#elif defined(Q_WS_MACX)
# ifdef QT_MAC_USE_COCOA
void *pbuf;
void *ctx;
void *share_ctx;
# else
AGLPbuffer pbuf;
AGLContext ctx;
AGLContext share_ctx;
# endif
#endif #endif
#ifndef QT_NO_EGL #ifndef QT_NO_EGL
EGLSurface pbuf; EGLSurface pbuf;

View file

@ -64,14 +64,6 @@ QPixmapData *QGLGraphicsSystem::createPixmapData(QPixmapData::PixelType type) co
QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const QWindowSurface *QGLGraphicsSystem::createWindowSurface(QWidget *widget) const
{ {
#ifdef Q_WS_WIN
// On Windows the QGLWindowSurface class can't handle
// drop shadows and native effects, e.g. fading a menu in/out using
// top level window opacity.
if (widget->windowType() == Qt::Popup)
return new QRasterWindowSurface(widget);
#endif
#if defined(Q_WS_X11) && !defined(QT_NO_EGL) #if defined(Q_WS_X11) && !defined(QT_NO_EGL)
if (m_useX11GL && QX11GLPixmapData::hasX11GLPixmaps()) { if (m_useX11GL && QX11GLPixmapData::hasX11GLPixmaps()) {
// If the widget is a QGraphicsView which will be re-drawing the entire // If the widget is a QGraphicsView which will be re-drawing the entire

View file

@ -4101,12 +4101,7 @@ void QOpenGLPaintEngine::drawTextureRect(int tx_width, int tx_height, const QRec
#endif #endif
} }
#ifdef Q_WS_WIN Qt::HANDLE QOpenGLPaintEngine::handle() const
HDC
#else
Qt::HANDLE
#endif
QOpenGLPaintEngine::handle() const
{ {
return 0; return 0;
} }
@ -4196,16 +4191,7 @@ void QGLGlyphCache::fontEngineDestroyed(QObject *o)
quint64 font_key = (reinterpret_cast<quint64>(ctx) << 32) | reinterpret_cast<quint64>(fe); quint64 font_key = (reinterpret_cast<quint64>(ctx) << 32) | reinterpret_cast<quint64>(fe);
QGLFontTexture *tex = qt_font_textures.take(font_key); QGLFontTexture *tex = qt_font_textures.take(font_key);
if (tex) { if (tex) {
#ifdef Q_WS_MAC glDeleteTextures(1, &tex->texture);
if (
# ifndef QT_MAC_USE_COCOA
aglGetCurrentContext() != 0
# else
qt_current_nsopengl_context() != 0
# endif
)
#endif
glDeleteTextures(1, &tex->texture);
delete tex; delete tex;
} }
} }
@ -4229,16 +4215,7 @@ void QGLGlyphCache::cleanupContext(const QGLContext *ctx)
quint64 font_key = (reinterpret_cast<quint64>(ctx) << 32) | reinterpret_cast<quint64>(fe); quint64 font_key = (reinterpret_cast<quint64>(ctx) << 32) | reinterpret_cast<quint64>(fe);
QGLFontTexture *font_tex = qt_font_textures.take(font_key); QGLFontTexture *font_tex = qt_font_textures.take(font_key);
if (font_tex) { if (font_tex) {
#ifdef Q_WS_MAC glDeleteTextures(1, &font_tex->texture);
if (
# ifndef QT_MAC_USE_COCOA
aglGetCurrentContext() == 0
# else
qt_current_nsopengl_context() != 0
# endif
)
#endif
glDeleteTextures(1, &font_tex->texture);
delete font_tex; delete font_tex;
} }
} }
@ -4252,10 +4229,6 @@ void QGLGlyphCache::cleanCache()
QGLFontTexHash::const_iterator it = qt_font_textures.constBegin(); QGLFontTexHash::const_iterator it = qt_font_textures.constBegin();
if (QGLContext::currentContext()) { if (QGLContext::currentContext()) {
while (it != qt_font_textures.constEnd()) { while (it != qt_font_textures.constEnd()) {
#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
if (qt_current_nsopengl_context() == 0)
break;
#endif
glDeleteTextures(1, &it.value()->texture); glDeleteTextures(1, &it.value()->texture);
++it; ++it;
} }
@ -4439,13 +4412,8 @@ void QGLGlyphCache::cacheGlyphs(QGLContext *context, QFontEngine *fontEngine,
qgl_glyph->height = qreal(glyph_height) / font_tex->height; qgl_glyph->height = qreal(glyph_height) / font_tex->height;
qgl_glyph->log_width = qreal(glyph_width); qgl_glyph->log_width = qreal(glyph_width);
qgl_glyph->log_height = qgl_glyph->height * font_tex->height; qgl_glyph->log_height = qgl_glyph->height * font_tex->height;
#ifdef Q_WS_MAC
qgl_glyph->x_offset = -metrics.x + 1;
qgl_glyph->y_offset = metrics.y - 2;
#else
qgl_glyph->x_offset = -metrics.x; qgl_glyph->x_offset = -metrics.x;
qgl_glyph->y_offset = metrics.y; qgl_glyph->y_offset = metrics.y;
#endif
if (!glyph_im.isNull()) { if (!glyph_im.isNull()) {
int idx = 0; int idx = 0;

View file

@ -137,11 +137,7 @@ public:
void drawEllipse(const QRectF &rect); void drawEllipse(const QRectF &rect);
#ifdef Q_WS_WIN
HDC handle() const;
#else
Qt::HANDLE handle() const; Qt::HANDLE handle() const;
#endif
inline Type type() const { return QPaintEngine::OpenGL; } inline Type type() const { return QPaintEngine::OpenGL; }
bool supportsTransformations(qreal, const QTransform &) const { return true; } bool supportsTransformations(qreal, const QTransform &) const { return true; }

View file

@ -91,9 +91,6 @@ QT_BEGIN_NAMESPACE
// //
// QGLGraphicsSystem // QGLGraphicsSystem
// //
#ifdef Q_WS_WIN
extern Q_GUI_EXPORT bool qt_win_owndc_required;
#endif
QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL) QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
: QGraphicsSystem(), m_useX11GL(useX11GL) : QGraphicsSystem(), m_useX11GL(useX11GL)
{ {
@ -171,10 +168,6 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
printf("using visual class %x, id %x\n", X11->visual_class, X11->visual_id); printf("using visual class %x, id %x\n", X11->visual_class, X11->visual_id);
} }
} }
#elif defined(Q_WS_WIN)
QGLWindowSurface::surfaceFormat.setDoubleBuffer(true);
qt_win_owndc_required = true;
#endif #endif
} }
@ -827,9 +820,6 @@ void QGLWindowSurface::updateGeometry() {
hijackWindow(window()); hijackWindow(window());
QGLContext *ctx = reinterpret_cast<QGLContext *>(wd->extraData()->glContext); QGLContext *ctx = reinterpret_cast<QGLContext *>(wd->extraData()->glContext);
#ifdef Q_WS_MAC
ctx->updatePaintDevice();
#endif
QSize surfSize = geometry().size(); QSize surfSize = geometry().size();