diff options
author | Jinhyung Jo <jinhyung.jo@samsung.com> | 2016-09-30 21:14:32 +0900 |
---|---|---|
committer | Jinhyung Jo <jinhyung.jo@samsung.com> | 2016-10-04 12:07:51 +0900 |
commit | f569c289168ec579bcb62231d2572a80be5d6d52 (patch) | |
tree | 2c065f7a469094359220a68d70b361c075e4aaca /tizen/src/ui | |
parent | c4145f7dc2d523e446b28738410288764bb0910a (diff) | |
download | qemu-f569c289168ec579bcb62231d2572a80be5d6d52.tar.gz qemu-f569c289168ec579bcb62231d2572a80be5d6d52.tar.bz2 qemu-f569c289168ec579bcb62231d2572a80be5d6d52.zip |
Revert "display: move display functionality to Qt5 GUI"
With AMD GPUs,
reverted commit makes a ciritical bug that GUI is invisible.
This reverts commit 99ffcba1997dade13316bd09023f93597db0f2df.
Conflicts:
tizen/src/ui/displayglwidget.cpp
tizen/src/ui/qt5_supplement.cpp
Change-Id: Ie5b4655bdf1beb228c788dd7dc874bb6f1cba63c
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
Diffstat (limited to 'tizen/src/ui')
-rw-r--r-- | tizen/src/ui/Makefile.objs | 3 | ||||
-rw-r--r-- | tizen/src/ui/controller/dockingcontroller.cpp | 4 | ||||
-rw-r--r-- | tizen/src/ui/controller/floatingcontroller.cpp | 4 | ||||
-rw-r--r-- | tizen/src/ui/displaybase.cpp | 26 | ||||
-rw-r--r-- | tizen/src/ui/displaybase.h | 6 | ||||
-rw-r--r-- | tizen/src/ui/displayglwidget.cpp | 463 | ||||
-rw-r--r-- | tizen/src/ui/displayglwidget.h | 47 | ||||
-rw-r--r-- | tizen/src/ui/displayswapper.cpp | 62 | ||||
-rw-r--r-- | tizen/src/ui/displayswapper.h | 57 | ||||
-rw-r--r-- | tizen/src/ui/displayswwidget.cpp | 4 | ||||
-rw-r--r-- | tizen/src/ui/input/multitouchtracker.cpp | 25 | ||||
-rw-r--r-- | tizen/src/ui/mainwindow.cpp | 91 | ||||
-rw-r--r-- | tizen/src/ui/mainwindow.h | 14 | ||||
-rw-r--r-- | tizen/src/ui/qt5_supplement.cpp | 42 | ||||
-rw-r--r-- | tizen/src/ui/skinview.cpp | 2 |
15 files changed, 292 insertions, 558 deletions
diff --git a/tizen/src/ui/Makefile.objs b/tizen/src/ui/Makefile.objs index 76ddc8469c..b18942f2a1 100644 --- a/tizen/src/ui/Makefile.objs +++ b/tizen/src/ui/Makefile.objs @@ -11,6 +11,7 @@ $(obj)/qrc_resource.cpp: $(TIZEN_UI)/resource/resource.qrc obj-$(CONFIG_QT) += displaybase.o obj-$(CONFIG_QT) += displayglwidget.o moc_displayglwidget.o obj-$(CONFIG_QT) += displayswwidget.o moc_displayswwidget.o +obj-$(CONFIG_QT) += displayswapper.o moc_displayswapper.o obj-$(CONFIG_QT) += movingwidget.o obj-$(CONFIG_QT) += mainwindow.o moc_mainwindow.o obj-$(CONFIG_QT) += skinbezelitem.o @@ -33,6 +34,8 @@ $(obj)/moc_displayglwidget.cpp: $(obj)/displayglwidget.h moc $< -o $@ $(obj)/moc_displayswwidget.cpp: $(obj)/displayswwidget.h moc $< -o $@ +$(obj)/moc_displayswapper.cpp: $(obj)/displayswapper.h + moc $< -o $@ $(obj)/moc_mainwindow.cpp: $(obj)/mainwindow.h moc $< -o $@ $(obj)/moc_skinkeyitem.cpp: $(obj)/skinkeyitem.h diff --git a/tizen/src/ui/controller/dockingcontroller.cpp b/tizen/src/ui/controller/dockingcontroller.cpp index 51d4daf0f5..ec6030a5e6 100644 --- a/tizen/src/ui/controller/dockingcontroller.cpp +++ b/tizen/src/ui/controller/dockingcontroller.cpp @@ -38,10 +38,10 @@ DockingController::DockingController(ControllerForm *conForm, this->menu = menu; this->dockPos = dockPos; - setStyleSheet("background: transparent; border-style: none"); + setStyleSheet("border-style: none"); QGraphicsScene *conScene = new QGraphicsScene(this); - conScene->setBackgroundBrush(Qt::transparent); + conScene->setBackgroundBrush(Qt::black); conView = new DockingConView(this, conForm, conScene); conView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); diff --git a/tizen/src/ui/controller/floatingcontroller.cpp b/tizen/src/ui/controller/floatingcontroller.cpp index 1f807d85eb..0d6eab0bd5 100644 --- a/tizen/src/ui/controller/floatingcontroller.cpp +++ b/tizen/src/ui/controller/floatingcontroller.cpp @@ -36,12 +36,12 @@ FloatingController::FloatingController(ControllerForm *conForm, this->conForm = conForm; this->menu = menu; - setStyleSheet("background: transparent; border-style: none"); + setStyleSheet("border-style: none"); setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); setWindowTitle(conForm->getName()); QGraphicsScene *conScene = new QGraphicsScene(this); - conScene->setBackgroundBrush(Qt::transparent); + conScene->setBackgroundBrush(Qt::black); conView = new FloatingConView(this, conForm, conScene); conView->resize(conForm->skinImg[LayoutForm::normal].size()); diff --git a/tizen/src/ui/displaybase.cpp b/tizen/src/ui/displaybase.cpp index 04601fa952..80b8b9b9e1 100644 --- a/tizen/src/ui/displaybase.cpp +++ b/tizen/src/ui/displaybase.cpp @@ -41,6 +41,10 @@ void qt5_graphic_hw_invalidate(void); void req_set_sensor_accel_angle(int angle); } +uint32_t qt5_window_width = 0; +uint32_t qt5_window_height = 0; +int qt5_window_angle = 0; + DisplayBase::DisplayBase(DisplayType *displayForm, QSize resolution, qreal scaleFactor, QWidget *w) : resolution(resolution), widget(w) { @@ -123,7 +127,6 @@ void DisplayBase::showOffGuideImg() maskImage.height() * scaleFactor).mask()); } - widget->update(); offGuide->show(); } @@ -146,7 +149,7 @@ void DisplayBase::switchForm(DisplayType *displayForm) { qDebug() << "display switch angle:" << displayForm->getAngle(); - rotateAngle = displayForm->getAngle(); + qt5_window_angle = rotateAngle = displayForm->getAngle(); rect = displayForm->getRect(); maskImage = displayForm->getMask(); @@ -154,8 +157,8 @@ void DisplayBase::switchForm(DisplayType *displayForm) req_set_sensor_accel_angle(rotateAngle); /* update sensor */ updateGeometry(); - invalidateDisplay(); - widget->update(); + update(); + widget->repaint(); } void DisplayBase::scaleForm(qreal scaleFactor) @@ -166,11 +169,11 @@ void DisplayBase::scaleForm(qreal scaleFactor) updateGeometry(); - invalidateDisplay(); - widget->update(); + update(); + widget->repaint(); } -void DisplayBase::invalidateDisplay() +void DisplayBase::update() { qt5_graphic_hw_invalidate(); } @@ -198,14 +201,17 @@ QRegion DisplayBase::getMask() return widget->mask(); } -void DisplayBase::handlePaint() +void DisplayBase::handlePaint(QPaintEvent *event) { /* do nothing */ } -void DisplayBase::handleResize() +void DisplayBase::handleResize(QResizeEvent *event) { - qDebug() << "resize display:" << widget->size(); + qDebug() << "resize display:" << event->size(); + + qt5_window_width = widget->width(); + qt5_window_height = widget->height(); qt5_graphic_hw_invalidate(); diff --git a/tizen/src/ui/displaybase.h b/tizen/src/ui/displaybase.h index ffed69593d..73d96c6274 100644 --- a/tizen/src/ui/displaybase.h +++ b/tizen/src/ui/displaybase.h @@ -50,7 +50,7 @@ public: SdbHelper *sdbHelper; void switchForm(DisplayType *displayForm); void scaleForm(qreal scaleFactor); - void invalidateDisplay(); + void update(); void updateGeometry(); QWidget *getWidget(); const QRect &getGeometry(); @@ -74,8 +74,8 @@ protected: DisplayBase(DisplayType *displayForm, QSize resolution, qreal scaleFactor, QWidget *w); virtual ~DisplayBase(); - void handlePaint(); - void handleResize(); + void handlePaint(QPaintEvent *event); + void handleResize(QResizeEvent *event); void handleMousePress(QMouseEvent *event); void handleMouseRelease(QMouseEvent *event); diff --git a/tizen/src/ui/displayglwidget.cpp b/tizen/src/ui/displayglwidget.cpp index 6ccb3eb2a0..f4dcb67ed0 100644 --- a/tizen/src/ui/displayglwidget.cpp +++ b/tizen/src/ui/displayglwidget.cpp @@ -4,9 +4,9 @@ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: - * Jinhyung Jo <jinhyung.jo@samsung.com> * GiWoong Kim <giwoong.kim@samsung.com> * SeokYeon Hwang <syeon.hwang@samsung.com> + * Sangho Park <sangho.p@samsung.com> * Stanislav Vorobiov * * This program is free software; you can redistribute it and/or @@ -29,456 +29,61 @@ * */ -#include <QtOpenGL> -#include <QOpenGLShaderProgram> #include "displayglwidget.h" -#include "input/multitouchtracker.h" extern "C" { -extern uint32_t brightness_level; -extern bool display_off; -extern uint8_t brightness_tbl[]; +#include "emul_state.h" }; -// number of coordinates that two triangles to make a rectangle -#define COORD_COUNT (6) -// coordinate is the point of two float -#define COORDS_SIZE (2 * 4 * COORD_COUNT) -// vertex coords + texture coords -#define FULL_COORDS_SIZE (2 * COORDS_SIZE) - -// cast an uint to void pointer -#define TO_VOIDP(x) ((const void *)((uintptr_t)(x))) - -static const char *vs_tex_source_gl2 = - "#version 120\n\n" - "attribute vec4 vertCoord;\n" - "uniform mat4 proj;\n" - "attribute vec2 texCoord;\n" - "varying vec2 v_texCoord;\n" - "void main()\n" - "{\n" - " v_texCoord = texCoord;\n" - " gl_Position = proj * vertCoord;\n" - "}\n"; - -static const char *vs_tex_source_gl3 = - "#version 140\n\n" - "in vec4 vertCoord;\n" - "uniform mat4 proj;\n" - "in vec2 texCoord;\n" - "out vec2 v_texCoord;\n" - "void main()\n" - "{\n" - " v_texCoord = texCoord;\n" - " gl_Position = proj * vertCoord;\n" - "}\n"; - -static const char *fs_dpy_source_gl2 = - "#version 120\n\n" - "uniform sampler2D tex;\n" - "uniform float brightness;\n" - "varying vec2 v_texCoord;\n" - "void main()\n" - "{\n" - " gl_FragColor = texture2D(tex, v_texCoord) * brightness;\n" - "}\n"; - -static const char *fs_dpy_source_gl3 = - "#version 140\n\n" - "uniform sampler2D tex;\n" - "uniform float brightness;\n" - "in vec2 v_texCoord;\n" - "out vec4 FragColor;\n" - "void main()\n" - "{\n" - " FragColor = texture(tex, v_texCoord) * brightness;\n" - "}\n"; - - -static const char *fs_scale_source_gl2 = -"#version 120\n\ -\n\ -uniform sampler2D tex;\n\ -uniform float brightness;\n\ -uniform vec2 texSize;\n\ -varying vec2 v_texCoord;\n\ -vec4 cubic(float x)\n\ -{\n\ - float x2 = x * x;\n\ - float x3 = x2 * x;\n\ - vec4 w;\n\ - w.x = -x3 + 3*x2 - 3*x + 1;\n\ - w.y = 3*x3 - 6*x2 + 4;\n\ - w.z = -3*x3 + 3*x2 + 3*x + 1;\n\ - w.w = x3;\n\ - return w / 6.f;\n\ -}\n\ -void main()\n\ -{\n\ - vec2 texscale = vec2(1.0 / texSize.x, 1.0 / texSize.y);\n\ - vec2 texcoord = vec2(v_texCoord.x * texSize.x, v_texCoord.y * texSize.y);\n\ - float fx = fract(texcoord.x);\n\ - float fy = fract(texcoord.y);\n\ - texcoord.x -= fx;\n\ - texcoord.y -= fy;\n\ -\n\ - vec4 xcubic = cubic(fx);\n\ - vec4 ycubic = cubic(fy);\n\ -\n\ - vec4 c = vec4(texcoord.x - 0.5, texcoord.x + 1.5, texcoord.y -\n\ -0.5, texcoord.y + 1.5);\n\ - vec4 s = vec4(xcubic.x + xcubic.y, xcubic.z + xcubic.w, ycubic.x +\n\ -ycubic.y, ycubic.z + ycubic.w);\n\ - vec4 offset = c + vec4(xcubic.y, xcubic.w, ycubic.y, ycubic.w) / s;\n\ -\n\ - vec4 sample0 = texture2D(tex, vec2(offset.x, offset.z) *\n\ -texscale);\n\ - vec4 sample1 = texture2D(tex, vec2(offset.y, offset.z) *\n\ -texscale);\n\ - vec4 sample2 = texture2D(tex, vec2(offset.x, offset.w) *\n\ -texscale);\n\ - vec4 sample3 = texture2D(tex, vec2(offset.y, offset.w) *\n\ -texscale);\n\ -\n\ - float sx = s.x / (s.x + s.y);\n\ - float sy = s.z / (s.z + s.w);\n\ -\n\ - gl_FragColor = mix(\n\ - mix(sample3, sample2, sx),\n\ - mix(sample1, sample0, sx), sy) * brightness;\n\ -}"; - -static const char *fs_scale_source_gl3 = -"#version 140\n\ -\n\ -uniform sampler2D tex;\n\ -uniform float brightness;\n\ -uniform vec2 texSize;\n\ -in vec2 v_texCoord;\n\ -out vec4 FragColor;\n\ -vec4 cubic(float x)\n\ -{\n\ - float x2 = x * x;\n\ - float x3 = x2 * x;\n\ - vec4 w;\n\ - w.x = -x3 + 3*x2 - 3*x + 1;\n\ - w.y = 3*x3 - 6*x2 + 4;\n\ - w.z = -3*x3 + 3*x2 + 3*x + 1;\n\ - w.w = x3;\n\ - return w / 6.f;\n\ -}\n\ -void main()\n\ -{\n\ - vec2 texscale = vec2(1.0 / texSize.x, 1.0 / texSize.y);\n\ - vec2 texcoord = vec2(v_texCoord.x * texSize.x, v_texCoord.y * texSize.y);\n\ - float fx = fract(texcoord.x);\n\ - float fy = fract(texcoord.y);\n\ - texcoord.x -= fx;\n\ - texcoord.y -= fy;\n\ -\n\ - vec4 xcubic = cubic(fx);\n\ - vec4 ycubic = cubic(fy);\n\ -\n\ - vec4 c = vec4(texcoord.x - 0.5, texcoord.x + 1.5, texcoord.y -\n\ -0.5, texcoord.y + 1.5);\n\ - vec4 s = vec4(xcubic.x + xcubic.y, xcubic.z + xcubic.w, ycubic.x +\n\ -ycubic.y, ycubic.z + ycubic.w);\n\ - vec4 offset = c + vec4(xcubic.y, xcubic.w, ycubic.y, ycubic.w) /\n\ -s;\n\ -\n\ - vec4 sample0 = texture(tex, vec2(offset.x, offset.z) *\n\ -texscale);\n\ - vec4 sample1 = texture(tex, vec2(offset.y, offset.z) *\n\ -texscale);\n\ - vec4 sample2 = texture(tex, vec2(offset.x, offset.w) *\n\ -texscale);\n\ - vec4 sample3 = texture(tex, vec2(offset.y, offset.w) *\n\ -texscale);\n\ -\n\ - float sx = s.x / (s.x + s.y);\n\ - float sy = s.z / (s.z + s.w);\n\ -\n\ - FragColor = mix(\n\ - mix(sample3, sample2, sx),\n\ - mix(sample1, sample0, sx), sy) * brightness;\n\ -}"; - -DisplayGLWidget::DisplayGLWidget(QWidget *parent, +DisplayGLWidget::DisplayGLWidget(QWidget *parent, QGLContext *context, DisplayType *displayForm, QSize resolution, qreal scaleFactor) : - QOpenGLWidget(parent), DisplayBase(displayForm, resolution, scaleFactor, this), - mGuestResolution(resolution) + QGLWidget(context, parent), DisplayBase(displayForm, resolution, scaleFactor, this) { - this->maskQImage = displayForm->getMask().toImage(); - this->maskTexture = 0; - this->needScale = false; - this->dpyTexture = 0; - this->mtTexture = 0; - this->texProgram = NULL; - this->scaleProgram = NULL; - + setAutoBufferSwap(false); /* to be enable to drop events */ setAcceptDrops(true); } -void DisplayGLWidget::changedTexture(unsigned int id) -{ - if (dpyTexture != id) { - dpyTexture = id; - } - this->update(); -} - -float DisplayGLWidget::getBrightness() -{ - if (display_off) { - return 0.0f; - } - return ((float)(255 - brightness_tbl[brightness_level]) / 255.0f); -} - -// TODO: if possible, simply clean up rendeing & init code -void DisplayGLWidget::drawQuad(GLuint textureID, bool isMask) -{ - QOpenGLShaderProgram *program = needScale ? scaleProgram : texProgram; - - mFuncs->glBindTexture(GL_TEXTURE_2D, textureID); - - program->bind(); - program->enableAttributeArray("vertCoord"); - program->enableAttributeArray("texCoord"); - int vertCoordLoc = program->attributeLocation("vertCoord"); - int texCoordLoc = program->attributeLocation("texCoord"); - program->setUniformValue("proj", mOrtho); - if (needScale) { - GLfloat texSize[2]; - texSize[0] = (GLfloat)mGuestResolution.width(); - texSize[1] = (GLfloat)mGuestResolution.height(); - program->setUniformValueArray("texSize", texSize, 1, 2); - } - program->setUniformValue("brightness", isMask ? 1.0f : getBrightness()); - - mVBO->bind(); - mVBO->write(0, mVertCoords, COORDS_SIZE); - mVBO->write(COORDS_SIZE, mTexCoords, COORDS_SIZE); - mFuncs->glVertexAttribPointer(vertCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, 0); - mFuncs->glVertexAttribPointer(texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, - TO_VOIDP(COORDS_SIZE)); - mVBO->release(); - - mFuncs->glDrawArrays(GL_TRIANGLES, 0, COORD_COUNT); - - program->disableAttributeArray("texCoord"); - program->disableAttributeArray("vertCoord"); - - program->release(); -} - -void DisplayGLWidget::drawMultiTouchPoints() -{ - MultiTouchTracker *mtTracker = getTouchScreenHelper()->getMtTracker(); - QList<TouchPoint *> pointList = mtTracker->getTouchPointList(); - - if (pointList.isEmpty()) { - return; - } - - mVBO->bind(); - if (mVBO->size() < pointList.count() * (int)FULL_COORDS_SIZE) { - mVBO->allocate(pointList.count() * FULL_COORDS_SIZE); - } - - for (int i = 0; i < pointList.count(); i++) { - TouchPoint *p = pointList.at(i); - GLfloat vertCoords[12]; - GLfloat x = p->getHostPos().x() - 32 / 2; - GLfloat y = height() - p->getHostPos().y() - 32 / 2; - - vertCoords[6] = vertCoords[0] = x; - vertCoords[7] = vertCoords[1] = y; - vertCoords[2] = x + 32; - vertCoords[3] = y; - vertCoords[8] = vertCoords[4] = x + 32; - vertCoords[9] = vertCoords[5] = y + 32; - vertCoords[10] = x; - vertCoords[11] = y + 32; - - mVBO->write(i * COORDS_SIZE, vertCoords, COORDS_SIZE); - mVBO->write(pointList.count() * COORDS_SIZE + i * COORDS_SIZE, - mTexCoords, COORDS_SIZE); - } - - mFuncs->glBlendFunc(GL_SRC_COLOR, GL_ONE); - mFuncs->glBindTexture(GL_TEXTURE_2D, mtTexture); - - texProgram->bind(); - texProgram->enableAttributeArray("vertCoord"); - texProgram->enableAttributeArray("texCoord"); - int vertCoordLoc = texProgram->attributeLocation("vertCoord"); - int texCoordLoc = texProgram->attributeLocation("texCoord"); - - QMatrix4x4 mat; - mat.ortho(0.0f, (float)width(), - 0.0f, (float)height(), - -1.0f, 1.0f); - texProgram->setUniformValue("proj", mat); - texProgram->setUniformValue("brightness", 0.7f); - - mFuncs->glVertexAttribPointer(vertCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, 0); - mFuncs->glVertexAttribPointer(texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, - TO_VOIDP(pointList.count() * COORDS_SIZE)); - mVBO->release(); - - mFuncs->glDrawArrays(GL_TRIANGLES, 0, pointList.count() * COORD_COUNT); - - texProgram->disableAttributeArray("texCoord"); - texProgram->disableAttributeArray("vertCoord"); - - texProgram->release(); -} - - /* override */ void DisplayGLWidget::initializeGL() { qDebug("initialize GL"); - - mFuncs = QOpenGLContext::currentContext()->functions(); - - QOpenGLShader *vShader = new QOpenGLShader(QOpenGLShader::Vertex, this); - QOpenGLShader *dpyFgShader = new QOpenGLShader(QOpenGLShader::Fragment, this); - QOpenGLShader *scaleFgShader = new QOpenGLShader(QOpenGLShader::Fragment, this); - if (format().majorVersion() > 2) { - vShader->compileSourceCode(vs_tex_source_gl3); - dpyFgShader->compileSourceCode(fs_dpy_source_gl3); - scaleFgShader->compileSourceCode(fs_scale_source_gl3); - } else { - vShader->compileSourceCode(vs_tex_source_gl2); - dpyFgShader->compileSourceCode(fs_dpy_source_gl2); - scaleFgShader->compileSourceCode(fs_scale_source_gl2); - } - - texProgram = new QOpenGLShaderProgram(this); - texProgram->addShader(vShader); - texProgram->addShader(dpyFgShader); - scaleProgram = new QOpenGLShaderProgram(this); - scaleProgram->addShader(vShader); - scaleProgram->addShader(scaleFgShader); - - texProgram->link(); - scaleProgram->link(); - - mVAO = new QOpenGLVertexArrayObject; - if (mVAO->create()) { - mVAO->bind(); - } - mVBO = new QOpenGLBuffer; - mVBO->setUsagePattern(QOpenGLBuffer::StreamDraw); - mVBO->create(); - mVBO->bind(); - mVBO->allocate(FULL_COORDS_SIZE); - mVBO->release(); - - mVertCoords[6] = mVertCoords[0] = 0; - mVertCoords[7] = mVertCoords[1] = mGuestResolution.height(); - mVertCoords[2] = mGuestResolution.width(); - mVertCoords[3] = mGuestResolution.height(); - mVertCoords[8] = mVertCoords[4] = mGuestResolution.width(); - mVertCoords[9] = mVertCoords[5] = 0; - mVertCoords[10] = 0; - mVertCoords[11] = 0; - - mTexCoords[6] = mTexCoords[0] = 0; - mTexCoords[7] = mTexCoords[1] = 0; - mTexCoords[2] = 1; - mTexCoords[3] = 0; - mTexCoords[8] = mTexCoords[4] = 1; - mTexCoords[9] = mTexCoords[5] = 1; - mTexCoords[10] = 0; - mTexCoords[11] = 1; - - GLuint curTexture = 0; - mFuncs->glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *)&curTexture); - - const QImage img = getTouchScreenHelper()->getMtTracker()->getPointImage(); - mFuncs->glGenTextures(1, &mtTexture); - mFuncs->glBindTexture(GL_TEXTURE_2D, mtTexture); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - mFuncs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 32, 32, 0, GL_BGRA, - GL_UNSIGNED_INT_8_8_8_8_REV, - (const void *)img.constBits()); - mFuncs->glBindTexture(GL_TEXTURE_2D, curTexture); - - if (!maskQImage.isNull()) { - mFuncs->glGenTextures(1, &maskTexture); - mFuncs->glBindTexture(GL_TEXTURE_2D, maskTexture); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - mFuncs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - mFuncs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, - maskQImage.width(), maskQImage.height(), - 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - (const void *)maskQImage.constBits()); - mFuncs->glBindTexture(GL_TEXTURE_2D, curTexture); - } } /* override */ -void DisplayGLWidget::paintGL() +void DisplayGLWidget::dragEnterEvent(QDragEnterEvent *event) { - mFuncs->glDisable(GL_DEPTH_TEST); - mFuncs->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - mFuncs->glClearColor(0.0f, 0.0f, 0.0f, 1.0f); - mFuncs->glEnable(GL_BLEND); - - if (maskTexture) { - mFuncs->glBlendFuncSeparate(GL_ONE, GL_ZERO, - GL_SRC_ALPHA, GL_ZERO); - drawQuad(maskTexture, true); - } - mFuncs->glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - mOrtho.setToIdentity(); - mOrtho.rotate((float)-rotateAngle, 0.0f, 0.0f, 1.0f); - mOrtho.ortho(0.0f, (float)mGuestResolution.width(), - 0.0f, (float)mGuestResolution.height(), - -1.0f, 1.0f); - needScale = (mGuestResolution.width() != width()) - || (mGuestResolution.height() != height()); - - drawQuad(dpyTexture, false); - if (isTsEnabled) { - drawMultiTouchPoints(); - } - - mFuncs->glDisable(GL_BLEND); - mFuncs->glFinish(); + handleDragEnterEvent(event); } /* override */ -void DisplayGLWidget::resizeGL(int w, int h) +void DisplayGLWidget::dropEvent(QDropEvent *event) { - qDebug("resizeGL"); - handleResize(); - - // TODO: check changing of the guest resolution - // for 'Runtime Resolution Change' + handleDropEvent(event); } /* override */ -void DisplayGLWidget::dragEnterEvent(QDragEnterEvent *event) +void DisplayGLWidget::paintEvent(QPaintEvent *event) { - handleDragEnterEvent(event); + /* + * We offload rendering to separate thread, this must be + * a no-op, see: http://qt-project.org/doc/qt-5/QGLWidget.html: + * "3. Using QPainter to draw into a QGLWidget in a thread" + */ + + handlePaint(event); } /* override */ -void DisplayGLWidget::dropEvent(QDropEvent *event) +void DisplayGLWidget::resizeEvent(QResizeEvent *event) { - handleDropEvent(event); + /* + * We offload rendering to separate thread, this must be + * a no-op, see: http://qt-project.org/doc/qt-5/QGLWidget.html: + * "3. Using QPainter to draw into a QGLWidget in a thread" + */ + + handleResize(event); } /* override */ @@ -536,23 +141,7 @@ void DisplayGLWidget::leaveEvent(QEvent *event) } } -// TODO: To correct releasing resources DisplayGLWidget::~DisplayGLWidget() { - makeCurrent(); - if (mtTexture) { - mFuncs->glDeleteTextures(1, &mtTexture); - } - if (maskTexture) { - mFuncs->glDeleteTextures(1, &maskTexture); - } - mVAO->destroy(); - mVBO->destroy(); - texProgram->removeAllShaders(); - scaleProgram->removeAllShaders(); - delete mVAO; - delete mVBO; - delete texProgram; - delete scaleProgram; - doneCurrent(); + /* do nothing */ } diff --git a/tizen/src/ui/displayglwidget.h b/tizen/src/ui/displayglwidget.h index cc327f56a6..491d6fe594 100644 --- a/tizen/src/ui/displayglwidget.h +++ b/tizen/src/ui/displayglwidget.h @@ -4,9 +4,9 @@ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: - * Jinhyung Jo <jinhyung.jo@samsung.com> * GiWoong Kim <giwoong.kim@samsung.com> * SeokYeon Hwang <syeon.hwang@samsung.com> + * Sangho Park <sangho.p@samsung.com> * Stanislav Vorobiov * * This program is free software; you can redistribute it and/or @@ -32,33 +32,25 @@ #ifndef DISPLAYGLWIDGET_H #define DISPLAYGLWIDGET_H +#include <QGLWidget> #include "displaybase.h" -#include <QOpenGLWidget> -#include <QMatrix4x4> -class QOpenGLFunctions; -class QOpenGLShaderProgram; -class QOpenGLVertexArrayObject; -class QOpenGLBuffer; - -class DisplayGLWidget : public QOpenGLWidget, +class DisplayGLWidget : public QGLWidget, public DisplayBase { Q_OBJECT public: - DisplayGLWidget(QWidget *parent, - DisplayType *displayForm, - QSize resolution, qreal scaleFactor); + DisplayGLWidget(QWidget *parent, QGLContext *context, + DisplayType *displayForm, QSize resolution, qreal scaleFactor); ~DisplayGLWidget(); - void changedTexture(unsigned int texture); - protected: void initializeGL(); - void paintGL(); - void resizeGL(int w, int h); + + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); @@ -69,29 +61,6 @@ protected: void dragEnterEvent(QDragEnterEvent *event); void dropEvent(QDropEvent *event); - -private: - float getBrightness(); - void drawQuad(GLuint texture, bool isMask); - void drawMultiTouchPoints(); - - QSize mGuestResolution; - QOpenGLFunctions *mFuncs; - - bool needScale; - QImage maskQImage; - GLuint maskTexture; - - GLuint dpyTexture; - GLuint mtTexture; - QMatrix4x4 mOrtho; - GLfloat mVertCoords[12]; - GLfloat mTexCoords[12]; - - QOpenGLVertexArrayObject *mVAO; - QOpenGLBuffer *mVBO; - QOpenGLShaderProgram *texProgram; - QOpenGLShaderProgram *scaleProgram; }; #endif // DISPLAYGLWIDGET_H diff --git a/tizen/src/ui/displayswapper.cpp b/tizen/src/ui/displayswapper.cpp new file mode 100644 index 0000000000..95b30db5c1 --- /dev/null +++ b/tizen/src/ui/displayswapper.cpp @@ -0,0 +1,62 @@ +/* + * Qt UI + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim <giwoong.kim@samsung.com> + * Sangho Park <sangho1206.park@samsung.com> + * Stanislav Vorobiov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "displayswapper.h" + +extern "C" { +int qt5_graphic_hw_display(void); +} + +DisplaySwapper::DisplaySwapper(QGLContext* context, QObject* parent) : + QObject(parent), context(context), terminating(false) +{ + /* do nothing */ +} + +void DisplaySwapper::display() +{ + if (context) { + while (!terminating) { + context->makeCurrent(); + if (qt5_graphic_hw_display()) { + context->swapBuffers(); + } + context->doneCurrent(); + } + } else { + while (!terminating) { + qt5_graphic_hw_display(); + } + } + + qDebug("DisplaySwapper::display() terminated"); + + emit displayFinished(); +} diff --git a/tizen/src/ui/displayswapper.h b/tizen/src/ui/displayswapper.h new file mode 100644 index 0000000000..aa5714b0c2 --- /dev/null +++ b/tizen/src/ui/displayswapper.h @@ -0,0 +1,57 @@ +/* + * Qt UI + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * GiWoong Kim <giwoong.kim@samsung.com> + * Sangho Park <sangho1206.park@samsung.com> + * Stanislav Vorobiov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#ifndef DISPLAYSWAPPER_H +#define DISPLAYSWAPPER_H + +#include <QWidget> +#include <QGLContext> + +class DisplaySwapper : public QObject +{ + Q_OBJECT + +public: + DisplaySwapper(QGLContext* context, QObject* parent = 0); + + inline void setTerminating() { terminating = true; } + +public slots: + void display(); + +signals: + void displayFinished(); + +private: + QGLContext *context; + bool terminating; +}; + +#endif // DISPLAYSWAPPER_H diff --git a/tizen/src/ui/displayswwidget.cpp b/tizen/src/ui/displayswwidget.cpp index 97c968ee32..ec149a5c9f 100644 --- a/tizen/src/ui/displayswwidget.cpp +++ b/tizen/src/ui/displayswwidget.cpp @@ -71,7 +71,7 @@ void DisplaySWWidget::drawMtPoints(QPainter &painter) void DisplaySWWidget::paintEvent(QPaintEvent *event) { QLabel::paintEvent(event); - handlePaint(); + handlePaint(event); if (isTsEnabled == true) { /* draw multi-touch points */ @@ -96,7 +96,7 @@ void DisplaySWWidget::dropEvent(QDropEvent *event) void DisplaySWWidget::resizeEvent(QResizeEvent *event) { QLabel::resizeEvent(event); - handleResize(); + handleResize(event); repaint(); } diff --git a/tizen/src/ui/input/multitouchtracker.cpp b/tizen/src/ui/input/multitouchtracker.cpp index 8f1bc33588..04594f58f5 100644 --- a/tizen/src/ui/input/multitouchtracker.cpp +++ b/tizen/src/ui/input/multitouchtracker.cpp @@ -34,6 +34,12 @@ #include "multitouchtracker.h" #include "displaybase.h" +float *qt5_mt_points = 0; +int qt5_mt_count = 0; +const void *qt5_mt_pixels = 0; +int qt5_mt_width = 0; +int qt5_mt_height = 0; + extern "C" { bool virtio_touchscreen_ready(void); void virtio_touchscreen_event(int x, int y, int z, int buttons_state); @@ -73,6 +79,8 @@ void TouchPoint::updatePos(QPoint hostPos, QPoint guestPos) this->hostPos = hostPos; this->guestPos = guestPos; + qt5_mt_points[2 * (this->id - 1) + 0] = hostPos.x(); + qt5_mt_points[2 * (this->id - 1) + 1] = hostPos.y(); qt5_graphic_hw_invalidate(); } @@ -101,6 +109,11 @@ MultiTouchTracker::MultiTouchTracker( painter.setBrush(QBrush(QColor(128, 128, 128, 128))); painter.setRenderHint(QPainter::Antialiasing, true); painter.drawEllipse(1, 1, 30, 30); + + qt5_mt_points = new float[2 * maxTouchPoint](); + qt5_mt_count = 0; + qt5_mt_pixels = touchPointImage.constBits(); + qt5_mt_width = qt5_mt_height = 32; } int MultiTouchTracker::getPointRadius() @@ -156,6 +169,9 @@ int MultiTouchTracker::addTouchPoint(QPoint hostPos, QPoint guestPos) touchPointList.append(point); qDebug() << "ID" << point->getID() << "point touching" << hostPos << guestPos; + qt5_mt_points[2 * qt5_mt_count + 0] = hostPos.x(); + qt5_mt_points[2 * qt5_mt_count + 1] = hostPos.y(); + qt5_mt_count++; qt5_graphic_hw_invalidate(); return touchPointList.count(); @@ -223,6 +239,8 @@ int MultiTouchTracker::limitTouchCnt(int max) delete point; } touchPointList.removeLast(); + + qt5_mt_count--; } diff = beforeCnt - touchPointList.count(); @@ -504,6 +522,7 @@ void MultiTouchTracker::finishTracking() } touchPointList.clear(); + qt5_mt_count = 0; qt5_graphic_hw_invalidate(); } @@ -512,4 +531,10 @@ MultiTouchTracker::~MultiTouchTracker() qDebug("destroy multi-touch tracker"); finishTracking(); + + delete[] qt5_mt_points; + qt5_mt_points = 0; + qt5_mt_count = 0; + qt5_mt_pixels = 0; + qt5_mt_width = qt5_mt_height = 0; } diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index aeab23c9ab..7737da1d66 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -46,7 +46,10 @@ void qt5_graphic_hw_update(void); void qemu_system_graceful_shutdown_request(unsigned int sec); } -MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : +QOpenGLContext *qt5GLContext = NULL; +QSurfaceFormat qt5GLFormat; + +MainWindow::MainWindow(UiInformation *uiInfo, QWidget *parent) : QWidget(parent) { /* initialize */ @@ -56,6 +59,8 @@ MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : this->display = NULL; this->rotary = NULL; + this->swapper = NULL; + this->swapperThread = NULL; this->screenWidget = NULL; this->captureRequestHandler = NULL; @@ -67,11 +72,10 @@ MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : setWindowIcon(QIcon(":/icons/emulator_icon.ico")); setWindowFlags(Qt::FramelessWindowHint | Qt::WindowCloseButtonHint); setMinimumSize(0, 0); - setAttribute(Qt::WA_TranslucentBackground, true); /* scene */ mainScene = new QGraphicsScene(this); - mainScene->setBackgroundBrush(Qt::transparent); + mainScene->setBackgroundBrush(Qt::black); /* view */ mainView = new MainView(mainScene, this); @@ -94,7 +98,7 @@ MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : /* display */ updateDisplayMatrix(); - createDisplay(useGL); + display = createDisplay(uiInfo->getMainFormDpyType()); /* set HW Key shortcut */ keyboardShortcut = new KeyboardShortcut(this); @@ -107,20 +111,60 @@ MainWindow::MainWindow(UiInformation *uiInfo, bool useGL, QWidget *parent) : SLOT(slotContextMenu(const QPoint&))); } -void MainWindow::createDisplay(bool useGL) +DisplayBase *MainWindow::createDisplay(DisplayType *displayForm) { qDebug("create a display"); - if (useGL) { /* on-screen rendering */ - this->display = new DisplayGLWidget(this, - uiInfo->getMainFormDpyType(), uiInfo->getResolution(), getUiState()->getScaleFactor()); + DisplayBase *displayWidget = NULL; + + if (qt5GLContext) { /* on-screen rendering */ + QGLContext *wrapperContext = + QGLContext::fromOpenGLContext(qt5GLContext); + + /* + * Qt5 bug, wrapperContext->requestedFormat() doesn't return + * originating format, it returns actual format, this may result + * in wrong OpenGL context version here. + */ + + QGLFormat format = QGLFormat::fromSurfaceFormat(qt5GLFormat); + + /* + * Qt5 bug, format set here doesn't always have effect, must + * set it after QGLWidget is created. + */ + QGLContext *context = new QGLContext(format); + + displayWidget = new DisplayGLWidget(this, context, + displayForm, uiInfo->getResolution(), getUiState()->getScaleFactor()); + + context->setFormat(format); + context->create(wrapperContext); + + /* display swapper */ + swapperThread = new QThread(this); + + context->doneCurrent(); + context->moveToThread(swapperThread); + + swapper = new DisplaySwapper(context); + swapper->moveToThread(swapperThread); + + connect(swapper, SIGNAL(displayFinished()), + swapperThread, SLOT(quit()), Qt::DirectConnection); + connect(swapperThread, SIGNAL(finished()), swapper, SLOT(deleteLater())); + connect(swapperThread, SIGNAL(finished()), swapperThread, SLOT(deleteLater())); + + swapperThread->start(); } else { /* off-screen rendering */ DisplaySWWidget *widget = new DisplaySWWidget(this, - uiInfo->getMainFormDpyType(), uiInfo->getResolution(), getUiState()->getScaleFactor()); + displayForm, uiInfo->getResolution(), getUiState()->getScaleFactor()); - this->screenWidget = widget; - this->display = widget; + screenWidget = widget; + displayWidget = widget; } + + return displayWidget; } RotaryView *MainWindow::createRotary() @@ -129,6 +173,21 @@ RotaryView *MainWindow::createRotary() return new RotaryView(this); } +void MainWindow::startDisplaySwapper() +{ + if (swapper != NULL) { + QMetaObject::invokeMethod(swapper, "display", Qt::QueuedConnection); + } +} + +void MainWindow::terminateDisplaySwapper() +{ + if (swapper != NULL) { + swapper->setTerminating(); + qt5_graphic_hw_update(); + } +} + QLabel *MainWindow::getScreenWidget() { return screenWidget; @@ -267,7 +326,7 @@ void MainWindow::openController(int index, int dockPos) /* Some part of QGLWidget's surface might be lost on Windows when view changing. * So, we need an additional updating for display. */ - display->invalidateDisplay(); + display->update(); #ifdef CONFIG_LINUX popupMenu->slotOnTop(getUiState()->isOnTop()); @@ -304,7 +363,7 @@ void MainWindow::closeController() /* Some part of QGLWidget's surface might be lost on Windows when view changing. * So, we need an additional updating for display. */ - display->invalidateDisplay(); + display->update(); } /* override */ @@ -459,7 +518,6 @@ void MainWindow::processCaptured(bool captured, void *pixels, if (captured) { qDebug("save captured image: %p", pixels); - // pixels's format is ARGB32 QImage image = QImage((uchar *)pixels, width, height, QImage::Format_ARGB32); @@ -529,11 +587,6 @@ bool MainWindow::isMovingMode() return (movingWidget != NULL); } -void MainWindow::updateTexture(unsigned int texture) -{ - ((DisplayGLWidget *)getDisplay())->changedTexture(texture); -} - /* override */ void MainWindow::closeEvent(QCloseEvent *event) { diff --git a/tizen/src/ui/mainwindow.h b/tizen/src/ui/mainwindow.h index 5e10476cc4..183aeb337c 100644 --- a/tizen/src/ui/mainwindow.h +++ b/tizen/src/ui/mainwindow.h @@ -35,10 +35,12 @@ #define MAINWINDOW_H #include <QWidget> +#include <QGLContext> #include "menu/contextmenu.h" #include "mainview.h" #include "displaybase.h" +#include "displayswapper.h" #include "rotaryview.h" #include "uiinformation.h" #include "controller/dockingcontroller.h" @@ -51,9 +53,7 @@ class MainWindow : public QWidget Q_OBJECT public: - explicit MainWindow(UiInformation *uiInfo, - bool useGL, - QWidget *parent = 0); + explicit MainWindow(UiInformation *uiInfo, QWidget *parent = 0); ~MainWindow(); UiInformation *getUiInfo(void); @@ -79,13 +79,13 @@ public: FloatingController *getFloatingCon(); void openController(int index, int dockPos); void closeController(); + void startDisplaySwapper(); + void terminateDisplaySwapper(); void turnOnMovingMode(); void turnOffMovingMode(); bool isMovingMode(); - void updateTexture(unsigned int texture); - public slots: void slotContextMenu(const QPoint &pos); @@ -99,7 +99,7 @@ protected: QLabel *screenWidget; private: - void createDisplay(bool useGL); + DisplayBase *createDisplay(DisplayType *displayForm); RotaryView *createRotary(); UiInformation *uiInfo; @@ -112,6 +112,8 @@ private: RotaryView *rotary; ContextMenu *popupMenu; + QThread *swapperThread; + DisplaySwapper *swapper; KeyboardShortcut *keyboardShortcut; MovingWidget *movingWidget; diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp index 7bf99152f6..33c68a49f9 100644 --- a/tizen/src/ui/qt5_supplement.cpp +++ b/tizen/src/ui/qt5_supplement.cpp @@ -29,7 +29,6 @@ */ #include <QApplication> -#include <QOpenGLContext> #include "qt5_supplement.h" #include "propertykeyword.h" @@ -55,7 +54,6 @@ bool is_display_off(void); //using namespace std; bool qt5IsOnscreen; QApplication *qt5App = NULL; -QOpenGLContext *qt5GLContext; bool isForceLegacy; static int argc = 0; @@ -333,7 +331,7 @@ static void qt5_gui_init(void) /* GUI */ qDebug("start!"); - mainwindow = new MainWindow(uiInfo, qt5IsOnscreen); + mainwindow = new MainWindow(uiInfo); mainwindow->setCaptureRequestHandler(captureRequestListener, captureRequestHandler); /* position */ @@ -392,12 +390,16 @@ static void qt5_gui_init(void) mainwindow->getMainView()->resize(viewSize / 2); mainwindow->getMainView()->resize(viewSize); #endif + + mainwindow->startDisplaySwapper(); } void qt5_destroy() { qDebug("qt5 destroy"); + mainwindow->terminateDisplaySwapper(); + /* write most recently used data information */ QString mruPath( uiInfo->getVmDataPath() + QDir::separator() + GUI_PROPERTIES_FILE); @@ -463,30 +465,6 @@ void qt5_early_prepare(bool isOnscreen) * QApplication is constructed. */ QCoreApplication::setAttribute(Qt::AA_X11InitThreads); #endif - if (qt5IsOnscreen) { - QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL); - QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); - - QSurfaceFormat sfcFormat; - sfcFormat.setRedBufferSize(8); - sfcFormat.setGreenBufferSize(8); - sfcFormat.setBlueBufferSize(8); - sfcFormat.setAlphaBufferSize(8); - sfcFormat.setDepthBufferSize(24); - sfcFormat.setStencilBufferSize(8); -#ifdef CONFIG_DARWIN - // The default OpenGL version for QSurfaceFormat is 2.0. - if (!isForceLegacy) { - sfcFormat.setMajorVersion(3); - sfcFormat.setMinorVersion(2); - sfcFormat.setProfile(QSurfaceFormat::CoreProfile); - } -#else - sfcFormat.setMajorVersion(3); - sfcFormat.setMinorVersion(1); -#endif - QSurfaceFormat::setDefaultFormat(sfcFormat); - } qt5App = new QApplication(argc, argv); @@ -502,9 +480,6 @@ void qt5_early_prepare(bool isOnscreen) eventFilter = new EventFilter(); qt5App->installNativeEventFilter(eventFilter); #endif - if (qt5IsOnscreen) { - qt5GLContext = QOpenGLContext::globalShareContext(); - } } void qt5_prepare(void) @@ -581,10 +556,3 @@ void qt5_process_captured(bool captured, void *pixels, int width, int height) mainwindow->processCaptured(captured, pixels, width, height); } } - -void qt5_update_texture(unsigned int tex_id) -{ - if (mainwindow) { - mainwindow->updateTexture(tex_id); - } -} diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp index fd4ee5602b..83b33889a3 100644 --- a/tizen/src/ui/skinview.cpp +++ b/tizen/src/ui/skinview.cpp @@ -38,7 +38,7 @@ SkinView::SkinView(QWidget *parent, QGraphicsScene *scene) : this->grabPos = SKINVIEW_NULLITY_POSITION; /* note: do not call setStyleSheet() separately for each style */ - setStyleSheet("QGraphicsView { background: transparent; border-style: none; }" + + setStyleSheet("QGraphicsView { border-style: none; }" + QString(STYLE_TOOLTIP)); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |