- ++dirtyRectPos;
-
- if((dirtyRectPos - originDirtyRectPos) == MAX_DIRTY_RECT_PER_RENDERER) // no more than MAX_DIRTY_RECT_PER_RENDERER previous rects
- {
- hasMaxDirtyRect = true;
- break;
- }
- }
-
- if(hasMaxDirtyRect)
- {
- // If we have already MAX_DIRTY_RECT_PER_RENDERER for the same item, just copy it.
- // Remove the oldest rect (at pos + MAX_DIRTY_RECT_PER_RENDERER - 1)
- // and move other rects one step.
- // and insert new dirtyRect at originDirtyRectPos.
- auto pos = originDirtyRectPos - itemsDirtyRects.begin();
- for(auto i = MAX_DIRTY_RECT_PER_RENDERER - 1; i > 0; i--)
- {
- itemsDirtyRects[pos + i] = itemsDirtyRects[pos + i - 1];
- }
- itemsDirtyRects[pos] = dirtyRect;