Ticket #9203: dirty-rect-safety-valve3.diff

File dirty-rect-safety-valve3.diff, 1.4 KB (added by eriktorbjorn, 13 years ago)

Patch against current Git (after another restructuring/renaming)

  • backends/graphics/surfacesdl/surfacesdl-graphics.cpp

    diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    index 2d41ece..58a8bb7 100644
    a b void SurfaceSdlGraphicsManager::internUpdateScreen() {  
    10421042                _dirtyRectList[0].y = 0;
    10431043                _dirtyRectList[0].w = width;
    10441044                _dirtyRectList[0].h = height;
     1045                _dirtyArea = width * height;
    10451046        }
    10461047
    10471048        // Only draw anything if necessary
    void SurfaceSdlGraphicsManager::internUpdateScreen() {  
    11931194        }
    11941195
    11951196        _numDirtyRects = 0;
     1197        _dirtyArea = 0;
    11961198        _forceFull = false;
    11971199        _mouseNeedsRedraw = false;
    11981200}
    void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool re  
    13871389                return;
    13881390        }
    13891391
     1392        _dirtyArea += (w * h);
     1393        if (_dirtyArea > width * height) {
     1394                _forceFull = true;
     1395                return;
     1396        }
     1397
    13901398        if (w > 0 && h > 0) {
    13911399                SDL_Rect *r = &_dirtyRectList[_numDirtyRects++];
    13921400
  • backends/graphics/surfacesdl/surfacesdl-graphics.h

    diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
    index cd8710d..7d9c274 100644
    a b protected:  
    241241        // Dirty rect management
    242242        SDL_Rect _dirtyRectList[NUM_DIRTY_RECT];
    243243        int _numDirtyRects;
     244        int32 _dirtyArea;
    244245
    245246        struct MousePos {
    246247                // The mouse position, using either virtual (game) or real