Scroom  0.14
measure-framerate-callbacks.cc File Reference
Include dependency graph for measure-framerate-callbacks.cc:

Functions

static gboolean on_configure (GtkWidget *, GdkEventConfigure *, gpointer)
 
static void on_hide (GtkWidget *, gpointer)
 
static gboolean on_expose (GtkWidget *widget, GdkEventExpose *, gpointer)
 
static gboolean on_idle (gpointer)
 
GtkWidget * create_window ()
 
void init ()
 
void invalidate ()
 

Variables

std::vector< boost::function< bool()> > functions
 
static unsigned int current = 0
 
static GtkWidget * drawingArea = nullptr
 

Function Documentation

◆ create_window()

GtkWidget* create_window ( )
80 {
81  GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
82  gtk_window_set_title(GTK_WINDOW(window), "Measure Framerate");
83  gtk_window_maximize(GTK_WINDOW(window));
84 
85  g_signal_connect(static_cast<gpointer>(window), "hide", G_CALLBACK(on_hide), NULL);
86 
87  drawingArea = gtk_drawing_area_new();
88  gtk_container_add(GTK_CONTAINER(window), drawingArea);
89  g_signal_connect(static_cast<gpointer>(drawingArea), "draw", G_CALLBACK(on_expose), NULL);
90  g_signal_connect(static_cast<gpointer>(drawingArea), "configure_event", G_CALLBACK(on_configure), NULL);
91 
92  gtk_widget_show(drawingArea);
93  gtk_widget_show(window);
94 
95  return window;
96 }

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void init ( )
98 { gdk_threads_add_idle(on_idle, nullptr); }

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ invalidate()

void invalidate ( )
101 {
102  GdkWindow* window = gtk_widget_get_window(drawingArea);
103  gdk_window_invalidate_rect(window, nullptr, false);
104 }

Referenced by Invalidator::operator()(), and InvalidatingCounter::operator()().

Here is the caller graph for this function:

◆ on_configure()

static gboolean on_configure ( GtkWidget *  ,
GdkEventConfigure *  ,
gpointer   
)
static
24 {
25  // There should be a simpler way to do this...
26  cairo_region_t* r = gdk_window_get_visible_region(gtk_widget_get_window(drawingArea));
27  cairo_rectangle_int_t rect;
28  cairo_region_get_extents(r, &rect);
29 
30  drawingAreaWidth = rect.width;
31  drawingAreaHeight = rect.height;
32 
33  cairo_region_destroy(r);
34 
35  return FALSE;
36 }

Referenced by create_window().

Here is the caller graph for this function:

◆ on_expose()

static gboolean on_expose ( GtkWidget *  widget,
GdkEventExpose *  ,
gpointer   
)
static
41 {
42  cairo_region_t* re = cairo_region_create();
43 
44  GdkDrawingContext* dc;
45  dc = gdk_window_begin_draw_frame(gtk_widget_get_window(widget), re);
46 
47  cairo_t* cr = gdk_drawing_context_get_cairo_context(dc);
48 
49  if(testData)
50  {
51  testData->redraw(cr);
52  }
53 
54  gdk_window_end_draw_frame(gtk_widget_get_window(widget), dc);
55 
56  cairo_region_destroy(re);
57 
58  return FALSE;
59 }

Referenced by create_window().

Here is the caller graph for this function:

◆ on_hide()

static void on_hide ( GtkWidget *  ,
gpointer   
)
static
38 { gtk_main_quit(); }

Referenced by create_window().

Here is the caller graph for this function:

◆ on_idle()

static gboolean on_idle ( gpointer  )
static
62 {
63  if(current >= functions.size())
64  {
65  return false;
66  }
67 
68  if(!functions[current]())
69  {
70  current++;
71  }
72 
73  return true;
74 }

Referenced by init().

Here is the caller graph for this function:

Variable Documentation

◆ current

◆ drawingArea

GtkWidget* drawingArea = nullptr
static

◆ functions

functions
std::vector< boost::function< bool()> > functions
Definition: measure-framerate-callbacks.cc:16
drawingAreaHeight
int drawingAreaHeight
Definition: test-helpers.cc:23
current
static unsigned int current
Definition: measure-framerate-callbacks.cc:17
drawingArea
static GtkWidget * drawingArea
Definition: measure-framerate-callbacks.cc:18
on_configure
static gboolean on_configure(GtkWidget *, GdkEventConfigure *, gpointer)
Definition: measure-framerate-callbacks.cc:23
anonymous_namespace{sampleiterator-tests.cc}::testData
const uint8_t testData[]
Definition: sampleiterator-tests.cc:20
drawingAreaWidth
int drawingAreaWidth
Definition: test-helpers.cc:22
on_expose
static gboolean on_expose(GtkWidget *widget, GdkEventExpose *, gpointer)
Definition: measure-framerate-callbacks.cc:40
on_hide
static void on_hide(GtkWidget *, gpointer)
Definition: measure-framerate-callbacks.cc:38
on_idle
static gboolean on_idle(gpointer)
Definition: measure-framerate-callbacks.cc:61