Changeset View
Changeset View
Standalone View
Standalone View
krita/ui/canvas/kis_mirror_axis.cpp
Show All 19 Lines | |||||
20 | #include "kis_mirror_axis.h" | 20 | #include "kis_mirror_axis.h" | ||
21 | 21 | | |||
22 | #include "KoConfig.h" | 22 | #include "KoConfig.h" | ||
23 | 23 | | |||
24 | #include <QPainter> | 24 | #include <QPainter> | ||
25 | #include <QToolButton> | 25 | #include <QToolButton> | ||
26 | #include <QApplication> | 26 | #include <QApplication> | ||
27 | #include <QPaintEngine> | 27 | #include <QPaintEngine> | ||
28 | #include <QOpenGLContext> | ||||
29 | #include <QOpenGLFunctions> | ||||
28 | 30 | | |||
29 | #include <KoIcon.h> | 31 | #include <KoIcon.h> | ||
30 | 32 | | |||
31 | #include "kis_canvas_resource_provider.h" | 33 | #include "kis_canvas_resource_provider.h" | ||
32 | #include "KisViewManager.h" | 34 | #include "KisViewManager.h" | ||
33 | #include "KisView.h" | 35 | #include "KisView.h" | ||
34 | #include "kis_image.h" | 36 | #include "kis_image.h" | ||
35 | #include "canvas/kis_canvas_controller.h" | 37 | #include "canvas/kis_canvas_controller.h" | ||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Line(s) | 143 | { | |||
142 | Q_UNUSED(updateArea); | 144 | Q_UNUSED(updateArea); | ||
143 | Q_UNUSED(converter); | 145 | Q_UNUSED(converter); | ||
144 | Q_UNUSED(canvas); | 146 | Q_UNUSED(canvas); | ||
145 | 147 | | |||
146 | gc.setPen(QPen(QColor(0, 0, 0, 128), 1)); | 148 | gc.setPen(QPen(QColor(0, 0, 0, 128), 1)); | ||
147 | gc.setBrush(Qt::white); | 149 | gc.setBrush(Qt::white); | ||
148 | gc.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); | 150 | gc.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); | ||
149 | 151 | | |||
150 | //QT5TODO: T360 | 152 | #if defined(HAVE_OPENGL) | ||
151 | #if defined(HAVE_OPENGL) && defined(HAVE_GLEW) | 153 | QOpenGLContext *ctx = QOpenGLContext::currentContext(); | ||
154 | bool hasMultisample = ((gc.paintEngine()->type() == QPaintEngine::OpenGL2) && | ||||
155 | (ctx->hasExtension("GL_ARB_multisample"))); | ||||
156 | | ||||
152 | // QPainter cannot anti-alias the edges of circles etc. when using OpenGL | 157 | // QPainter cannot anti-alias the edges of circles etc. when using OpenGL | ||
153 | // So instead, use native OpenGL anti-aliasing when available. | 158 | // So instead, use native OpenGL anti-aliasing when available. | ||
154 | if(gc.paintEngine()->type() == QPaintEngine::OpenGL2 && GLEW_ARB_multisample) { | 159 | if (hasMultisample) { | ||
155 | gc.beginNativePainting(); | 160 | gc.beginNativePainting(); | ||
156 | glEnable(GL_MULTISAMPLE); | 161 | ctx->functions()->glEnable(GL_MULTISAMPLE); | ||
157 | gc.endNativePainting(); | 162 | gc.endNativePainting(); | ||
158 | } | 163 | } | ||
159 | #endif | 164 | #endif | ||
160 | 165 | | |||
161 | float halfHandleSize = d->handleSize / 2; | 166 | float halfHandleSize = d->handleSize / 2; | ||
162 | 167 | | |||
163 | d->recomputeVisibleAxes(gc.viewport()); | 168 | d->recomputeVisibleAxes(gc.viewport()); | ||
164 | 169 | | |||
Show All 40 Lines | 209 | // gc.drawPixmap(verticalIndicator.adjusted(5, 5, -5, -5).toRect(), d->verticalIcon); | |||
205 | gc.setPen(QPen(QColor(0, 0, 0, 128), 2)); | 210 | gc.setPen(QPen(QColor(0, 0, 0, 128), 2)); | ||
206 | gc.drawEllipse(d->verticalHandle); | 211 | gc.drawEllipse(d->verticalHandle); | ||
207 | gc.drawPixmap(d->verticalHandle.adjusted(5, 5, -5, -5).toRect(), d->verticalIcon); | 212 | gc.drawPixmap(d->verticalHandle.adjusted(5, 5, -5, -5).toRect(), d->verticalIcon); | ||
208 | } else { | 213 | } else { | ||
209 | d->verticalHandle = QRectF(); | 214 | d->verticalHandle = QRectF(); | ||
210 | } | 215 | } | ||
211 | } | 216 | } | ||
212 | 217 | | |||
213 | //QT5TODO: T360 | 218 | #if defined(HAVE_OPENGL) | ||
214 | #if defined(HAVE_OPENGL) && defined(HAVE_GLEW) | 219 | if (hasMultisample) { | ||
215 | if(gc.paintEngine()->type() == QPaintEngine::OpenGL2 && GLEW_ARB_multisample) { | | |||
216 | gc.beginNativePainting(); | 220 | gc.beginNativePainting(); | ||
217 | glDisable(GL_MULTISAMPLE); | 221 | ctx->functions()->glDisable(GL_MULTISAMPLE); | ||
218 | gc.endNativePainting(); | 222 | gc.endNativePainting(); | ||
219 | } | 223 | } | ||
220 | #endif | 224 | #endif | ||
221 | } | 225 | } | ||
222 | 226 | | |||
223 | bool KisMirrorAxis::eventFilter(QObject* target, QEvent* event) | 227 | bool KisMirrorAxis::eventFilter(QObject* target, QEvent* event) | ||
224 | { | 228 | { | ||
225 | if(event->type() == QEvent::MouseButtonPress) { | 229 | if(event->type() == QEvent::MouseButtonPress) { | ||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |