andlabs / andlabs/libui

How to constrain area redrawing to clip region?

Đang mở
#540 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C
Star
10.9k
Fork
612
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,

I built this game, [Glimmer Tetris](https://github.com/AndyObtiva/glimmer-dsl-libui#tetris)

It runs fast with a basic 2D look (each block is a path).

![glimmer-dsl-libui-mac-tetris](https://user-images.githubusercontent.com/23052/140208138-124d1376-bfea-461d-9684-79e92f756db5.png)

When I attempt to add a simulated bevel-block 3D look via 4 extra polygons per block where each polygon is a figure of multiple line calls done under a single path (similar to the [Glimmer Tetris built with SWT](https://github.com/AndyObtiva/glimmer_tetris))...

![Screen Shot 2021-11-03 at 6 35 17 PM](https://user-images.githubusercontent.com/23052/140210524-720e179c-8487-4138-99e5-ea12350b2c20.png)

Area redrawing slows down to a crawl!

I ensured that only a single redraw is happening per movement of the Tetris tetromino blocks.

My question is: I could probably optimize performance by asking the area to redraw only the blocks that changed instead of the entire playfield.

How do I do that with libui? Is that option available? The only thing I saw is queueRedrawAll, which redraws everything.

Is that what save and restore are all about? Initial saving... restoring the whole area, making a small change, and then saving again? Does that improve performance?

If clipped redrawing is not available, this would be a great performance optimization feature to have I think.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.