mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 08:46:55 +08:00
1 parent
2c06e5ff69
commit
478c18cb1f
3 files changed
+43
-7
No files matched your search
@@ -36,6 +36,9 @@ type canvasPathCacheKey struct{}
|
||||
// canvasFillCacheKey 区分按填充规则规范化的共享路径缓存
|
||||
type canvasFillCacheKey struct{}
|
||||
|
||||
// canvasOutlineCacheKey 区分子渲染器共享的字体轮廓解析缓存
|
||||
type canvasOutlineCacheKey struct{}
|
||||
|
||||
// canvasFillKey 保存完整几何摘要及填充规则
|
||||
type canvasFillKey struct {
|
||||
digest [32]byte
|
||||
@@ -114,6 +117,18 @@ func (r *Renderer) canvasFontFamilies() *renderCache[canvasFontKey, *canvas.Font
|
||||
return cache
|
||||
}
|
||||
|
||||
// canvasFontOutlines 获取子渲染器共享的字体轮廓解析缓存,限制字体及解析数据保留量
|
||||
// 返回: *renderCache[*canvas.Font, *sfntOutliner] 字体轮廓缓存
|
||||
func (r *Renderer) canvasFontOutlines() *renderCache[*canvas.Font, *sfntOutliner] {
|
||||
key := canvasOutlineCacheKey{}
|
||||
if state, ok := r.sharedBackendStates[key]; ok {
|
||||
return state.(*renderCache[*canvas.Font, *sfntOutliner])
|
||||
}
|
||||
cache := &renderCache[*canvas.Font, *sfntOutliner]{limit: 32 << 20}
|
||||
r.sharedBackendStates[key] = cache
|
||||
return cache
|
||||
}
|
||||
|
||||
// canvasState 获取当前渲染器的Canvas私有缓存,按需创建且不向其他后端暴露
|
||||
// 返回: *canvasBackendState Canvas缓存
|
||||
func (r *Renderer) canvasState() *canvasBackendState {
|
||||
|
||||
Reference in new issue
Block a user