mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-gtk: add pathological check for axis
That way we don't give values back that will not make any sense.
This commit is contained in:
@ -34,10 +34,11 @@ struct _SysprofAxisClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*get_min_value) (SysprofAxis *axis,
|
||||
GValue *min_value);
|
||||
double (*normalize) (SysprofAxis *axis,
|
||||
const GValue *value);
|
||||
void (*get_min_value) (SysprofAxis *axis,
|
||||
GValue *min_value);
|
||||
double (*normalize) (SysprofAxis *axis,
|
||||
const GValue *value);
|
||||
gboolean (*is_pathological) (SysprofAxis *axis);
|
||||
};
|
||||
|
||||
#define SYSPROF_AXIS_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS(obj, SYSPROF_TYPE_AXIS, SysprofAxisClass)
|
||||
@ -56,6 +57,15 @@ _sysprof_axis_normalize (SysprofAxis *axis,
|
||||
return SYSPROF_AXIS_GET_CLASS (axis)->normalize (axis, value);
|
||||
}
|
||||
|
||||
static inline double
|
||||
_sysprof_axis_is_pathological (SysprofAxis *axis)
|
||||
{
|
||||
if (SYSPROF_AXIS_GET_CLASS (axis)->is_pathological)
|
||||
return SYSPROF_AXIS_GET_CLASS (axis)->is_pathological (axis);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void _sysprof_axis_emit_range_changed (SysprofAxis *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user