Krita Source Code Documentation
Loading...
Searching...
No Matches
KisOpenGLCanvas2 Class Reference

#include <kis_opengl_canvas2.h>

+ Inheritance diagram for KisOpenGLCanvas2:

Classes

class  CanvasBridge
 
struct  Private
 

Public Slots

void slotConfigChanged ()
 
void slotPixelGridModeChanged ()
 
void slotUpdateCursorColor ()
 

Public Member Functions

void channelSelectionChanged (const QBitArray &channelFlags) override
 
BitDepthMode currentBitDepthMode () const override
 
QString currentBitDepthUserReport () const override
 
void finishResizingImage (qint32 w, qint32 h) override
 
void focusInEvent (QFocusEvent *event) override
 
void focusOutEvent (QFocusEvent *event) override
 
void hideEvent (QHideEvent *event) override
 
void initializeGL () override
 
void inputMethodEvent (QInputMethodEvent *event) override
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 
bool isBusy () const override
 
 KisOpenGLCanvas2 (KisCanvas2 *canvas, KisCoordinatesConverter *coordinatesConverter, QWidget *parent, KisImageWSP image, const KisDisplayConfig &displayConfig, QSharedPointer< KisDisplayFilter > displayFilter, BitDepthMode bitDepthRequest)
 
void notifyImageColorSpaceChanged (const KoColorSpace *cs) override
 set/update the color space of the attached image
 
KisOpenGLImageTexturesSP openGLImageTextures () const
 
void paintEvent (QPaintEvent *e) override
 
void paintGL () override
 
void paintToolOutline (const KisOptimizedBrushOutline &path, int thickness=1)
 
void resizeGL (int width, int height) override
 
void setDisplayConfig (const KisDisplayConfig &config) override
 
void setDisplayFilter (QSharedPointer< KisDisplayFilter > displayFilter) override
 set the specified display filter on the canvas
 
void setLodResetInProgress (bool value) override
 
void setWrapAroundViewingMode (bool value) override
 
void setWrapAroundViewingModeAxis (WrapAroundAxis value) override
 
void showEvent (QShowEvent *event) override
 
KisUpdateInfoSP startUpdateCanvasProjection (const QRect &rc) override
 
void updateCanvasDecorations (const QRect &decoUpdateRect) override
 
void updateCanvasImage (const QRect &imageUpdateRect) override
 
QVector< QRect > updateCanvasProjection (const QVector< KisUpdateInfoSP > &infoObjects) override
 
QRect updateCanvasProjection (KisUpdateInfoSP info) override
 
QWidget * widget () override
 
bool wrapAroundViewingMode () const override
 
WrapAroundAxis wrapAroundViewingModeAxis () const override
 
 ~KisOpenGLCanvas2 () override
 
- Public Member Functions inherited from KisCanvasWidgetBase
void addDecoration (KisCanvasDecorationSP deco) override
 
QColor borderColor () const
 
KisCoordinatesConverter * coordinatesConverter () const
 
KisCanvasDecorationSP decoration (const QString &id) const override
 
QList< KisCanvasDecorationSP > decorations () const override
 
void drawDecorations (QPainter &gc, const QRect &updateWidgetRect) const override
 
 KisCanvasWidgetBase (KisCanvas2 *canvas, KisCoordinatesConverter *coordinatesConverter)
 
void notifyDecorationsWindowMinimized (bool minimized)
 
void removeDecoration (const QString &id) override
 
void setDecorations (const QList< KisCanvasDecorationSP > &) override
 
KoToolProxy * toolProxy () const override
 
 ~KisCanvasWidgetBase () override
 
- Public Member Functions inherited from KisAbstractCanvasWidget
 KisAbstractCanvasWidget ()
 
virtual ~KisAbstractCanvasWidget ()
 

Protected Member Functions

bool callFocusNextPrevChild (bool next) override
 To be implemented by the derived canvas.
 
- Protected Member Functions inherited from KisCanvasWidgetBase
KisCanvas2 * canvas () const
 
void notifyConfigChanged ()
 
void processFocusInEvent (QFocusEvent *event)
 
void processFocusOutEvent (QFocusEvent *event)
 
void processInputMethodEvent (QInputMethodEvent *event)
 
QVariant processInputMethodQuery (Qt::InputMethodQuery query) const
 

Private Slots

void slotShowFloatingMessage (const QString &message, int timeout, bool priority)
 

Private Attributes

Private *const d
 

Additional Inherited Members

- Public Types inherited from KisAbstractCanvasWidget
enum class  BitDepthMode { Depth8Bit = 0 , Depth10Bit }
 
- Static Public Member Functions inherited from KisCanvasWidgetBase
static QImage createCheckersImage (qint32 checkSize=-1)
 

Detailed Description

KisOpenGLCanvas is the widget that shows the actual image using OpenGL

NOTE: if you change something in the event handling here, also change it in the qpainter canvas.

Definition at line 30 of file kis_opengl_canvas2.h.

Constructor & Destructor Documentation

◆ KisOpenGLCanvas2()

KisOpenGLCanvas2::KisOpenGLCanvas2 ( KisCanvas2 * canvas,
KisCoordinatesConverter * coordinatesConverter,
QWidget * parent,
KisImageWSP image,
const KisDisplayConfig & displayConfig,
QSharedPointer< KisDisplayFilter > displayFilter,
BitDepthMode bitDepthRequest )

When in pure OpenGL mode, the canvas surface will have alpha channel. Therefore, if our canvas blending algorithm produces semi-transparent pixels (and it does), then Krita window itself will become transparent. Which is not good.

In Angle mode, GL_RGB8 is not available (and the transparence effect doesn't exist at all).

Definition at line 82 of file kis_opengl_canvas2.cpp.

89 : QOpenGLWidget(parent)
91 , d(new Private())
92{
93 setProperty("krita_skip_srgb_surface_manager_assignment", true);
95
96 KisConfig cfg(false);
97 cfg.setCanvasState("OPENGL_STARTED");
98
99 d->renderer = new KisOpenGLCanvasRenderer(new CanvasBridge(this), image, displayConfig, displayFilter);
100
101 connect(d->renderer->openGLImageTextures().data(),
102 SIGNAL(sigShowFloatingMessage(QString, int, bool)),
103 SLOT(slotShowFloatingMessage(QString, int, bool)));
104
105 setAcceptDrops(true);
106 setAutoFillBackground(false);
107
108 setFocusPolicy(Qt::StrongFocus);
109 setAttribute(Qt::WA_NoSystemBackground, true);
110#ifdef Q_OS_MACOS
111 setAttribute(Qt::WA_AcceptTouchEvents, false);
112#else
113 setAttribute(Qt::WA_AcceptTouchEvents, true);
114#endif
115 setAttribute(Qt::WA_InputMethodEnabled, true);
116 setAttribute(Qt::WA_DontCreateNativeAncestors, true);
117
118 const bool osManagedSurfacePresent = KisPlatformPluginInterfaceFactory::instance()->surfaceColorManagedByOS();
119 const bool useNativeSurfaceForCanvas = cfg.effectiveShouldUseNativeSurfaceForCanvas(osManagedSurfacePresent);
120 if (useNativeSurfaceForCanvas) {
121 setAttribute(Qt::WA_NativeWindow, true);
122 }
123
124 setUpdateBehavior(PartialUpdate);
125
126 // we should make sure the texture doesn't have alpha channel,
127 // otherwise blending will not work correctly.
128 if (KisOpenGLModeProber::instance()->useHDRMode()) {
129 setTextureFormat(GL_RGBA16F);
130 } else {
131 if (bitDepthRequest == BitDepthMode::Depth10Bit) {
132 if (QSurfaceFormat::defaultFormat().redBufferSize() < 10) {
133 warnOpenGL <<
134 "WARNING: KisOpenGLCanvas2 was created with a 10-bit surface, "
135 "while the global surface format is still set to 8-bit. Expect "
136 "color banding to appear";
137 }
138 setTextureFormat(GL_RGB10_A2);
139 } else {
149 if (!KisOpenGL::hasOpenGLES()) {
150 setTextureFormat(GL_RGB8);
151 }
152 }
153 }
154
155 connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged()));
156 connect(KisConfigNotifier::instance(), SIGNAL(pixelGridModeChanged()), SLOT(slotPixelGridModeChanged()));
157
158 connect(canvas->viewManager()->canvasResourceProvider(), SIGNAL(sigEffectiveCompositeOpChanged()), SLOT(slotUpdateCursorColor()));
159 connect(canvas->viewManager()->canvasResourceProvider(), SIGNAL(sigPaintOpPresetChanged(KisPaintOpPresetSP)), SLOT(slotUpdateCursorColor()));
160
163 cfg.writeEntry("canvasState", "OPENGL_SUCCESS");
164}
KisViewManager * viewManager() const
KisCoordinatesConverter * coordinatesConverter() const
KisCanvasWidgetBase(KisCanvas2 *canvas, KisCoordinatesConverter *coordinatesConverter)
KisCanvas2 * canvas() const
static KisConfigNotifier * instance()
static constexpr char ENABLED_PROPERTY[]
void slotShowFloatingMessage(const QString &message, int timeout, bool priority)
KisOpenGLImageTexturesSP openGLImageTextures() const
static KisOpenGLModeProber * instance()
static bool hasOpenGLES()
static KisPlatformPluginInterfaceFactory * instance()
KisCanvasResourceProvider * canvasResourceProvider()
#define warnOpenGL
Definition kis_debug.h:108
KisOpenGLCanvasRenderer * renderer

References KisCanvasWidgetBase::canvas(), KisViewManager::canvasResourceProvider(), d, KisSharedPtr< T >::data(), KisAbstractCanvasWidget::Depth10Bit, KisConfig::effectiveShouldUseNativeSurfaceForCanvas(), KisLongPressEventFilter::ENABLED_PROPERTY, KisOpenGL::hasOpenGLES(), KisConfigNotifier::instance(), KisPlatformPluginInterfaceFactory::instance(), KisOpenGLModeProber::instance(), KisOpenGLCanvasRenderer::openGLImageTextures(), KisOpenGLCanvas2::Private::renderer, KisConfig::setCanvasState(), slotConfigChanged(), slotPixelGridModeChanged(), slotShowFloatingMessage(), slotUpdateCursorColor(), KisPlatformPluginInterfaceFactory::surfaceColorManagedByOS(), KisCanvas2::viewManager(), warnOpenGL, and KisConfig::writeEntry().

◆ ~KisOpenGLCanvas2()

KisOpenGLCanvas2::~KisOpenGLCanvas2 ( )
override

Since we delete openGL resources, we should make sure the context is initialized properly before they are deleted. Otherwise resources from some other (current) context may be deleted due to resource id aliasing.

The main symptom of resources being deleted from wrong context, the canvas being locked/backened-out after some other document is closed.

Definition at line 166 of file kis_opengl_canvas2.cpp.

167{
179 makeCurrent();
180
181 delete d;
182
183 doneCurrent();
184}

References d.

Member Function Documentation

◆ callFocusNextPrevChild()

bool KisOpenGLCanvas2::callFocusNextPrevChild ( bool next)
overrideprotectedvirtual

To be implemented by the derived canvas.

Implements KisCanvasWidgetBase.

Definition at line 455 of file kis_opengl_canvas2.cpp.

456{
457 return focusNextPrevChild(next);
458}

◆ channelSelectionChanged()

void KisOpenGLCanvas2::channelSelectionChanged ( const QBitArray & channelFlags)
overridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 416 of file kis_opengl_canvas2.cpp.

417{
418 d->renderer->channelSelectionChanged(channelFlags);
419}
void channelSelectionChanged(const QBitArray &channelFlags)

References KisOpenGLCanvasRenderer::channelSelectionChanged(), d, and KisOpenGLCanvas2::Private::renderer.

◆ currentBitDepthMode()

KisOpenGLCanvas2::BitDepthMode KisOpenGLCanvas2::currentBitDepthMode ( ) const
overridevirtual

Reimplemented from KisCanvasWidgetBase.

Definition at line 465 of file kis_opengl_canvas2.cpp.

466{
467 return
468 textureFormat() == GL_RGB10_A2 &&
469 format().redBufferSize() == 10 &&
470 format().greenBufferSize() == 10 &&
471 format().blueBufferSize() == 10 ?
474}

References KisAbstractCanvasWidget::Depth10Bit, and KisAbstractCanvasWidget::Depth8Bit.

◆ currentBitDepthUserReport()

QString KisOpenGLCanvas2::currentBitDepthUserReport ( ) const
overridevirtual

Reimplemented from KisCanvasWidgetBase.

Definition at line 476 of file kis_opengl_canvas2.cpp.

476 {
477 QString report;
478 QDebug str(&report);
479
480 str << "Texture Format: " << Qt::hex << Qt::showbase << textureFormat() << Qt::reset;
481
482 switch (textureFormat()) {
483 case GL_RGB10_A2:
484 str << " (" << "GL_RGB10_A2" << ")";
485 break;
486// not available in openGLES
487#ifdef GL_RGB10
488 case GL_RGB10:
489 str << " (" << "GL_RGB10" << ")";
490 break;
491#endif /* GL_RGB10 */
492// not available in openGLES
493#ifdef GL_RGB12
494 case GL_RGB12:
495 str << " (" << "GL_RGB12" << ")";
496 break;
497#endif /* GL_RGB12 */
498// not available in openGLES
499#ifdef GL_RGBA16
500 case GL_RGBA16:
501 str << " (" << "GL_RGBA16" << ")";
502 break;
503#endif /* GL_RGBA16 */
504// not available in openGLES
505#ifdef GL_RGB16
506 case GL_RGB16:
507 str << " (" << "GL_RGB16" << ")";
508 break;
509#endif /* GL_RGB16 */
510 case GL_RGBA16F:
511 str << " (" << "GL_RGBA16F" << ")";
512 break;
513 case GL_RGB8:
514 str << " (" << "GL_RGB8" << ")";
515 break;
516 case GL_RGBA8:
517 str << " (" << "GL_RGBA8" << ")";
518 break;
519 default:
520 str << " (" << "<unknown>" << ")";
521 break;
522 }
523 str << Qt::endl;
524
525 str << "FBO Buffer Size: "
526 << "R: " << format().redBufferSize() << " "
527 << "G: " << format().greenBufferSize() << " "
528 << "B: " << format().blueBufferSize() << " "
529 << "A: " << format().alphaBufferSize() << Qt::endl;
530
531 QWindow *win = windowHandle();
532 if (win) {
533 str << "Window Buffer Size: "
534 << "R: " << win->format().redBufferSize() << " "
535 << "G: " << win->format().greenBufferSize() << " "
536 << "B: " << win->format().blueBufferSize() << " "
537 << "A: " << win->format().alphaBufferSize() << Qt::endl;
538 }
539
540 if (win) {
541 str << "Global Buffer Size: "
542 << "R: " << QSurfaceFormat::defaultFormat().redBufferSize() << " "
543 << "G: " << QSurfaceFormat::defaultFormat().greenBufferSize() << " "
544 << "B: " << QSurfaceFormat::defaultFormat().blueBufferSize() << " "
545 << "A: " << QSurfaceFormat::defaultFormat().alphaBufferSize() << Qt::endl;
546 }
547
548 return report;
549}

◆ finishResizingImage()

void KisOpenGLCanvas2::finishResizingImage ( qint32 w,
qint32 h )
overridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 422 of file kis_opengl_canvas2.cpp.

423{
424 KisOpenGLContextSwitchLockSkipOnQt5 contextLock(this);
426}
void finishResizingImage(qint32 w, qint32 h)

References d, KisOpenGLCanvasRenderer::finishResizingImage(), and KisOpenGLCanvas2::Private::renderer.

◆ focusInEvent()

void KisOpenGLCanvas2::focusInEvent ( QFocusEvent * event)
override

Definition at line 388 of file kis_opengl_canvas2.cpp.

389{
390 processFocusInEvent(event);
391}
void processFocusInEvent(QFocusEvent *event)

References KisCanvasWidgetBase::processFocusInEvent().

◆ focusOutEvent()

void KisOpenGLCanvas2::focusOutEvent ( QFocusEvent * event)
override

Definition at line 393 of file kis_opengl_canvas2.cpp.

394{
396}
void processFocusOutEvent(QFocusEvent *event)

References KisCanvasWidgetBase::processFocusOutEvent().

◆ hideEvent()

void KisOpenGLCanvas2::hideEvent ( QHideEvent * event)
override

Definition at line 398 of file kis_opengl_canvas2.cpp.

399{
400 QOpenGLWidget::hideEvent(e);
402}
void notifyDecorationsWindowMinimized(bool minimized)

References KisCanvasWidgetBase::notifyDecorationsWindowMinimized().

◆ initializeGL()

void KisOpenGLCanvas2::initializeGL ( )
override

◆ inputMethodEvent()

void KisOpenGLCanvas2::inputMethodEvent ( QInputMethodEvent * event)
override

Definition at line 383 of file kis_opengl_canvas2.cpp.

384{
386}
void processInputMethodEvent(QInputMethodEvent *event)

References KisCanvasWidgetBase::processInputMethodEvent().

◆ inputMethodQuery()

QVariant KisOpenGLCanvas2::inputMethodQuery ( Qt::InputMethodQuery query) const
override

Definition at line 378 of file kis_opengl_canvas2.cpp.

379{
380 return processInputMethodQuery(query);
381}
QVariant processInputMethodQuery(Qt::InputMethodQuery query) const

References KisCanvasWidgetBase::processInputMethodQuery().

◆ isBusy()

bool KisOpenGLCanvas2::isBusy ( ) const
overridevirtual

Returns true if the asynchronous engine of the canvas (e.g. openGL pipeline) is busy with processing of the previous update events. This will make KisCanvas2 to postpone and compress update events.

Implements KisAbstractCanvasWidget.

Definition at line 342 of file kis_opengl_canvas2.cpp.

343{
344 const bool isBusyStatus = d->glSyncObject && !d->glSyncObject->isSignaled();
346 return isBusyStatus;
347}
static KisOpenglCanvasDebugger * instance()
QScopedPointer< KisOpenGLSync > glSyncObject

References d, KisOpenGLCanvas2::Private::glSyncObject, KisOpenglCanvasDebugger::instance(), and KisOpenglCanvasDebugger::notifySyncStatus().

◆ notifyImageColorSpaceChanged()

void KisOpenGLCanvas2::notifyImageColorSpaceChanged ( const KoColorSpace * cs)
overridevirtual

set/update the color space of the attached image

Implements KisAbstractCanvasWidget.

Definition at line 192 of file kis_opengl_canvas2.cpp.

193{
194 KisOpenGLContextSwitchLockSkipOnQt5 contextLock(this);
196}
void notifyImageColorSpaceChanged(const KoColorSpace *cs)

References d, KisOpenGLCanvasRenderer::notifyImageColorSpaceChanged(), and KisOpenGLCanvas2::Private::renderer.

◆ openGLImageTextures()

KisOpenGLImageTexturesSP KisOpenGLCanvas2::openGLImageTextures ( ) const

◆ paintEvent()

void KisOpenGLCanvas2::paintEvent ( QPaintEvent * e)
override

Enable partial updates only for the case when we have integer scaling. There is a bug in Qt that causes artifacts otherwise:

See https://bugs.kde.org/show_bug.cgi?id=441216

Definition at line 282 of file kis_opengl_canvas2.cpp.

283{
285
286 if (qFuzzyCompare(devicePixelRatioF(), qRound(devicePixelRatioF()))) {
294 d->updateRect = e->rect();
295 } else {
296 d->updateRect = this->rect();
297 }
298
299#if KRITA_QT_HAS_UPDATE_COMPRESSION_PATCH
305 if (isBusy()) {
306 //qWarning() << "WARNING: paint event delivered with the canvas non-ready, rescheduling...";
307 d->shouldSkipRenderingPass = true;
308 QOpenGLWidget::paintEvent(e);
309 d->shouldSkipRenderingPass = false;
310 QTimer::singleShot(0, this,
311 [this, updateRect = *d->updateRect] () {
312 if (updateRect.isEmpty()) {
313 this->update();
314 } else {
315 this->update(updateRect);
316 }
317 });
318 } else
319#endif
320 {
321 QOpenGLWidget::paintEvent(e);
322 }
323
324 d->updateRect = boost::none;
325}
bool isBusy() const override
static bool qFuzzyCompare(half p1, half p2)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
boost::optional< QRect > updateRect

References d, isBusy(), KIS_SAFE_ASSERT_RECOVER_RETURN, qFuzzyCompare(), and KisOpenGLCanvas2::Private::updateRect.

◆ paintGL()

void KisOpenGLCanvas2::paintGL ( )
override

Definition at line 232 of file kis_opengl_canvas2.cpp.

233{
234#if KRITA_QT_HAS_UPDATE_COMPRESSION_PATCH
235 if (d->shouldSkipRenderingPass) {
236 return;
237 }
238#endif
239
240 const QRect updateRect = d->updateRect ? *d->updateRect : QRect();
241
242 if (!OPENGL_SUCCESS) {
243 KisConfig cfg(false);
244 cfg.writeEntry("canvasState", "OPENGL_PAINT_STARTED");
245 }
246
248 QRect canvasImageDirtyRect = d->canvasImageDirtyRect & rect();
249 d->canvasImageDirtyRect = QRect();
250 d->renderer->paintCanvasOnly(canvasImageDirtyRect, updateRect);
251 {
252 QPainter gc(this);
253 if (!updateRect.isEmpty()) {
254 gc.setClipRect(updateRect);
255 }
256
257 QRect decorationsBoundingRect = coordinatesConverter()->imageRectInWidgetPixels().toAlignedRect();
258
259 if (!updateRect.isEmpty()) {
260 decorationsBoundingRect &= updateRect;
261 }
262
263 drawDecorations(gc, decorationsBoundingRect);
264 }
265
266 d->repaintDbg.paint(this, updateRect.isEmpty() ? rect() : updateRect);
267
268 // We create the glFenceSync object here instead of in KisOpenGLRenderer,
269 // because the glFenceSync object should be created after all render
270 // commands in a frame, not just the OpenGL canvas itself. Putting it
271 // outside of KisOpenGLRenderer allows the canvas widget to do extra
272 // rendering, which a QtQuick2-based canvas will need.
273 d->glSyncObject.reset(new KisOpenGLSync());
274
275 if (!OPENGL_SUCCESS) {
276 KisConfig cfg(false);
277 cfg.writeEntry("canvasState", "OPENGL_SUCCESS");
278 OPENGL_SUCCESS = true;
279 }
280}
void drawDecorations(QPainter &gc, const QRect &updateWidgetRect) const override
void paintCanvasOnly(const QRect &canvasImageDirtyRect, const QRect &viewportUpdateRect=QRect())
void paint(QPaintDevice *paintDevice, const QRect &widgetRect)
static bool OPENGL_SUCCESS

References KisOpenGLCanvas2::Private::canvasImageDirtyRect, KisCanvasWidgetBase::coordinatesConverter(), d, KisCanvasWidgetBase::drawDecorations(), KisOpenGLCanvas2::Private::glSyncObject, KisCoordinatesConverter::imageRectInWidgetPixels(), KisOpenglCanvasDebugger::instance(), KisOpenglCanvasDebugger::notifyPaintRequested(), OPENGL_SUCCESS, KisRepaintDebugger::paint(), KisOpenGLCanvasRenderer::paintCanvasOnly(), KisOpenGLCanvas2::Private::renderer, KisOpenGLCanvas2::Private::repaintDbg, KisOpenGLCanvas2::Private::updateRect, and KisConfig::writeEntry().

◆ paintToolOutline()

void KisOpenGLCanvas2::paintToolOutline ( const KisOptimizedBrushOutline & path,
int thickness = 1 )

paintToolOutline() is called from drawDecorations(), which has clipping set only for QPainter-based painting; here we paint in native mode, so we should care about clipping manually

d->updateRect might be empty in case the fractional DPI workaround is active.

Definition at line 327 of file kis_opengl_canvas2.cpp.

328{
337 const QRect updateRect = d->updateRect ? *d->updateRect : QRect();
338
339 d->renderer->paintToolOutline(path, updateRect, thickness);
340}
void paintToolOutline(const KisOptimizedBrushOutline &path, const QRect &viewportUpdateRect, const int thickness=1)

References d, KisOpenGLCanvasRenderer::paintToolOutline(), KisOpenGLCanvas2::Private::renderer, and KisOpenGLCanvas2::Private::updateRect.

◆ resizeGL()

void KisOpenGLCanvas2::resizeGL ( int width,
int height )
override

Definition at line 226 of file kis_opengl_canvas2.cpp.

227{
228 d->renderer->resizeGL(width, height);
229 d->canvasImageDirtyRect = QRect(0, 0, width, height);
230}
void resizeGL(int width, int height)

References KisOpenGLCanvas2::Private::canvasImageDirtyRect, d, KisOpenGLCanvas2::Private::renderer, and KisOpenGLCanvasRenderer::resizeGL().

◆ setDisplayConfig()

void KisOpenGLCanvas2::setDisplayConfig ( const KisDisplayConfig & config)
overridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 410 of file kis_opengl_canvas2.cpp.

411{
412 KisOpenGLContextSwitchLockSkipOnQt5 contextLock(this);
413 d->renderer->setDisplayConfig(config);
414}
void setDisplayConfig(const KisDisplayConfig &config)

References d, KisOpenGLCanvas2::Private::renderer, and KisOpenGLCanvasRenderer::setDisplayConfig().

◆ setDisplayFilter()

void KisOpenGLCanvas2::setDisplayFilter ( QSharedPointer< KisDisplayFilter > displayFilter)
overridevirtual

set the specified display filter on the canvas

Implements KisAbstractCanvasWidget.

Definition at line 186 of file kis_opengl_canvas2.cpp.

187{
188 KisOpenGLContextSwitchLockSkipOnQt5 contextLock(this);
189 d->renderer->setDisplayFilter(displayFilter);
190}
void setDisplayFilter(QSharedPointer< KisDisplayFilter > displayFilter)

References d, KisOpenGLCanvas2::Private::renderer, and KisOpenGLCanvasRenderer::setDisplayFilter().

◆ setLodResetInProgress()

void KisOpenGLCanvas2::setLodResetInProgress ( bool value)
overridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 349 of file kis_opengl_canvas2.cpp.

350{
352}
float value(const T *src, size_t ch)

References d, KisOpenGLCanvas2::Private::renderer, KisOpenGLCanvasRenderer::setLodResetInProgress(), and value().

◆ setWrapAroundViewingMode()

void KisOpenGLCanvas2::setWrapAroundViewingMode ( bool value)
overridevirtual

◆ setWrapAroundViewingModeAxis()

void KisOpenGLCanvas2::setWrapAroundViewingModeAxis ( WrapAroundAxis value)
overridevirtual

◆ showEvent()

void KisOpenGLCanvas2::showEvent ( QShowEvent * event)
override

Definition at line 404 of file kis_opengl_canvas2.cpp.

405{
406 QOpenGLWidget::showEvent(e);
408}

References KisCanvasWidgetBase::notifyDecorationsWindowMinimized().

◆ slotConfigChanged

◆ slotPixelGridModeChanged

void KisOpenGLCanvas2::slotPixelGridModeChanged ( )
slot

◆ slotShowFloatingMessage

void KisOpenGLCanvas2::slotShowFloatingMessage ( const QString & message,
int timeout,
bool priority )
privateslot

Definition at line 373 of file kis_opengl_canvas2.cpp.

374{
375 canvas()->imageView()->showFloatingMessage(message, QIcon(), timeout, priority ? KisFloatingMessage::High : KisFloatingMessage::Medium);
376}
QPointer< KisView > imageView() const
The KisFloatingMessage class shows the given message in a semi-transparent bubble that doesn't take f...

References KisCanvasWidgetBase::canvas(), KisFloatingMessage::High, KisCanvas2::imageView(), and KisFloatingMessage::Medium.

◆ slotUpdateCursorColor

void KisOpenGLCanvas2::slotUpdateCursorColor ( )
slot

◆ startUpdateCanvasProjection()

KisUpdateInfoSP KisOpenGLCanvas2::startUpdateCanvasProjection ( const QRect & rc)
overridevirtual

◆ updateCanvasDecorations()

void KisOpenGLCanvas2::updateCanvasDecorations ( const QRect & decoUpdateRect)
overridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 451 of file kis_opengl_canvas2.cpp.

452{
453 update(decoUpdateRect);
454}

◆ updateCanvasImage()

void KisOpenGLCanvas2::updateCanvasImage ( const QRect & imageUpdateRect)
overridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 445 of file kis_opengl_canvas2.cpp.

446{
447 d->canvasImageDirtyRect |= imageUpdateRect;
448 update(imageUpdateRect);
449}

References KisOpenGLCanvas2::Private::canvasImageDirtyRect, and d.

◆ updateCanvasProjection() [1/2]

QVector< QRect > KisOpenGLCanvas2::updateCanvasProjection ( const QVector< KisUpdateInfoSP > & infoObjects)
overridevirtual

Reimplemented from KisCanvasWidgetBase.

Definition at line 439 of file kis_opengl_canvas2.cpp.

440{
441 KisOpenGLContextSwitchLockSkipOnQt5 contextLock(this);
443}
QVector< QRect > updateCanvasProjection(const QVector< KisUpdateInfoSP > &infoObjects) override

References KisCanvasWidgetBase::updateCanvasProjection().

◆ updateCanvasProjection() [2/2]

QRect KisOpenGLCanvas2::updateCanvasProjection ( KisUpdateInfoSP info)
overridevirtual

Reimplemented from KisCanvasWidgetBase.

Definition at line 434 of file kis_opengl_canvas2.cpp.

435{
436 return d->renderer->updateCanvasProjection(info);
437}
QRect updateCanvasProjection(KisUpdateInfoSP info)

References d, KisOpenGLCanvas2::Private::renderer, and KisOpenGLCanvasRenderer::updateCanvasProjection().

◆ widget()

QWidget * KisOpenGLCanvas2::widget ( )
inlineoverridevirtual

Implements KisAbstractCanvasWidget.

Definition at line 86 of file kis_opengl_canvas2.h.

86 {
87 return this;
88 }

◆ wrapAroundViewingMode()

bool KisOpenGLCanvas2::wrapAroundViewingMode ( ) const
overridevirtual

◆ wrapAroundViewingModeAxis()

WrapAroundAxis KisOpenGLCanvas2::wrapAroundViewingModeAxis ( ) const
overridevirtual

Member Data Documentation

◆ d

Private* const KisOpenGLCanvas2::d
private

Definition at line 111 of file kis_opengl_canvas2.h.


The documentation for this class was generated from the following files: