From dd27936d9426785e2b19228feae30e31dc3930a5 Mon Sep 17 00:00:00 2001 From: Shinya Kitaoka Date: May 19 2016 10:44:34 +0000 Subject: Use QOpenGLWidget instead of QGLWidget (#315) * use QOpenGLWidget instead of QGLWidget for ImageViewer * use update() instead of updateGL() * fix doSwapBuffers * fix HexagonalColorWheel * fix Viewer * support AA_ShareOpenGLContexts & AA_EnableHighDpiScaling * check Qt version --- diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h index ed6b804..98d8146 100644 --- a/toonz/sources/include/toonzqt/styleeditor.h +++ b/toonz/sources/include/toonzqt/styleeditor.h @@ -32,7 +32,8 @@ #include #include #include -#include +#include +#include #include #include @@ -141,7 +142,7 @@ enum CurrentWheel { rightTriangle }; -class DVAPI HexagonalColorWheel : public QGLWidget +class DVAPI HexagonalColorWheel : public QOpenGLWidget, private QOpenGLFunctions_3_0 { Q_OBJECT @@ -175,17 +176,17 @@ public: QColor getBGColor() const { return m_bgColor; } protected: - void initializeGL(); - void resizeGL(int width, int height); - void paintGL(); + void initializeGL() override; + void resizeGL(int width, int height) override; + void paintGL() override; QSize SizeHint() const { return QSize(300, 200); }; - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; signals: void colorChanged(const ColorModel &color, bool isDragging); diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt index df8a677..0a759d6 100644 --- a/toonz/sources/toonz/CMakeLists.txt +++ b/toonz/sources/toonz/CMakeLists.txt @@ -143,9 +143,7 @@ set(MOC_HEADERS metnum.h ObjectTracker.h predict3d.h - processor.h - viewer.h - writer.h) + processor.h) set(HEADERS ${MOC_HEADERS}) @@ -300,9 +298,7 @@ set(SOURCES dummyprocessor.cpp metnum.cpp ObjectTracker.cpp - predict3d.cpp - viewer.cpp - writer.cpp) + predict3d.cpp) add_translation(toonz ${HEADERS} ${SOURCES}) diff --git a/toonz/sources/toonz/flipbook.cpp b/toonz/sources/toonz/flipbook.cpp index 1e25c7b..0c7eaf8 100644 --- a/toonz/sources/toonz/flipbook.cpp +++ b/toonz/sources/toonz/flipbook.cpp @@ -1894,7 +1894,7 @@ void FlipBook::showEvent(QShowEvent *e) m_flipConsole->onPreferenceChanged(); } m_flipConsole->setActive(true); - m_imageViewer->updateGL(); + m_imageViewer->update(); } //------------------------------------------------------------------- diff --git a/toonz/sources/toonz/imageviewer.cpp b/toonz/sources/toonz/imageviewer.cpp index 68220de..b32885d 100644 --- a/toonz/sources/toonz/imageviewer.cpp +++ b/toonz/sources/toonz/imageviewer.cpp @@ -205,10 +205,22 @@ public: */ ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook, bool showHistogram) - : QGLWidget(parent), m_pressedMousePos(0, 0), m_mouseButton(Qt::NoButton), m_draggingZoomSelection(false), m_image(), m_FPS(0), m_viewAff(), m_pos(0, 0), m_visualSettings(), m_compareSettings(), m_isHistogramEnable(showHistogram), m_flipbook(flipbook), m_isColorModel(false), m_histogramPopup(0), m_isRemakingPreviewFx(false) - //, m_ghibli3DLutUtil(0) //iwsw commented out temporarily - , - m_rectRGBPick(false) + : QOpenGLWidget(parent) + , m_pressedMousePos(0, 0) + , m_mouseButton(Qt::NoButton) + , m_draggingZoomSelection(false) + , m_image() + , m_FPS(0) + , m_viewAff() + , m_pos(0, 0) + , m_visualSettings() + , m_compareSettings() + , m_isHistogramEnable(showHistogram) + , m_flipbook(flipbook) + , m_isColorModel(false) + , m_histogramPopup(0) + , m_isRemakingPreviewFx(false) + , m_rectRGBPick(false) { m_visualSettings.m_sceneProperties = TApp::instance()->getCurrentScene()->getScene()->getProperties(); m_visualSettings.m_drawExternalBG = true; @@ -219,10 +231,6 @@ ImageViewer::ImageViewer(QWidget *parent, FlipBook *flipbook, bool showHistogram if (m_isHistogramEnable) m_histogramPopup = new HistogramPopup(tr("Flipbook Histogram")); - - //iwsw commented out 2 lines temporarily - //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && Ghibli3DLutUtil::m_isValid) - // m_ghibli3DLutUtil = new Ghibli3DLutUtil(); } //----------------------------------------------------------------------------- @@ -239,7 +247,7 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) return; } - QMenu *menu = new QMenu(this); + std::unique_ptr menu(new QMenu(this)); if (m_flipbook->getPreviewedFx()) { if (!(windowState() & Qt::WindowFullScreen)) { @@ -326,8 +334,7 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *event) action = CommandManager::instance()->getAction(MI_LoadRecentImage); action->setParent(0); - delete menu; - updateGL(); + update(); } //----------------------------------------------------------------------------- @@ -340,20 +347,6 @@ void ImageViewer::setVisual(const ImagePainter::VisualSettings &settings) } //----------------------------------------------------------------------------- - -ImageViewer::~ImageViewer() -{ - //iwsw commented out temporarily - /* - if (m_ghibli3DLutUtil) - { - m_ghibli3DLutUtil->onEnd(); - delete m_ghibli3DLutUtil; - } - */ -} - -//----------------------------------------------------------------------------- /*! Set current image to \b image and update. If Histogram is visible set its image. */ void ImageViewer::setImage(TImageP image) @@ -403,12 +396,8 @@ void ImageViewer::hideHistogram() void ImageViewer::initializeGL() { - // glClearColor(1.0,1.0,1.0,1); + initializeOpenGLFunctions(); glClear(GL_COLOR_BUFFER_BIT); - - //iwsw commented out temporarily - //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - // m_ghibli3DLutUtil->onInit(); } //----------------------------------------------------------------------------- @@ -426,26 +415,15 @@ void ImageViewer::resizeGL(int w, int h) glLoadIdentity(); glTranslatef(0.375, 0.375, 0.0); glTranslated(w * 0.5, h * 0.5, 0); - - //iwsw commented out temporarily - //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - // m_ghibli3DLutUtil->onResize(w, h); } //----------------------------------------------------------------------------- void ImageViewer::paintGL() { - //iwsw commented out temporarily - //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - // m_ghibli3DLutUtil->startDraw(); - TDimension viewerSize(width(), height()); TAffine aff = m_viewAff; - //if (!m_visualSettings.m_defineLoadbox && m_flipbook && m_flipbook->getLoadbox()!=TRect()) - // offs = convert(m_flipbook->getLoadbox().getP00())-TPointD(m_flipbook->getImageSize().lx/2.0, m_flipbook->getImageSize().ly/2.0); - TDimension imageSize; TRect loadbox; @@ -458,6 +436,7 @@ void ImageViewer::paintGL() loadbox = m_flipbook->getLoadbox(); } m_visualSettings.m_sceneProperties = TApp::instance()->getCurrentScene()->getScene()->getProperties(); + // enable checks only in the color model m_visualSettings.m_useChecks = m_isColorModel; ImagePainter::paintImage(m_image, imageSize, viewerSize, aff, m_visualSettings, m_compareSettings, loadbox); @@ -486,10 +465,6 @@ void ImageViewer::paintGL() } if (!m_image) { - //iwsw commented out temporarily - //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - // m_ghibli3DLutUtil->endDraw(); - return; } @@ -558,10 +533,6 @@ void ImageViewer::paintGL() glEnd(); } } - - //iwsw commented out temporarily - //if (Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - // m_ghibli3DLutUtil->endDraw(); } //------------------------------------------------------------------------------ @@ -819,16 +790,8 @@ void ImageViewer::pickColor(QMouseEvent *event, bool putValueToStyleEditor) TPoint mousePos = TPoint(event->pos().x(), height() - 1 - event->pos().y()); TRectD area = TRectD(mousePos.x, mousePos.y, mousePos.x, mousePos.y); - //iwsw commented out temporarily - //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled()) - // get3DLutUtil()->bindFBO(); - const TPixel32 pix = picker.pickColor(area); - //iwsw commented out temporarily - //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled()) - // get3DLutUtil()->releaseFBO(); - QPoint viewP = mapFrom(this, event->pos()); TPointD pos = getViewAff().inv() * TPointD(viewP.x() - width() / 2, -viewP.y() + height() / 2); @@ -867,16 +830,8 @@ void ImageViewer::rectPickColor(bool putValueToStyleEditor) return; } - //iwsw commented out temporarily - //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled()) - // get3DLutUtil()->bindFBO(); - const TPixel32 pix = picker.pickColor(area.enlarge(-1, -1)); - //iwsw commented out temporarily - //if (get3DLutUtil() && Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled()) - // get3DLutUtil()->releaseFBO(); - //throw the picked color to the histogram m_histogramPopup->updateAverageColor(pix); //throw it to the style editor as well @@ -1128,6 +1083,14 @@ void ImageViewer::adaptView(const QRect &geomRect) adaptView(imgBounds, viewRect); } +void ImageViewer::doSwapBuffers() { + update(); +} + +void ImageViewer::changeSwapBehavior(bool enable) { + setUpdateBehavior(enable ? PartialUpdate : NoPartialUpdate); +} + //----------------------------------------------------------------------------- void ImageViewer::keyPressEvent(QKeyEvent *event) diff --git a/toonz/sources/toonz/imageviewer.h b/toonz/sources/toonz/imageviewer.h index f3c9b4f..655ceb7 100644 --- a/toonz/sources/toonz/imageviewer.h +++ b/toonz/sources/toonz/imageviewer.h @@ -3,12 +3,10 @@ #ifndef IMAGEVIEWER_INCLUDE #define IMAGEVIEWER_INCLUDE -//iwsw commented out temporarily -//#include "toonzqt/ghibli_3dlut_util.h" - #include "toonz/imagepainter.h" -#include +#include +#include //----------------------------------------------------------------------------- @@ -22,7 +20,7 @@ class HistogramPopup; // ImageViewer //-------------------- -class ImageViewer : public QGLWidget +class ImageViewer : public QOpenGLWidget, private QOpenGLFunctions_3_0 { Q_OBJECT enum DragType { eNone, @@ -58,9 +56,6 @@ class ImageViewer : public QGLWidget //a flipbook shows a red border line before the rendered result is shown. bool m_isRemakingPreviewFx; - //iwsw commented out temporarily - //Ghibli3DLutUtil * m_ghibli3DLutUtil; - int getDragType(const TPoint &pos, const TRect &loadBox); void updateLoadbox(const TPoint &curPos); void updateCursor(const TPoint &curPos); @@ -72,7 +67,6 @@ class ImageViewer : public QGLWidget public: ImageViewer(QWidget *parent, FlipBook *flipbook, bool showHistogram); - ~ImageViewer(); void setIsColorModel(bool isColorModel) { m_isColorModel = isColorModel; } bool isColorModel() { return m_isColorModel; } @@ -106,28 +100,21 @@ public: void adaptView(const TRect &imgRect, const TRect &viewRect); void adaptView(const QRect &viewerRect); - void doSwapBuffers() - { - swapBuffers(); - glFlush(); - } - void changeSwapBehavior(bool enable) { setAutoBufferSwap(enable); } - - //iwsw commented out temporarily - //Ghibli3DLutUtil* get3DLutUtil(){ return m_ghibli3DLutUtil; } + void doSwapBuffers(); + void changeSwapBehavior(bool enable); protected: - void contextMenuEvent(QContextMenuEvent *event); - void initializeGL(); - void resizeGL(int width, int height); - void paintGL(); - - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); - void mouseDoubleClickEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent *); + void contextMenuEvent(QContextMenuEvent *event) override; + void initializeGL() override; + void resizeGL(int width, int height) override; + void paintGL() override; + + void mouseMoveEvent(QMouseEvent *event) override; + void mousePressEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; + void mouseDoubleClickEvent(QMouseEvent *event) override; + void wheelEvent(QWheelEvent *) override; void panQt(const QPoint &delta); void zoomQt(const QPoint ¢er, double factor); diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index 1e93d96..342ce42 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -258,6 +258,11 @@ int main(int argc, char *argv[]) } } + QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) + QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + QApplication a(argc, argv); #ifdef Q_OS_WIN diff --git a/toonz/sources/toonz/viewer.cpp b/toonz/sources/toonz/viewer.cpp deleted file mode 100644 index 5da5b9a..0000000 --- a/toonz/sources/toonz/viewer.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -#include -#include "tgl.h" -#include "viewer.h" -#include "processor.h" - -//============================================================================= -// Viewer -//----------------------------------------------------------------------------- - -Viewer::Viewer(QWidget *parent) - : QGLWidget(parent), m_raster(0), m_processor(0), update_frame(true) -{ -} - -//----------------------------------------------------------------------------- - -Viewer::~Viewer() -{ -} - -//----------------------------------------------------------------------------- - -void Viewer::initializeGL() -{ - glClearColor(1.0f, 1.0f, 1.0f, 0.0f); -} - -//----------------------------------------------------------------------------- - -void Viewer::resizeGL(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - // To maintain pixel accuracy - glTranslated(0.375, 0.375, 0.0); -} - -//----------------------------------------------------------------------------- - -void Viewer::paintGL() -{ - glClear(GL_COLOR_BUFFER_BIT); - if (m_raster) { - glRasterPos2d(0, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap()); - glDrawPixels(m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData()); - } - if (m_processor) { - m_processor->draw(); - } - - if (m_message != "") { - glColor3d(0, 0, 0); - glPushMatrix(); - const double sc = 5; - glScaled(sc, sc, sc); - tglDrawText(TPointD(5, 5), m_message); - glPopMatrix(); - } -} - -//----------------------------------------------------------------------------- - -void Viewer::setRaster(TRaster32P raster) -{ - m_raster = raster; - if (update_frame) - update(); -} - -//----------------------------------------------------------------------------- - -void Viewer::setMessage(std::string msg) -{ - m_message = msg; - update(); -} diff --git a/toonz/sources/toonz/viewer.h b/toonz/sources/toonz/viewer.h deleted file mode 100644 index a035b28..0000000 --- a/toonz/sources/toonz/viewer.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#ifndef VIEWER_H -#define VIEWER_H - -#include -#include "traster.h" - -class Processor; - -//! OpenGL Widget that display the movie -class Viewer : public QGLWidget -{ - //! Raster that store the current Frame of the Movie. - TRaster32P m_raster; - Q_OBJECT; - //! String used to display "loading" text while the movie is being loaded - std::string m_message; - //! Pointer to a Processor to process the frame drawing OpenGL primitive over it. - Processor *m_processor; - -public: - bool update_frame; - - //! Construct a QGLWidget object which is a child of parent. - Viewer(QWidget *parent = 0); - //! Destroys the widget - ~Viewer(); - - //! Set the raster to draw - void setRaster(TRaster32P raster); - //! Returns the raster - const TRaster32P &getRaster() const { return m_raster; } - - //! Set the Processor to draw over the current frame - void setProcessor(Processor *processor) { m_processor = processor; } - //! Set the message. This message is displayed for every frame (if is a non-empty string). - void setMessage(std::string msg); - -protected: - void initializeGL(); - void paintGL(); - void resizeGL(int width, int height); -}; - -#endif // VIEWER_H diff --git a/toonz/sources/toonz/writer.cpp b/toonz/sources/toonz/writer.cpp deleted file mode 100644 index c5c9829..0000000 --- a/toonz/sources/toonz/writer.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -#include -#include "tgl.h" -#include "writer.h" -#include "processor.h" -#include "trasterimage.h" - -//============================================================================= -// Writer -//---------------------------------------------------------------------------- - -Writer::Writer(const TFilePath &outputFile, int lx, int ly) - : m_pixmap(lx, ly), m_context(0), m_levelWriter(outputFile), m_frameCount(0), m_raster(lx, ly) -{ - QGLFormat glFormat; - m_context = new QGLContext(glFormat, &m_pixmap); - m_context->makeCurrent(); - - glViewport(0, 0, lx, ly); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, lx, 0, ly, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - // To maintain pixel accuracy - glTranslated(0.375, 0.375, 0.0); - glClearColor(1.0f, 1.0f, 1.0f, 0.0f); -} - -//----------------------------------------------------------------------------- - -Writer::~Writer() -{ - delete m_context; -} - -//----------------------------------------------------------------------------- - -void Writer::write(const TRaster32P &ras, Processor *processor) -{ - m_context->makeCurrent(); - glClear(GL_COLOR_BUFFER_BIT); - if (ras) { - glRasterPos2d(0, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap()); - glDrawPixels(ras->getLx(), ras->getLy(), TGL_FMT, TGL_TYPE, ras->getRawData()); - } - if (processor) { - processor->draw(); - } - glRasterPos2d(0, 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); // ras->getWrap()); - glReadPixels(0, 0, m_raster->getLx(), m_raster->getLy(), TGL_FMT, TGL_TYPE, m_raster->getRawData()); - - TImageP img = TRasterImageP(m_raster); - m_levelWriter->getFrameWriter(++m_frameCount)->save(img); -} - -//----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/writer.h b/toonz/sources/toonz/writer.h deleted file mode 100644 index 4e388e4..0000000 --- a/toonz/sources/toonz/writer.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#ifndef WRITER_H -#define WRITER_H - -#include -#include "traster.h" -#include "tfilepath.h" -#include "tlevel_io.h" - -class Processor; - -//! Draw the frame (with the processing) before saving it. -class Writer -{ - //! QPaintDevice used only to initialize the QGLContext - QPixmap m_pixmap; - //! Offline OpenGL context that draw directly to a QPaintDevice (in this case a QPixmap) - QGLContext *m_context; - //! Class to write the level to file - TLevelWriterP m_levelWriter; - //! Frame counter - int m_frameCount; - //! Current Raster - TRaster32P m_raster; - -public: - //! Constructor - /*! - \param &outputFile filename of the output movie - \param lx an integer contains the width of the movie - \param ly an integer contains the height of the movie - */ - Writer(const TFilePath &outputFile, int lx, int ly); - //! Destructor - ~Writer(); - - /*! Write the raster, using the processor to the GL Context, - then read the context to store it in the m_raster. - Hence write m_raster to the movie file using TLevelWriter - */ - void write(const TRaster32P &ras, Processor *processor); - -protected: -}; - -#endif // WRITER_H diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index 78eb933..349cf3d 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -587,49 +587,29 @@ QPixmap makeSquareShading( //***************************************************************************** HexagonalColorWheel::HexagonalColorWheel(QWidget *parent) - : QGLWidget(parent), m_bgColor(128, 128, 128) //defaul value in case this value does not set in the style sheet - //, m_ghibli3DLutUtil(0)//iwsw commented out temporarily + : QOpenGLWidget(parent) + , m_bgColor(128, 128, 128) //defaul value in case this value does not set in the style sheet { setObjectName("HexagonalColorWheel"); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setFocusPolicy(Qt::NoFocus); m_currentWheel = none; - - //iwsw commented out temporarily - /* - if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && Ghibli3DLutUtil::m_isValid) - { - m_ghibli3DLutUtil = new Ghibli3DLutUtil(); - m_ghibli3DLutUtil->setInvert(); - } - */ } //----------------------------------------------------------------------------- HexagonalColorWheel::~HexagonalColorWheel() { - //iwsw commented out temporarily - /* - if(m_ghibli3DLutUtil) - { - m_ghibli3DLutUtil->onEnd(); - delete m_ghibli3DLutUtil; - } - */ } //----------------------------------------------------------------------------- void HexagonalColorWheel::initializeGL() { - qglClearColor(getBGColor()); + initializeOpenGLFunctions(); - //iwsw commented out temporarily - /* - if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - m_ghibli3DLutUtil->onInit(); - */ + QColor color = getBGColor(); + glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); } //----------------------------------------------------------------------------- @@ -679,29 +659,17 @@ void HexagonalColorWheel::resizeGL(int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, (GLdouble)width, (GLdouble)height, 0.0, 1.0, -1.0); - - //iwsw commented out temporarily - /* - if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - m_ghibli3DLutUtil->onResize(width,height); - */ } //----------------------------------------------------------------------------- void HexagonalColorWheel::paintGL() { - //call ClearColor() here in order to update bg color when the stylesheet is switched - qglClearColor(getBGColor()); + QColor color = getBGColor(); + glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); glMatrixMode(GL_MODELVIEW); - //iwsw commented out temporarily - /* - if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - m_ghibli3DLutUtil->startDraw(); - */ - glClear(GL_COLOR_BUFFER_BIT); float v = (float)m_color.getValue(eValue) / 100.0f; @@ -746,12 +714,6 @@ void HexagonalColorWheel::paintGL() drawCurrentColorMark(); glPopMatrix(); - - //iwsw commented out temporarily - /* - if(Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled() && m_ghibli3DLutUtil) - m_ghibli3DLutUtil->endDraw(); - */ } //-----------------------------------------------------------------------------