]> git.sesse.net Git - kdenlive/blob - src/scopes/colorscopes/abstractgfxscopewidget.cpp
Fix crash in scopes: http://kdenlive.org/mantis/view.php?id=2779
[kdenlive] / src / scopes / colorscopes / abstractgfxscopewidget.cpp
1 /***************************************************************************
2  *   Copyright (C) 2010 by Simon Andreas Eugster (simon.eu@gmail.com)      *
3  *   This file is part of kdenlive. See www.kdenlive.org.                  *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10
11 #include "abstractgfxscopewidget.h"
12 #include "renderer.h"
13 #include "monitormanager.h"
14
15 #include <QtConcurrentRun>
16 #include <QFuture>
17 #include <QColor>
18 #include <QMenu>
19 #include <QMouseEvent>
20 #include <QPainter>
21
22 // Uncomment for debugging.
23 //#define DEBUG_AGSW
24
25 #ifdef DEBUG_AGSW
26 #include <QDebug>
27 #endif
28
29 const int REALTIME_FPS = 30;
30
31 AbstractGfxScopeWidget::AbstractGfxScopeWidget(bool trackMouse, QWidget *parent) :
32         AbstractScopeWidget(trackMouse, parent)
33 {
34 }
35
36 AbstractGfxScopeWidget::~AbstractGfxScopeWidget() { }
37
38 QImage AbstractGfxScopeWidget::renderScope(uint accelerationFactor)
39 {
40     QMutexLocker lock(&m_mutex);
41     return renderGfxScope(accelerationFactor, m_scopeImage);
42 }
43
44 void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event)
45 {
46     AbstractScopeWidget::mouseReleaseEvent(event);
47     emit signalFrameRequest(widgetName());
48 }
49
50
51 ///// Slots /////
52
53
54 void AbstractGfxScopeWidget::slotRenderZoneUpdated(const QImage frame)
55 {
56     QMutexLocker lock(&m_mutex);
57     m_scopeImage = frame;
58     AbstractScopeWidget::slotRenderZoneUpdated();
59 }
60
61 void AbstractGfxScopeWidget::slotAutoRefreshToggled(bool autoRefresh)
62 {
63     if (autoRefresh) {
64         emit signalFrameRequest(widgetName());
65     }
66 }
67
68
69 #ifdef DEBUG_AGSW
70 #undef DEBUG_AGSW
71 #endif