[sysprof/wip/visualizers] line-visualizer-row: use scaled surface when available
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/visualizers] line-visualizer-row: use scaled surface when available
- Date: Tue, 27 Sep 2016 06:28:17 +0000 (UTC)
commit 1dcb41f623585a2b7b1f163821067d60c7739a86
Author: Christian Hergert <chergert redhat com>
Date: Mon Sep 26 23:24:17 2016 -0700
line-visualizer-row: use scaled surface when available
If we have not yet received our proper draw for the new size
allocation (likely right after the size allocate), then we can
just use the old surface but at a scaled value. This is handy
so that we don't block the main loop trying to do drawing of
lots of data points. Instead we just scale the image and wait
for the high-quality version to complete.
lib/sp-line-visualizer-row.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/lib/sp-line-visualizer-row.c b/lib/sp-line-visualizer-row.c
index 4c7ac70..670a6eb 100644
--- a/lib/sp-line-visualizer-row.c
+++ b/lib/sp-line-visualizer-row.c
@@ -246,7 +246,10 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
*/
if (width != alloc.width || height != alloc.height)
{
- /* TODO: Handle intermediate scaling */
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_scale (cr, (gdouble)alloc.width / (gdouble)width, (gdouble)alloc.height / (gdouble)height);
+ cairo_set_source_surface (cr, priv->surface, 0, 0);
+ cairo_fill (cr);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]