feat(编辑渲染): 完善三维转换,优化编辑渲染压缩

This commit is contained in:
xiaoqidun committed 2026-10-07 10:26:20 +08:00
1 parent e8344e6387
commit 839f65e3d7
47 files changed
+4887 -112

No files matched your search

+24
View File
@@ -33,6 +33,15 @@ type canvasClipCacheKey struct{}
// canvasPathCacheKey 区分不依赖文档资源的共享局部路径缓存
type canvasPathCacheKey struct{}
// canvasFillCacheKey 区分按填充规则规范化的共享路径缓存
type canvasFillCacheKey struct{}
// canvasFillKey 保存完整几何摘要及填充规则
type canvasFillKey struct {
digest [32]byte
rule canvas.FillRule
}
// canvasPathKey 按完整路径文本与几何容差区分解析结果
type canvasPathKey struct {
data string
@@ -78,6 +87,21 @@ func (r *Renderer) canvasParsedPaths() *renderCache[canvasPathKey, *canvas.Path]
return cache
}
// canvasSettledPaths 获取共享填充轮廓缓存,限制结果保留量
// 返回: *renderCache[canvasFillKey, *canvas.Path] 填充轮廓缓存
func (r *Renderer) canvasSettledPaths() *renderCache[canvasFillKey, *canvas.Path] {
key := canvasFillCacheKey{}
if state, ok := r.sharedBackendStates[key]; ok {
return state.(*renderCache[canvasFillKey, *canvas.Path])
}
if r.sharedBackendStates == nil {
r.sharedBackendStates = make(map[any]any)
}
cache := &renderCache[canvasFillKey, *canvas.Path]{limit: 16 << 20}
r.sharedBackendStates[key] = cache
return cache
}
// canvasFontFamilies 获取子渲染器共享的只读字体族缓存,限制解析数据保留量
// 返回: *renderCache[canvasFontKey, *canvas.FontFamily] 字体族缓存
func (r *Renderer) canvasFontFamilies() *renderCache[canvasFontKey, *canvas.FontFamily] {