Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
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 ( )
78{
79 GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
80 gtk_window_set_title(GTK_WINDOW(window), "Measure Framerate");
81 gtk_window_maximize(GTK_WINDOW(window));
82
83 g_signal_connect(static_cast<gpointer>(window), "hide", G_CALLBACK(on_hide), NULL);
84
85 drawingArea = gtk_drawing_area_new();
86 gtk_container_add(GTK_CONTAINER(window), drawingArea);
87 g_signal_connect(static_cast<gpointer>(drawingArea), "draw", G_CALLBACK(on_expose), NULL);
88 g_signal_connect(static_cast<gpointer>(drawingArea), "configure_event", G_CALLBACK(on_configure), NULL);
89
90 gtk_widget_show(drawingArea);
91 gtk_widget_show(window);
92
93 return window;
94}
static gboolean on_configure(GtkWidget *, GdkEventConfigure *, gpointer)
Definition measure-framerate-callbacks.cc:21
static gboolean on_expose(GtkWidget *widget, GdkEventExpose *, gpointer)
Definition measure-framerate-callbacks.cc:38
static GtkWidget * drawingArea
Definition measure-framerate-callbacks.cc:16
static void on_hide(GtkWidget *, gpointer)
Definition measure-framerate-callbacks.cc:36

Referenced by main().

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

◆ init()

void init ( )
96{ gdk_threads_add_idle(on_idle, nullptr); }
static gboolean on_idle(gpointer)
Definition measure-framerate-callbacks.cc:59

Referenced by main().

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

◆ invalidate()

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

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
22{
23 // There should be a simpler way to do this...
24 cairo_region_t* r = gdk_window_get_visible_region(gtk_widget_get_window(drawingArea));
25 cairo_rectangle_int_t rect;
26 cairo_region_get_extents(r, &rect);
27
28 drawingAreaWidth = rect.width;
29 drawingAreaHeight = rect.height;
30
31 cairo_region_destroy(r);
32
33 return FALSE;
34}
const auto rect
Definition rectangletests.cc:335
int drawingAreaWidth
Definition test-helpers.cc:22
int drawingAreaHeight
Definition test-helpers.cc:23
Scroom::Utils::Rectangle< double > const r
Definition transformpresentation_test.cc:65

Referenced by create_window().

Here is the caller graph for this function:

◆ on_expose()

static gboolean on_expose ( GtkWidget *  widget,
GdkEventExpose *  ,
gpointer   
)
static
39{
40 cairo_region_t* re = cairo_region_create();
41
42 GdkDrawingContext* dc;
43 dc = gdk_window_begin_draw_frame(gtk_widget_get_window(widget), re);
44
45 cairo_t* cr = gdk_drawing_context_get_cairo_context(dc);
46
47 if(testData)
48 {
49 testData->redraw(cr);
50 }
51
52 gdk_window_end_draw_frame(gtk_widget_get_window(widget), dc);
53
54 cairo_region_destroy(re);
55
56 return FALSE;
57}
TestData::Ptr testData
Definition test-helpers.cc:25
cairo_t * cr
Definition transformpresentation_test.cc:72

Referenced by create_window().

Here is the caller graph for this function:

◆ on_hide()

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

Referenced by create_window().

Here is the caller graph for this function:

◆ on_idle()

static gboolean on_idle ( gpointer  )
static
60{
61 if(current >= functions.size())
62 {
63 return false;
64 }
65
66 if(!functions[current]())
67 {
68 current++;
69 }
70
71 return true;
72}
std::vector< boost::function< bool()> > functions
Definition measure-framerate-callbacks.cc:14
static unsigned int current
Definition measure-framerate-callbacks.cc:15

Referenced by init().

Here is the caller graph for this function:

Variable Documentation

◆ current

◆ drawingArea

GtkWidget* drawingArea = nullptr
static

◆ functions