forked from qt-creator/qt-creator
QmlProfiler: optimizations in canvas repaint
Change-Id: I866f8941129c5a42256f40dca4e4c4fe15b5a760 Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -2,10 +2,10 @@ INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += $$PWD/qdeclarativecontext2d_p.h \
|
||||
$$PWD/qdeclarativecanvas_p.h \
|
||||
$$PWD/qdeclarativetiledcanvas_p.h \
|
||||
$$PWD/qmlprofilercanvas.h \
|
||||
$$PWD/qdeclarativecanvastimer_p.h
|
||||
|
||||
SOURCES += $$PWD/qdeclarativecontext2d.cpp \
|
||||
$$PWD/qdeclarativecanvas.cpp \
|
||||
$$PWD/qdeclarativetiledcanvas.cpp \
|
||||
$$PWD/qmlprofilercanvas.cpp \
|
||||
$$PWD/qdeclarativecanvastimer.cpp
|
||||
|
@@ -1,163 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
** This file is part of the examples of the Qt Toolkit.
|
||||
**
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
|
||||
** the names of its contributors may be used to endorse or promote
|
||||
** products derived from this software without specific prior written
|
||||
** permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qdeclarativetiledcanvas_p.h"
|
||||
|
||||
#include "qdeclarativecontext2d_p.h"
|
||||
|
||||
#include <QtGui/qpixmap.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
|
||||
TiledCanvas::TiledCanvas()
|
||||
: m_context2d(new Context2D(this)), m_canvasSize(-1, -1), m_tileSize(100, 100)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemHasNoContents, false);
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
}
|
||||
|
||||
QSizeF TiledCanvas::canvasSize() const
|
||||
{
|
||||
return m_canvasSize;
|
||||
}
|
||||
|
||||
void TiledCanvas::setCanvasSize(const QSizeF &v)
|
||||
{
|
||||
if (m_canvasSize != v) {
|
||||
m_canvasSize = v;
|
||||
emit canvasSizeChanged();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QSize TiledCanvas::tileSize() const
|
||||
{
|
||||
return m_tileSize;
|
||||
}
|
||||
|
||||
void TiledCanvas::setTileSize(const QSize &v)
|
||||
{
|
||||
if (v != m_tileSize) {
|
||||
m_tileSize = v;
|
||||
emit tileSizeChanged();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QRectF TiledCanvas::canvasWindow() const
|
||||
{
|
||||
return m_canvasWindow;
|
||||
}
|
||||
|
||||
void TiledCanvas::setCanvasWindow(const QRectF &v)
|
||||
{
|
||||
if (m_canvasWindow != v) {
|
||||
m_canvasWindow = v;
|
||||
emit canvasWindowChanged();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void TiledCanvas::requestPaint()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void TiledCanvas::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
|
||||
{
|
||||
if (m_context2d->size() != m_tileSize)
|
||||
m_context2d->setSize(m_tileSize);
|
||||
|
||||
const int tw = m_tileSize.width();
|
||||
const int th = m_tileSize.height();
|
||||
|
||||
int h1 = m_canvasWindow.left() / tw;
|
||||
int htiles = ((m_canvasWindow.right() - h1 * tw) + tw - 1) / tw;
|
||||
|
||||
int v1 = m_canvasWindow.top() / th;
|
||||
int vtiles = ((m_canvasWindow.bottom() - v1 * th) + th - 1) / th;
|
||||
|
||||
for (int yy = 0; yy < vtiles; ++yy) {
|
||||
for (int xx = 0; xx < htiles; ++xx) {
|
||||
int ht = xx + h1;
|
||||
int vt = yy + v1;
|
||||
|
||||
m_context2d->reset();
|
||||
m_context2d->setPainterTranslate(QPoint(-ht * tw, -vt * th));
|
||||
|
||||
emit drawRegion(m_context2d, QRect(ht * tw, vt * th, tw, th));
|
||||
|
||||
p->drawPixmap(-m_canvasWindow.x() + ht * tw, -m_canvasWindow.y() + vt * th, m_context2d->pixmap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TiledCanvas::componentComplete()
|
||||
{
|
||||
const QMetaObject *metaObject = this->metaObject();
|
||||
int propertyCount = metaObject->propertyCount();
|
||||
int requestPaintMethod = metaObject->indexOfMethod("requestPaint()");
|
||||
for (int ii = TiledCanvas::staticMetaObject.propertyCount(); ii < propertyCount; ++ii) {
|
||||
QMetaProperty p = metaObject->property(ii);
|
||||
if (p.hasNotifySignal())
|
||||
QMetaObject::connect(this, p.notifySignalIndex(), this, requestPaintMethod, 0, 0);
|
||||
}
|
||||
QDeclarativeItem::componentComplete();
|
||||
}
|
||||
|
||||
|
||||
void TiledCanvas::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
}
|
||||
|
||||
QPixmap TiledCanvas::getTile(int xx, int yy)
|
||||
{
|
||||
QPixmap pix(m_tileSize);
|
||||
|
||||
pix.fill(Qt::green);
|
||||
|
||||
QString text = QString::number(xx) + QLatin1Char(' ') + QString::number(yy);
|
||||
|
||||
QPainter p(&pix);
|
||||
p.drawText(pix.rect(), Qt::AlignHCenter | Qt::AlignVCenter, text);
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
@@ -1,123 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QDECLARATIVETILEDCANVAS_P_H
|
||||
#define QDECLARATIVETILEDCANVAS_P_H
|
||||
|
||||
#include <QtDeclarative/qdeclarativeitem.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_MODULE(Declarative)
|
||||
class Context2D;
|
||||
class TiledCanvas : public QDeclarativeItem
|
||||
{
|
||||
Q_OBJECT/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
Q_PROPERTY(QSizeF canvasSize READ canvasSize WRITE setCanvasSize NOTIFY canvasSizeChanged)
|
||||
Q_PROPERTY(QSize tileSize READ tileSize WRITE setTileSize NOTIFY tileSizeChanged)
|
||||
Q_PROPERTY(QRectF canvasWindow READ canvasWindow WRITE setCanvasWindow NOTIFY canvasWindowChanged)
|
||||
|
||||
public:
|
||||
TiledCanvas();
|
||||
|
||||
QSizeF canvasSize() const;
|
||||
void setCanvasSize(const QSizeF &);
|
||||
|
||||
QSize tileSize() const;
|
||||
void setTileSize(const QSize &);
|
||||
|
||||
QRectF canvasWindow() const;
|
||||
void setCanvasWindow(const QRectF &);
|
||||
|
||||
Q_SIGNALS:
|
||||
void canvasSizeChanged();
|
||||
void tileSizeChanged();
|
||||
void canvasWindowChanged();
|
||||
|
||||
void drawRegion(Context2D *ctxt, const QRect ®ion);
|
||||
|
||||
public Q_SLOTS:
|
||||
void requestPaint();
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
virtual void componentComplete();
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
private:
|
||||
QPixmap getTile(int, int);
|
||||
|
||||
Context2D *m_context2d;
|
||||
|
||||
QSizeF m_canvasSize;
|
||||
QSize m_tileSize;
|
||||
QRectF m_canvasWindow;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QDECLARATIVETILEDCANVAS_P_H
|
93
src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp
Normal file
93
src/plugins/qmlprofiler/canvas/qmlprofilercanvas.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "qmlprofilercanvas.h"
|
||||
|
||||
#include "qdeclarativecontext2d_p.h"
|
||||
|
||||
#include <QtGui/qpixmap.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
QmlProfilerCanvas::QmlProfilerCanvas()
|
||||
: m_context2d(new Context2D(this))
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemHasNoContents, false);
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||
}
|
||||
|
||||
void QmlProfilerCanvas::requestPaint()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
void QmlProfilerCanvas::requestRedraw()
|
||||
{
|
||||
setDirty(true);
|
||||
update();
|
||||
}
|
||||
|
||||
void QmlProfilerCanvas::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
|
||||
{
|
||||
if (m_context2d->size().width() != width() || m_context2d->size().height() != height()) {
|
||||
m_dirty = true;
|
||||
m_context2d->setSize(width(), height());
|
||||
}
|
||||
|
||||
if (m_dirty) {
|
||||
m_context2d->reset();
|
||||
|
||||
emit drawRegion(m_context2d, QRect(0, 0, width(), height()));
|
||||
setDirty(false);
|
||||
}
|
||||
|
||||
p->drawPixmap(0, 0, m_context2d->pixmap());
|
||||
}
|
||||
|
||||
void QmlProfilerCanvas::componentComplete()
|
||||
{
|
||||
const QMetaObject *metaObject = this->metaObject();
|
||||
int propertyCount = metaObject->propertyCount();
|
||||
int requestPaintMethod = metaObject->indexOfMethod("requestPaint()");
|
||||
for (int ii = QmlProfilerCanvas::staticMetaObject.propertyCount(); ii < propertyCount; ++ii) {
|
||||
QMetaProperty p = metaObject->property(ii);
|
||||
if (p.hasNotifySignal())
|
||||
QMetaObject::connect(this, p.notifySignalIndex(), this, requestPaintMethod, 0, 0);
|
||||
}
|
||||
QDeclarativeItem::componentComplete();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
83
src/plugins/qmlprofiler/canvas/qmlprofilercanvas.h
Normal file
83
src/plugins/qmlprofiler/canvas/qmlprofilercanvas.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (info@qt.nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at info@qt.nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef QMLPROFILERCANVAS_H
|
||||
#define QMLPROFILERCANVAS_H
|
||||
|
||||
#include <QtDeclarative/QDeclarativeItem>
|
||||
|
||||
class Context2D;
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
class QmlProfilerCanvas : public QDeclarativeItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)
|
||||
|
||||
public:
|
||||
QmlProfilerCanvas();
|
||||
|
||||
bool dirty() const { return m_dirty; }
|
||||
void setDirty(bool dirty)
|
||||
{
|
||||
if (m_dirty != dirty) {
|
||||
m_dirty = dirty;
|
||||
emit dirtyChanged(dirty);
|
||||
}
|
||||
}
|
||||
|
||||
signals:
|
||||
void dirtyChanged(bool dirty);
|
||||
|
||||
void drawRegion(Context2D *ctxt, const QRect ®ion);
|
||||
|
||||
public slots:
|
||||
void requestPaint();
|
||||
void requestRedraw();
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
virtual void componentComplete();
|
||||
|
||||
private:
|
||||
Context2D *m_context2d;
|
||||
|
||||
bool m_dirty;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QMLPROFILERCANVAS_H
|
@@ -46,7 +46,7 @@ Item {
|
||||
var rE = labels.rowExpanded;
|
||||
rE[typeIndex] = expanded;
|
||||
labels.rowExpanded = rE;
|
||||
backgroundMarks.requestPaint();
|
||||
backgroundMarks.requestRedraw();
|
||||
view.rowExpanded(typeIndex, expanded);
|
||||
updateHeight();
|
||||
}
|
||||
|
@@ -37,12 +37,12 @@ var qmlEventList = 0;
|
||||
//draw background of the graph
|
||||
function drawGraph(canvas, ctxt, region)
|
||||
{
|
||||
var grad = ctxt.createLinearGradient(0, 0, 0, canvas.canvasSize.height);
|
||||
var grad = ctxt.createLinearGradient(0, 0, 0, canvas.height);
|
||||
grad.addColorStop(0, '#fff');
|
||||
grad.addColorStop(1, '#ccc');
|
||||
ctxt.fillStyle = grad;
|
||||
|
||||
ctxt.fillRect(0, 0, canvas.canvasSize.width, canvas.canvasSize.height);
|
||||
ctxt.fillRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
//draw the actual data to be graphed
|
||||
@@ -51,7 +51,7 @@ function drawData(canvas, ctxt, region)
|
||||
if ((!qmlEventList) || qmlEventList.count() == 0)
|
||||
return;
|
||||
|
||||
var width = canvas.canvasSize.width;
|
||||
var width = canvas.width;
|
||||
var height = canvas.height;
|
||||
|
||||
var sumValue = qmlEventList.traceEndTime() - qmlEventList.traceStartTime();
|
||||
|
@@ -34,7 +34,7 @@ import QtQuick 1.0
|
||||
import Monitor 1.0
|
||||
import "Overview.js" as Plotter
|
||||
|
||||
TiledCanvas {
|
||||
Canvas2D {
|
||||
id: canvas
|
||||
|
||||
// ***** properties
|
||||
@@ -43,20 +43,11 @@ TiledCanvas {
|
||||
property variant startTime : 0
|
||||
property variant endTime : 0
|
||||
|
||||
canvasSize.width: canvas.width
|
||||
canvasSize.height: canvas.height
|
||||
|
||||
tileSize.width: width
|
||||
tileSize.height: height
|
||||
|
||||
canvasWindow.width: width
|
||||
canvasWindow.height: height
|
||||
|
||||
// ***** functions
|
||||
function clearDisplay()
|
||||
{
|
||||
dataAvailable = false;
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
|
||||
function updateRange() {
|
||||
@@ -89,7 +80,7 @@ TiledCanvas {
|
||||
onDataReady: {
|
||||
if (qmlEventList.count() > 0) {
|
||||
dataAvailable = true;
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -33,39 +33,33 @@
|
||||
import QtQuick 1.0
|
||||
import Monitor 1.0
|
||||
|
||||
TiledCanvas {
|
||||
Canvas2D {
|
||||
id: timeDisplay
|
||||
|
||||
property variant startTime : 0
|
||||
property variant endTime : 0
|
||||
property variant timePerPixel: 0
|
||||
|
||||
canvasSize.width: timeDisplay.width
|
||||
canvasSize.height: timeDisplay.height
|
||||
tileSize.width: width
|
||||
tileSize.height: height
|
||||
canvasWindow.width: width
|
||||
canvasWindow.height: height
|
||||
|
||||
Component.onCompleted: {
|
||||
requestRedraw();
|
||||
}
|
||||
onWidthChanged: {
|
||||
requestRedraw();
|
||||
}
|
||||
onHeightChanged: {
|
||||
requestRedraw();
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: zoomControl
|
||||
onRangeChanged: {
|
||||
startTime = zoomControl.startTime();
|
||||
endTime = zoomControl.endTime();
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
requestPaint();
|
||||
}
|
||||
onWidthChanged: {
|
||||
requestPaint();
|
||||
}
|
||||
onHeightChanged: {
|
||||
requestPaint();
|
||||
}
|
||||
|
||||
onDrawRegion: {
|
||||
ctxt.fillStyle = "white";
|
||||
ctxt.fillRect(0, 0, width, height);
|
||||
@@ -89,7 +83,7 @@ TiledCanvas {
|
||||
ctxt.font = "8px sans-serif";
|
||||
for (var ii = 0; ii < blockCount+1; ii++) {
|
||||
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
|
||||
ctxt.strokeStyle = "#909090";
|
||||
ctxt.strokeStyle = "#C0C0C0";
|
||||
ctxt.beginPath();
|
||||
ctxt.moveTo(x, 0);
|
||||
ctxt.lineTo(x, height);
|
||||
|
@@ -33,30 +33,22 @@
|
||||
import QtQuick 1.0
|
||||
import Monitor 1.0
|
||||
|
||||
TiledCanvas {
|
||||
Canvas2D {
|
||||
id: timeDisplay
|
||||
|
||||
property variant startTime
|
||||
property variant endTime
|
||||
property variant timePerPixel
|
||||
|
||||
canvasSize.width: timeDisplay.width
|
||||
canvasSize.height: timeDisplay.height
|
||||
|
||||
tileSize.width: width
|
||||
tileSize.height: height
|
||||
canvasWindow.width: width
|
||||
canvasWindow.height: height
|
||||
|
||||
Component.onCompleted: {
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
|
||||
onWidthChanged: {
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
onHeightChanged: {
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
|
||||
onDrawRegion: {
|
||||
@@ -81,13 +73,13 @@ TiledCanvas {
|
||||
ctxt.font = "8px sans-serif";
|
||||
for (var ii = 0; ii < blockCount+1; ii++) {
|
||||
var x = Math.floor(ii*pixelsPerBlock - realStartPos);
|
||||
ctxt.strokeStyle = "#909090";
|
||||
ctxt.strokeStyle = "#C0C0C0";
|
||||
ctxt.beginPath();
|
||||
ctxt.moveTo(x, 0);
|
||||
ctxt.lineTo(x, height);
|
||||
ctxt.stroke();
|
||||
|
||||
ctxt.strokeStyle = "#C0C0C0";
|
||||
ctxt.strokeStyle = "#E0E0E0";
|
||||
for (var jj=1; jj < 5; jj++) {
|
||||
var xx = Math.floor(ii*pixelsPerBlock + jj*pixelsPerSection - realStartPos);
|
||||
ctxt.beginPath();
|
||||
@@ -102,7 +94,7 @@ TiledCanvas {
|
||||
if (startTime !== start || endTime !== end) {
|
||||
startTime = start;
|
||||
endTime = end;
|
||||
requestPaint();
|
||||
requestRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,9 +32,6 @@
|
||||
|
||||
#include "qmlprofilerengine.h"
|
||||
|
||||
#include "canvas/qdeclarativecanvas_p.h"
|
||||
#include "canvas/qdeclarativecontext2d_p.h"
|
||||
#include "canvas/qdeclarativetiledcanvas_p.h"
|
||||
#include "codaqmlprofilerrunner.h"
|
||||
#include "localqmlprofilerrunner.h"
|
||||
#include "remotelinuxqmlprofilerrunner.h"
|
||||
|
@@ -48,8 +48,8 @@
|
||||
#include <analyzerbase/analyzerruncontrol.h>
|
||||
|
||||
#include "canvas/qdeclarativecanvas_p.h"
|
||||
#include "canvas/qdeclarativecontext2d_p.h"
|
||||
#include "canvas/qdeclarativetiledcanvas_p.h"
|
||||
#include "canvas/qdeclarativecanvastimer_p.h"
|
||||
#include "canvas/qmlprofilercanvas.h"
|
||||
|
||||
#include <qmlprojectmanager/qmlprojectrunconfiguration.h>
|
||||
#include <utils/fancymainwindow.h>
|
||||
@@ -139,7 +139,7 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
||||
connect(&d->m_connectionTimer, SIGNAL(timeout()), SLOT(tryToConnect()));
|
||||
|
||||
qmlRegisterType<Canvas>("Monitor", 1, 0, "Canvas");
|
||||
qmlRegisterType<TiledCanvas>("Monitor", 1, 0, "TiledCanvas");
|
||||
qmlRegisterType<QmlProfilerCanvas>("Monitor", 1, 0, "Canvas2D");
|
||||
qmlRegisterType<Context2D>();
|
||||
qmlRegisterType<CanvasImage>();
|
||||
qmlRegisterType<CanvasGradient>();
|
||||
|
Reference in New Issue
Block a user