linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [RFC PATCH v2 3/5] kernel-shark: Add text rendering to the plotting example
Date: Wed,  3 Jul 2019 15:10:21 +0300	[thread overview]
Message-ID: <20190703121023.16655-4-y.karadz@gmail.com> (raw)
In-Reply-To: <20190703121023.16655-1-y.karadz@gmail.com>

run:
kernel-shark/bin/dplot -s

And if the font file is loaded successfully you will see "Hello Kernel!"
rendered.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/examples/dataplot.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel-shark/examples/dataplot.cpp b/kernel-shark/examples/dataplot.cpp
index 94841e7..11b4fd9 100644
--- a/kernel-shark/examples/dataplot.cpp
+++ b/kernel-shark/examples/dataplot.cpp
@@ -44,6 +44,12 @@ void usage(const char *prog)
 /* An example function drawing something. */
 void drawShapes()
 {
+	char *font_file = ksplot_find_font_file("FreeMono", "FreeMonoBold");
+	struct ksplot_font font;
+
+	ksplot_init_font(&font, 40, font_file);
+	free(font_file);
+
 	/* Clear the screen. */
 	glClear(GL_COLOR_BUFFER_BIT);
 
@@ -57,6 +63,11 @@ void drawShapes()
 	t._color = {100, 200, 50};
 	t.draw();
 
+	/* Print/draw "Hello Kernel!". */
+	if (!ksplot_font_is_loaded(&font))
+		ksplot_print_text(&font, t._color.color_c_ptr(), 250, 70,
+				  "Hello Kernel!");
+
 	KsPlot::Rectangle r;
 	KsPlot::Point d(400, 200), e(400, 300), f(500, 300), g(500, 200);
 	r.setPoint(0, d);
-- 
2.20.1


  parent reply	other threads:[~2019-07-03 12:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03 12:10 [RFC PATCH v2 0/5] Add support for text rendering Yordan Karadzhov (VMware)
2019-07-03 12:10 ` [RFC PATCH v2 1/5] kernel-shark: Simplify the drawing of the Triangle Fan Yordan Karadzhov (VMware)
2019-07-03 12:10 ` [RFC PATCH v2 2/5] kernel-shark: Add support for drawing text Yordan Karadzhov (VMware)
2019-07-03 12:10 ` Yordan Karadzhov (VMware) [this message]
2019-07-03 12:10 ` [RFC PATCH v2 4/5] kernel-shark: Add hello_kernel plugin Yordan Karadzhov (VMware)
2019-07-03 12:10 ` [RFC PATCH v2 5/5] kernel-shark: Drop Freeglut as a compulsory dependency Yordan Karadzhov (VMware)
2019-07-05  9:13   ` Slavomir Kaslev
2019-07-05 10:25 ` [RFC PATCH v2 0/5] Add support for text rendering Slavomir Kaslev

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=20190703121023.16655-4-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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).