/* * Qt UI * * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * Jinhyung Jo * GiWoong Kim * SeokYeon Hwang * 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 DISPLAYGLWIDGET_H #define DISPLAYGLWIDGET_H #include "displaybase.h" #include #include #include extern "C" { #include "qemu/thread.h" // FIXME: move it to common header struct dpy_item { GLuint tex; uint32_t width; uint32_t height; bool available; QemuMutex mutex; }; } class QOpenGLFunctions; class QOpenGLShaderProgram; class QOpenGLVertexArrayObject; class QOpenGLBuffer; class DisplayGLWidget : public QOpenGLWidget, public DisplayBase { Q_OBJECT public: DisplayGLWidget(QWidget *parent, DisplayType *displayForm, QSize resolution, qreal scaleFactor); ~DisplayGLWidget(); void changedTexture(struct dpy_item *tex); protected: void initializeGL(); void paintGL(); void resizeGL(int w, int h); void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void enterEvent(QEvent *event); void leaveEvent(QEvent *event); 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; dpy_item* current; dpy_item* next; QMutex textureListMutex; GLuint mtTexture; QMatrix4x4 mOrtho; GLfloat mVertCoords[12]; GLfloat mTexCoords[12]; QOpenGLVertexArrayObject *mVAO; QOpenGLBuffer *mVBO; QOpenGLShaderProgram *texProgram; QOpenGLShaderProgram *scaleProgram; }; #endif // DISPLAYGLWIDGET_H