mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
1 parent
974b515374
commit
67f4cf9d2c
13 files changed
+401
-44
No files matched your search
@@ -34,6 +34,9 @@ type canvasFontKey struct {
|
||||
// canvasClipCacheKey 区分不依赖文档资源的共享裁剪缓存
|
||||
type canvasClipCacheKey struct{}
|
||||
|
||||
// canvasClipUnionKey 区分文字和图形裁剪的共享并集缓存
|
||||
type canvasClipUnionKey struct{}
|
||||
|
||||
// canvasPathCacheKey 区分不依赖文档资源的共享局部路径缓存
|
||||
type canvasPathCacheKey struct{}
|
||||
|
||||
@@ -83,6 +86,21 @@ func (r *Renderer) canvasClipIntersections() *renderCache[[32]byte, *canvas.Path
|
||||
return cache
|
||||
}
|
||||
|
||||
// canvasClipUnions 复用相同输入轮廓的裁剪并集,不改变布尔运算顺序
|
||||
// 返回: *renderCache[[32]byte, *canvas.Path] 只读裁剪并集缓存
|
||||
func (r *Renderer) canvasClipUnions() *renderCache[[32]byte, *canvas.Path] {
|
||||
key := canvasClipUnionKey{}
|
||||
if state, ok := r.sharedBackendStates[key]; ok {
|
||||
return state.(*renderCache[[32]byte, *canvas.Path])
|
||||
}
|
||||
if r.sharedBackendStates == nil {
|
||||
r.sharedBackendStates = make(map[any]any)
|
||||
}
|
||||
cache := resourceCache[[32]byte, *canvas.Path](r.Reader.resources, 8<<20)
|
||||
r.sharedBackendStates[key] = cache
|
||||
return cache
|
||||
}
|
||||
|
||||
// canvasParsedPaths 获取子渲染器共享的局部路径缓存,不保留对象变换
|
||||
// 返回: *renderCache[canvasPathKey, *canvas.Path] 路径缓存
|
||||
func (r *Renderer) canvasParsedPaths() *renderCache[canvasPathKey, *canvas.Path] {
|
||||
|
||||
Reference in new issue
Block a user