Add "This effect is not a benchmark" to FPS Effect

Underneath the graph the text "This effect is not a benchmark" is
rendered.

REVIEW: 109869
This commit is contained in:
Martin Gräßlin 2013-04-05 16:22:53 +02:00
parent cfd36fb32e
commit 10002e2006
2 changed files with 7 additions and 0 deletions

View file

@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <xcb/render.h> #include <xcb/render.h>
#endif #endif
#include <KDE/KLocalizedString>
#include <math.h> #include <math.h>
#include <QPainter> #include <QPainter>
#include <QVector2D> #include <QVector2D>
@ -47,6 +48,7 @@ ShowFpsEffect::ShowFpsEffect()
: paints_pos(0) : paints_pos(0)
, frames_pos(0) , frames_pos(0)
, fpsText(0) , fpsText(0)
, m_noBenchmark(effects->effectFrame(EffectFrameUnstyled, false))
{ {
for (int i = 0; for (int i = 0;
i < NUM_PAINTS; i < NUM_PAINTS;
@ -58,6 +60,8 @@ ShowFpsEffect::ShowFpsEffect()
i < MAX_FPS; i < MAX_FPS;
++i) ++i)
frames[ i ] = 0; frames[ i ] = 0;
m_noBenchmark->setAlignment(Qt::AlignTop | Qt::AlignRight);
m_noBenchmark->setText(i18n("This effect is not a benchmark"));
reconfigure(ReconfigureAll); reconfigure(ReconfigureAll);
} }
@ -76,6 +80,7 @@ void ShowFpsEffect::reconfigure(ReconfigureFlags)
else if (y < 0) else if (y < 0)
y = displayHeight() - MAX_TIME - y; y = displayHeight() - MAX_TIME - y;
fps_rect = QRect(x, y, FPS_WIDTH + 2 * NUM_PAINTS, MAX_TIME); fps_rect = QRect(x, y, FPS_WIDTH + 2 * NUM_PAINTS, MAX_TIME);
m_noBenchmark->setPosition(fps_rect.bottomRight() + QPoint(-6, 6));
int textPosition = ShowFpsConfig::textPosition(); int textPosition = ShowFpsConfig::textPosition();
textFont = ShowFpsConfig::textFont(); textFont = ShowFpsConfig::textFont();
@ -164,6 +169,7 @@ void ShowFpsEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data)
XSync(display(), False); // make sure all rendering is done XSync(display(), False); // make sure all rendering is done
} }
#endif #endif
m_noBenchmark->render(infiniteRegion(), 1.0, alpha);
} }
void ShowFpsEffect::paintGL(int fps) void ShowFpsEffect::paintGL(int fps)

View file

@ -99,6 +99,7 @@ private:
QColor textColor; QColor textColor;
QRect fpsTextRect; QRect fpsTextRect;
int textAlign; int textAlign;
QScopedPointer<EffectFrame> m_noBenchmark;
}; };
} // namespace } // namespace