V_BEGIN_NAMESPACE
static VRegionPrivate regionPrivate = {{0,0,0,0}, NULL};
-const VRegion::VRegionData VRegion::shared_empty;
+
+struct VRegionData {
+ VRegionData():ref(-1),rgn(®ionPrivate){}
+ RefCount ref;
+ VRegionPrivate *rgn;
+};
+
+const VRegionData shared_empty;
inline VRect box_to_rect(box_type_t *box)
{
return VRect(box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1);
}
-void VRegion::cleanUp(VRegion::VRegionData *x)
+void VRegion::cleanUp(VRegionData *x)
{
if (x->rgn) {
PREFIX(_fini)(x->rgn);
d->ref.ref();
}
+VRegion::VRegion(VRegion &&other): d(other.d)
+{
+ other.d = const_cast<VRegionData*>(&shared_empty);
+
+}
+
VRegion &VRegion::operator=(const VRegion &r)
{
r.d->ref.ref();
V_BEGIN_NAMESPACE
-typedef struct pixman_region region_type_t;
-typedef region_type_t VRegionPrivate;
+struct VRegionData;
class VRegion
{
VRegion(int x, int y, int w, int h);
VRegion(const VRect &r);
VRegion(const VRegion ®ion);
- VRegion(VRegion &&other): d(other.d) { other.d = const_cast<VRegionData*>(&shared_empty); }
+ VRegion(VRegion &&other);
~VRegion();
VRegion &operator=(const VRegion &);
VRegion &operator=(VRegion &&);
bool within(const VRect &r) const;
VRegion copy() const;
void detach();
-
- struct VRegionData {
- VRegionData():ref(-1),rgn(nullptr){}
- RefCount ref;
- VRegionPrivate *rgn;
- };
+ void cleanUp(VRegionData *x);
struct VRegionData *d;
- static const struct VRegionData shared_empty;
- static void cleanUp(VRegionData *x);
};
inline void VRegion::translate(int dx, int dy)
{