aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c
blob: 5e44d07c20c3778a6f98394d9325369a3191e20c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* ifdef HAVE_CONFIG_H */

#include "ecore_x_private.h"
#include "Ecore_X.h"

static Eina_Bool _damage_available = EINA_FALSE;
#ifdef ECORE_XDAMAGE
static int _damage_major, _damage_minor;
#endif /* ifdef ECORE_XDAMAGE */

void
_ecore_x_damage_init(void)
{
#ifdef ECORE_XDAMAGE
   _damage_major = 1;
   _damage_minor = 0;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   if (XDamageQueryVersion(_ecore_x_disp, &_damage_major, &_damage_minor))
     _damage_available = EINA_TRUE;
   else
     _damage_available = EINA_FALSE;

#else /* ifdef ECORE_XDAMAGE */
   _damage_available = EINA_FALSE;
#endif /* ifdef ECORE_XDAMAGE */
} /* _ecore_x_damage_init */

EAPI Eina_Bool
ecore_x_damage_query(void)
{
   return _damage_available;
} /* ecore_x_damage_query */

EAPI Ecore_X_Damage
ecore_x_damage_new(Ecore_X_Drawable            d,
                   Ecore_X_Damage_Report_Level level)
{
#ifdef ECORE_XDAMAGE
   Ecore_X_Damage damage;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   damage = XDamageCreate(_ecore_x_disp, d, level);
   return damage;
#else /* ifdef ECORE_XDAMAGE */
   return 0;
#endif /* ifdef ECORE_XDAMAGE */
} /* ecore_x_damage_new */

EAPI void
ecore_x_damage_free(Ecore_X_Damage damage)
{
#ifdef ECORE_XDAMAGE
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   XDamageDestroy(_ecore_x_disp, damage);
#endif /* ifdef ECORE_XDAMAGE */
} /* ecore_x_damage_free */

EAPI void
ecore_x_damage_subtract(Ecore_X_Damage damage,
                        Ecore_X_Region repair,
                        Ecore_X_Region parts)
{
#ifdef ECORE_XDAMAGE
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   XDamageSubtract(_ecore_x_disp, damage, repair, parts);
#endif /* ifdef ECORE_XDAMAGE */
} /* ecore_x_damage_subtract */