surface->Flip(&region, (DFBSurfaceFlipFlags)0);
surface->Flip(&region, DSFLIP_NONE);
class ActualFlipData : public FlipData {public:   ActualFlipData(IDirectFBSurface *s) {      dontFlip=0;      region=nullRegion;      regionValid=false;      surface=s;      //referenceCounter=1;   }   /*   void addRef() {      referenceCounter++;   }      void removeRef() {      referenceCounter--;      if (!referenceCounter)         delete this;   }*/      void enterBuffered() {      dontFlip++;   }      void leaveBuffered() {      if (dontFlip)         dontFlip--;      flip(); //flip checks for dontFlip, no double check here   }      void addUpdate(int x1, int y1, int x2, int y2) {      add(x1, y1, x2, y2);      flip(); //again: flip checks for dontFlip, no double check here   }   protected:   int dontFlip;   //int referenceCounter;   DFBRegion region;   bool regionValid;   IDirectFBSurface *surface;      void flip() {      if (!dontFlip) {         if (regionValid) {            //printf("Flipping surface %p, region %dx%d - %dx%d\n", surface, region.x1, region.y1, region.x2, region.y2);            try {               surface->Flip(&region, (DFBSurfaceFlipFlags)0);            } catch (DFBException *e) {               printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());               delete e;            }            region.y2--;            region=nullRegion;            regionValid=false;         }      }   }      void add(int x1, int y1, int x2, int y2) {      if (regionValid) {         //add to region         region.x1 = region.x1 <? x1;         region.y1 = region.y1 <? y1;         region.x2 = region.x2 >? x2;         region.y2 = region.y2 >? y2;      } else {         //initially set region         region.x1 = x1;         region.y1 = y1;         region.x2 = x2;         region.y2 = y2;         regionValid=true;      }      //printf("Graphics: added %d, %d, %d, %d, now is %d, %d, %d, %d\n", x1,y1,x2,y2, region.x1,region.y1,region.x2,region.y2);   }};