mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 14:31:12 +08:00
feat(性能优化): 优化蒙版处理与字体更新性能,保持渲染一致
This commit is contained in:
1 parent
c5abb3667a
commit
565b7f6db4
4 files changed
+36
-17
No files matched your search
@@ -20,8 +20,6 @@ import (
|
||||
"image"
|
||||
"io"
|
||||
"io/fs"
|
||||
|
||||
"github.com/tdewolff/canvas"
|
||||
)
|
||||
|
||||
// Open 打开OFD文件
|
||||
@@ -71,18 +69,10 @@ func NewRenderer(reader *Reader, opts ...RendererOption) *Renderer {
|
||||
RenderAnnotations: true,
|
||||
DrawParams: reader.drawParamCache,
|
||||
CompositeGraphicUnits: reader.compositeGraphicUnitCache,
|
||||
FontMap: make(map[string]*canvas.FontFamily),
|
||||
FontGIDMap: make(map[string]map[uint16]rune),
|
||||
FontCIDMap: make(map[string]map[uint16]rune),
|
||||
fontCache: make(map[fontCacheKey]*canvas.FontFamily),
|
||||
fontSourceCache: make(map[string][]fontSource),
|
||||
fontSourceUsed: make(map[string]fontSource),
|
||||
fontDirCandidates: make(map[string][]fontFileCandidate),
|
||||
fontFSCandidates: make(map[int][]fontFileCandidate),
|
||||
textGlyphPathCache: make(map[textGlyphPathCacheKey]textGlyphPathCacheValue),
|
||||
templatePageCache: make(map[string]*PageContent),
|
||||
imageCache: make(map[string]image.Image),
|
||||
}
|
||||
r.resetFontCache()
|
||||
for _, opt := range opts {
|
||||
opt(r)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user