linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com,
	Yordan Karadzhov <ykaradzhov@vmware.com>
Subject: [PATCH 5/6] kernel-shark: Improve the appearance on high screen resolution
Date: Wed, 15 May 2019 12:09:10 -0700	[thread overview]
Message-ID: <20190515190911.20755-6-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20190515190911.20755-1-ykaradzhov@vmware.com>

Some of the components of the plots haven't been properly scaled
when displayed on high screen resolution.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/src/KsGLWidget.cpp  | 24 ++++++++++++++----------
 kernel-shark/src/KsGLWidget.hpp  |  2 +-
 kernel-shark/src/KsPlotTools.cpp |  4 +++-
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp
index 789514a..ce68052 100644
--- a/kernel-shark/src/KsGLWidget.cpp
+++ b/kernel-shark/src/KsGLWidget.cpp
@@ -84,24 +84,29 @@ void KsGLWidget::resizeGL(int w, int h)
 /** Reimplemented function used to plot trace graphs. */
 void KsGLWidget::paintGL()
 {
+	float size = 1.5 * _dpr;
+
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	/* Draw the time axis. */
 	if(_data)
-		_drawAxisX();
+		_drawAxisX(size);
 
 	/* Process and draw all graphs by using the built-in logic. */
 	_makeGraphs(_cpuList, _taskList);
 	for (auto const &g: _graphs)
-		g->draw(1.5 * _dpr);
+		g->draw(size);
 
 	/* Process and draw all plugin-specific shapes. */
 	_makePluginShapes(_cpuList, _taskList);
 	while (!_shapes.empty()) {
 		auto s = _shapes.front();
+		_shapes.pop_front();
+
+		s->_size = size;
 		s->draw();
+
 		delete s;
-		_shapes.pop_front();
 	}
 
 	/*
@@ -448,22 +453,21 @@ void KsGLWidget::findGraphIds(const kshark_entry &e,
 		*graphTask = -1;
 }
 
-void KsGLWidget::_drawAxisX()
+void KsGLWidget::_drawAxisX(float size)
 {
 	KsPlot::Point a0(_hMargin, _vMargin / 4), a1(_hMargin, _vMargin / 2);
-	KsPlot::Point b0(width()/2, _vMargin / 4), b1(width() / 2, _vMargin / 2);
+	KsPlot::Point b0(width() / 2, _vMargin / 4), b1(width() / 2, _vMargin / 2);
 	KsPlot::Point c0(width() - _hMargin, _vMargin / 4),
 			 c1(width() - _hMargin, _vMargin / 2);
-	int lineSize = 2 * _dpr;
 
 	a0._size = c0._size = _dpr;
 
 	a0.draw();
 	c0.draw();
-	KsPlot::drawLine(a0, a1, {}, lineSize);
-	KsPlot::drawLine(b0, b1, {}, lineSize);
-	KsPlot::drawLine(c0, c1, {}, lineSize);
-	KsPlot::drawLine(a0, c0, {}, lineSize);
+	KsPlot::drawLine(a0, a1, {}, size);
+	KsPlot::drawLine(b0, b1, {}, size);
+	KsPlot::drawLine(c0, c1, {}, size);
+	KsPlot::drawLine(a0, c0, {}, size);
 }
 
 void KsGLWidget::_makeGraphs(QVector<int> cpuList, QVector<int> taskList)
diff --git a/kernel-shark/src/KsGLWidget.hpp b/kernel-shark/src/KsGLWidget.hpp
index bc5cacf..e141b0a 100644
--- a/kernel-shark/src/KsGLWidget.hpp
+++ b/kernel-shark/src/KsGLWidget.hpp
@@ -190,7 +190,7 @@ private:
 
 	int 		_dpr;
 
-	void _drawAxisX();
+	void _drawAxisX(float size);
 
 	void _makeGraphs(QVector<int> cpuMask, QVector<int> taskMask);
 
diff --git a/kernel-shark/src/KsPlotTools.cpp b/kernel-shark/src/KsPlotTools.cpp
index 2b16a51..f95ada5 100644
--- a/kernel-shark/src/KsPlotTools.cpp
+++ b/kernel-shark/src/KsPlotTools.cpp
@@ -1089,8 +1089,10 @@ void Graph::draw(float size)
 	/* Draw as vartical lines all bins containing data. */
 	for (int i = 0; i < _size; ++i)
 		if (_bins[i]._idFront >= 0 || _bins[i]._idBack >= 0)
-			if (_bins[i]._visMask & KS_EVENT_VIEW_FILTER_MASK)
+			if (_bins[i]._visMask & KS_EVENT_VIEW_FILTER_MASK) {
+				_bins[i]._size = size;
 				_bins[i].draw();
+			}
 
 	auto lamCheckEnsblVal = [this] (int v) {
 		return v > 0 || (v == 0 && !this->_zeroSuppress);
-- 
2.20.1


  parent reply	other threads:[~2019-05-15 19:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 19:09 [PATCH 0/6] Various modifications and fixes toward KS 1.0 Yordan Karadzhov
2019-05-15 19:09 ` [PATCH 1/6] kernel-shark: Remove hard-coded install paths Yordan Karadzhov
2019-05-15 19:09 ` [PATCH 2/6] kernel-shark: Use XDG compliant path when saving cached data Yordan Karadzhov
2019-05-15 19:09 ` [PATCH 3/6] kernel-shark: Enforce update of the OpenGL widget when loading new session Yordan Karadzhov
2019-05-15 19:09 ` [PATCH 4/6] kernel-shark: Add "Report bug" button to "Help" Yordan Karadzhov
2019-05-15 19:09 ` Yordan Karadzhov [this message]
2019-05-15 19:09 ` [PATCH 6/6] kernel-shark: Handle the case when the marker points to a filtered entry Yordan Karadzhov
2019-05-16 13:42 ` [PATCH 0/6] Various modifications and fixes toward KS 1.0 Slavomir Kaslev
2019-05-21 13:59   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190515190911.20755-6-ykaradzhov@vmware.com \
    --to=ykaradzhov@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).