mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 01:27:26 +08:00
This commit is contained in:
1 parent
3c15a18546
commit
3b2950a9c1
3 files changed
+43
-6
No files matched your search
@@ -31,8 +31,10 @@ type Reader struct {
|
||||
OFD *OFD
|
||||
RootDir string
|
||||
ResMap map[string]string
|
||||
resourcesRead map[string]bool
|
||||
fontCache map[string]*Font
|
||||
fontResourcesRead bool
|
||||
fontFilesChecked map[string]bool
|
||||
colorSpaceCache map[string]*ColorSpace
|
||||
drawParamCache map[string]*DrawParam
|
||||
compositeGraphicUnitCache map[string]*CompositeGraphicUnit
|
||||
@@ -76,7 +78,9 @@ func (r *Reader) initRoot() error {
|
||||
}
|
||||
r.OFD = &ofd
|
||||
r.ResMap = make(map[string]string)
|
||||
r.resourcesRead = make(map[string]bool)
|
||||
r.fontCache = make(map[string]*Font)
|
||||
r.fontFilesChecked = make(map[string]bool)
|
||||
r.colorSpaceCache = make(map[string]*ColorSpace)
|
||||
r.drawParamCache = make(map[string]*DrawParam)
|
||||
r.compositeGraphicUnitCache = make(map[string]*CompositeGraphicUnit)
|
||||
@@ -182,6 +186,9 @@ func (r *Reader) loadRes(resPath string) {
|
||||
return
|
||||
}
|
||||
fullPath := r.ResPath(resPath)
|
||||
if r.resourcesRead[fullPath] {
|
||||
return
|
||||
}
|
||||
data, err := r.readFile(fullPath)
|
||||
if err != nil {
|
||||
return
|
||||
@@ -217,6 +224,7 @@ func (r *Reader) loadRes(resPath string) {
|
||||
cgu := &res.CompositeGraphicUnits.CompositeGraphicUnit[i]
|
||||
r.compositeGraphicUnitCache[cgu.ID] = cgu
|
||||
}
|
||||
r.resourcesRead[fullPath] = true
|
||||
}
|
||||
|
||||
// resolveResourcePath 解析资源文件路径
|
||||
|
||||
Reference in new issue
Block a user