зеркало из https://github.com/mozilla/gecko-dev.git
Bug 779726 - Move QGL includes into isolated wrapper class, and fix qgl.h and GLDefs.h conflicts. r=dougt
--HG-- extra : rebase_source : 02dee7a407a23efb7ce5a2caef0c61fbfb00a7c2
This commit is contained in:
Родитель
d3ca4efc0f
Коммит
2656deaadb
|
@ -54,6 +54,7 @@ CPPSRCS += \
|
||||||
nsPrintSettingsQt.cpp \
|
nsPrintSettingsQt.cpp \
|
||||||
nsPrintDialogQt.cpp \
|
nsPrintDialogQt.cpp \
|
||||||
nsDeviceContextSpecQt.cpp \
|
nsDeviceContextSpecQt.cpp \
|
||||||
|
mozqglwidgetwrapper.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
EXPORTS = \
|
EXPORTS = \
|
||||||
|
|
|
@ -21,10 +21,20 @@ EXTRA_DSO_LDOPTS = \
|
||||||
$(MOZ_QT_LIBS) \
|
$(MOZ_QT_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
|
LOCAL_INCLUDES += \
|
||||||
|
-I$(topsrcdir)/xpcom/build \
|
||||||
|
-I$(topsrcdir)/widget/qt \
|
||||||
|
$(NULL)
|
||||||
|
|
||||||
GARBAGE += moziqwidget.h nsQAppInstance.h nsQAppInstance.cpp
|
EXPORT_SOURCES = \
|
||||||
export:: $(topsrcdir)/widget/qt/moziqwidget.h $(topsrcdir)/toolkit/xre/nsQAppInstance.h $(topsrcdir)/toolkit/xre/nsQAppInstance.cpp
|
$(topsrcdir)/widget/qt/moziqwidget.h \
|
||||||
|
$(topsrcdir)/toolkit/xre/nsQAppInstance.h \
|
||||||
|
$(topsrcdir)/toolkit/xre/nsQAppInstance.cpp \
|
||||||
|
$(topsrcdir)/widget/qt/mozqglwidgetwrapper.h \
|
||||||
|
$(topsrcdir)/widget/qt/mozqglwidgetwrapper.cpp
|
||||||
|
|
||||||
|
GARBAGE += $(EXPORT_SOURCES)
|
||||||
|
export:: $(EXPORT_SOURCES)
|
||||||
$(INSTALL) $^ .
|
$(INSTALL) $^ .
|
||||||
|
|
||||||
MOCSRCS = \
|
MOCSRCS = \
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QGraphicsWidget>
|
#include <QGraphicsWidget>
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QtOpenGL/QGLWidget>
|
#include "mozqglwidgetwrapper.h"
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@ public:
|
||||||
void setGLWidgetEnabled(bool aEnabled)
|
void setGLWidgetEnabled(bool aEnabled)
|
||||||
{
|
{
|
||||||
if (aEnabled) {
|
if (aEnabled) {
|
||||||
mGLWidget = new QGLWidget();
|
mGLWidget = new MozQGLWidgetWrapper();
|
||||||
setViewport(mGLWidget);
|
mGLWidget->setViewport(this);
|
||||||
} else {
|
} else {
|
||||||
delete mGLWidget;
|
delete mGLWidget;
|
||||||
mGLWidget = 0;
|
mGLWidget = 0;
|
||||||
|
@ -174,7 +174,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
MozQGraphicsViewEvents mEventHandler;
|
MozQGraphicsViewEvents mEventHandler;
|
||||||
IMozQWidget* mTopLevelWidget;
|
IMozQWidget* mTopLevelWidget;
|
||||||
QGLWidget* mGLWidget;
|
MozQGLWidgetWrapper* mGLWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
#ifdef MOZ_ENABLE_MEEGOTOUCH
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/* vim: set ts=4 et sw=4 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#include "mozqglwidgetwrapper.h"
|
||||||
|
#include <QGraphicsView>
|
||||||
|
#include <QtOpenGL/QGLWidget>
|
||||||
|
#include <QtOpenGL/QGLContext>
|
||||||
|
|
||||||
|
MozQGLWidgetWrapper::MozQGLWidgetWrapper()
|
||||||
|
: mWidget(new QGLWidget())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MozQGLWidgetWrapper::~MozQGLWidgetWrapper()
|
||||||
|
{
|
||||||
|
delete mWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MozQGLWidgetWrapper::makeCurrent()
|
||||||
|
{
|
||||||
|
mWidget->makeCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MozQGLWidgetWrapper::setViewport(QGraphicsView* aView)
|
||||||
|
{
|
||||||
|
aView->setViewport(mWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MozQGLWidgetWrapper::hasGLContext(QGraphicsView* aView)
|
||||||
|
{
|
||||||
|
return aView && qobject_cast<QGLWidget*>(aView->viewport());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MozQGLWidgetWrapper::isRGBAContext()
|
||||||
|
{
|
||||||
|
QGLContext* context = const_cast<QGLContext*>(QGLContext::currentContext());
|
||||||
|
return context && context->format().alpha();
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/* vim: set ts=4 et sw=4 tw=80: */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
#ifndef MOZQGLWIDGETWRAPPER_H
|
||||||
|
#define MOZQGLWIDGETWRAPPER_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* qgl.h and GLDefs.h has conflicts in type defines
|
||||||
|
* QGLWidget wrapper class helps to avoid including qgl.h with mozilla gl includes
|
||||||
|
*/
|
||||||
|
|
||||||
|
class QGLWidget;
|
||||||
|
class QGraphicsView;
|
||||||
|
class MozQGLWidgetWrapper
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MozQGLWidgetWrapper();
|
||||||
|
~MozQGLWidgetWrapper();
|
||||||
|
void makeCurrent();
|
||||||
|
void setViewport(QGraphicsView*);
|
||||||
|
static bool hasGLContext(QGraphicsView*);
|
||||||
|
static bool isRGBAContext();
|
||||||
|
private:
|
||||||
|
QGLWidget* mWidget;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -6,12 +6,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/Util.h"
|
#include "mozilla/Util.h"
|
||||||
#include "BasicLayers.h"
|
|
||||||
|
|
||||||
#include <QtOpenGL/QGLWidget>
|
|
||||||
#include <QtOpenGL/QGLContext>
|
|
||||||
// Solve conflict of qgl.h and GLDefs.h
|
|
||||||
#define GLdouble_defined 1
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QtGui/QCursor>
|
#include <QtGui/QCursor>
|
||||||
|
@ -27,6 +22,7 @@
|
||||||
#include <QStyleOptionGraphicsItem>
|
#include <QStyleOptionGraphicsItem>
|
||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include "mozqglwidgetwrapper.h"
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
|
@ -106,6 +102,7 @@ static Atom sPluginIMEAtom = nullptr;
|
||||||
#endif //MOZ_X11
|
#endif //MOZ_X11
|
||||||
|
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
|
#include "BasicLayers.h"
|
||||||
#include "LayerManagerOGL.h"
|
#include "LayerManagerOGL.h"
|
||||||
#include "nsFastStartupQt.h"
|
#include "nsFastStartupQt.h"
|
||||||
|
|
||||||
|
@ -2581,8 +2578,7 @@ nsPopupWindow::~nsPopupWindow()
|
||||||
NS_IMETHODIMP_(bool)
|
NS_IMETHODIMP_(bool)
|
||||||
nsWindow::HasGLContext()
|
nsWindow::HasGLContext()
|
||||||
{
|
{
|
||||||
QGraphicsView *view = qobject_cast<QGraphicsView*>(GetViewWidget());
|
return MozQGLWidgetWrapper::hasGLContext(qobject_cast<QGraphicsView*>(GetViewWidget()));
|
||||||
return view && qobject_cast<QGLWidget*>(view->viewport());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MozQWidget*
|
MozQWidget*
|
||||||
|
@ -3272,12 +3268,7 @@ nsWindow::GetGLFrameBufferFormat()
|
||||||
{
|
{
|
||||||
if (mLayerManager &&
|
if (mLayerManager &&
|
||||||
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
|
mLayerManager->GetBackendType() == mozilla::layers::LAYERS_OPENGL) {
|
||||||
// On maemo the hardware fb has RGB format.
|
return MozQGLWidgetWrapper::isRGBAContext() ? LOCAL_GL_RGBA : LOCAL_GL_RGB;
|
||||||
#ifdef MOZ_PLATFORM_MAEMO
|
|
||||||
return LOCAL_GL_RGB;
|
|
||||||
#else
|
|
||||||
return LOCAL_GL_RGBA;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return LOCAL_GL_NONE;
|
return LOCAL_GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче