draw optimizations

This commit is contained in:
IliaDenisov
2026-03-08 23:30:11 +02:00
parent fdcbb5d6f4
commit ac35360d60
18 changed files with 875 additions and 566 deletions
+7
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"image"
"image/color"
"sync"
)
// fakeClipRect describes one clip rectangle in canvas pixel coordinates.
@@ -66,6 +67,7 @@ type fakePrimitiveDrawer struct {
commands []fakeDrawerCommand
state fakeDrawerState
stack []fakeDrawerState
mu sync.Mutex
}
// Ensure fakePrimitiveDrawer implements PrimitiveDrawer.
@@ -248,3 +250,8 @@ func (d *fakePrimitiveDrawer) DrawImage(_ image.Image, x, y int) {
func (d *fakePrimitiveDrawer) DrawImageScaled(_ image.Image, x, y, w, h int) {
d.snapshotCommand("DrawImageScaled", float64(x), float64(y), float64(w), float64(h))
}
func (d *fakePrimitiveDrawer) Reset() {
d.mu.Lock()
defer d.mu.Unlock()
d.commands = d.commands[:0]
}