1 /************************************************************************/
4 /************************************************************************/
5 #ifndef __CACHE_MANAGER_H_310C134F_844C_4590_A4D2_AD30165AF10A__
6 #define __CACHE_MANAGER_H_310C134F_844C_4590_A4D2_AD30165AF10A__
11 class TextInfoCacheKey
16 bool operator==(const TextInfoCacheKey
& key
)const;
18 friend class TextInfoCacheKeyTraits
;
24 CWordCacheKey(const CWord
& word
);
25 CWordCacheKey(const CWordCacheKey
& key
);
26 CWordCacheKey(const FwSTSStyle
& style
, const CStringW
& str
, int ktype
, int kstart
, int kend
);
27 bool operator==(const CWordCacheKey
& key
)const;
28 bool operator==(const CWord
& key
)const;
32 int m_ktype
, m_kstart
, m_kend
;
34 friend class CWordCacheKeyTraits
;
37 class PathDataCacheKey
40 PathDataCacheKey(const CWord
& word
):m_str(word
.m_str
),m_style(word
.m_style
){}
41 PathDataCacheKey(const PathDataCacheKey
& key
):m_str(key
.m_str
),m_style(key
.m_style
){}
42 PathDataCacheKey(const FwSTSStyle
& style
, const CStringW
& str
):m_str(str
),m_style(style
){}
43 bool operator==(const PathDataCacheKey
& key
)const
45 return m_str
==key
.m_str
&& ( m_style
==key
.m_style
|| CompareSTSStyle(m_style
, key
.m_style
) );
47 bool operator==(const CWord
& key
)const
49 return m_str
==key
.m_str
&& ( m_style
==key
.m_style
|| CompareSTSStyle(m_style
.get(), key
.m_style
.get()) );
52 static bool CompareSTSStyle(const STSStyle
& lhs
, const STSStyle
& rhs
);
57 friend class PathDataCacheKeyTraits
;
60 class ScanLineDataCacheKey
: public PathDataCacheKey
63 ScanLineDataCacheKey(const CWord
& word
, const POINT
& org
):PathDataCacheKey(word
),m_org(org
) { }
64 ScanLineDataCacheKey(const ScanLineDataCacheKey
& key
):PathDataCacheKey(key
),m_org(key
.m_org
) { }
65 ScanLineDataCacheKey(const FwSTSStyle
& style
, const CStringW
& str
, const POINT
& org
)
66 :PathDataCacheKey(style
, str
),m_org(org
) { }
67 bool operator==(const ScanLineDataCacheKey
& key
)const;
71 friend class ScanLineDataCacheKeyTraits
;
74 class OverlayNoBlurKey
: public ScanLineDataCacheKey
77 OverlayNoBlurKey(const CWord
& word
, const POINT
& p
, const POINT
& org
):ScanLineDataCacheKey(word
,org
),m_p(p
) { }
78 OverlayNoBlurKey(const OverlayNoBlurKey
& key
):ScanLineDataCacheKey(key
),m_p(key
.m_p
) { }
79 OverlayNoBlurKey(const FwSTSStyle
& style
, const CStringW
& str
, const POINT
& p
, const POINT
& org
)
80 :ScanLineDataCacheKey(style
, str
, org
),m_p(p
) { }
81 bool operator==(const OverlayNoBlurKey
& key
)const;
86 class OverlayKey
: public OverlayNoBlurKey
89 OverlayKey(const CWord
& word
, const POINT
& p
, const POINT
& org
):OverlayNoBlurKey(word
, p
, org
) { }
90 OverlayKey(const OverlayKey
& key
):OverlayNoBlurKey(key
){ }
92 bool operator==(const OverlayKey
& key
)const;
94 friend class OverlayKeyTraits
;
97 std::size_t hash_value(const CWord
& key
);
99 class TextInfoCacheKeyTraits
:public CElementTraits
<TextInfoCacheKey
>
102 static ULONG
Hash(const TextInfoCacheKey
& key
);
105 class CWordCacheKeyTraits
:public CElementTraits
<CWordCacheKey
>
108 static ULONG
Hash(const CWordCacheKey
& key
);
111 class PathDataCacheKeyTraits
:public CElementTraits
<PathDataCacheKey
>
114 static ULONG
Hash(const PathDataCacheKey
& key
);
117 class ScanLineDataCacheKeyTraits
:public CElementTraits
<ScanLineDataCacheKey
>
120 static ULONG
Hash(const ScanLineDataCacheKey
& key
);
123 class OverlayNoBlurKeyTraits
:public CElementTraits
<OverlayNoBlurKey
>
126 static ULONG
Hash(const OverlayNoBlurKey
& key
);
129 class OverlayKeyTraits
:public CElementTraits
<OverlayKey
>
132 static ULONG
Hash(const OverlayKey
& key
);
135 typedef EnhancedXyMru
<
137 CText::SharedPtrTextInfo
,
138 TextInfoCacheKeyTraits
141 typedef EnhancedXyMru
<
143 CRenderedTextSubtitle::SharedPtrConstAssTagList
,
144 CStringElementTraits
<CStringW
>
145 > AssTagListMruCache
;
147 typedef EnhancedXyMru
<CWordCacheKey
, SharedPtrCWord
, CWordCacheKeyTraits
> CWordMruCache
;
149 typedef EnhancedXyMru
<PathDataCacheKey
, SharedPtrConstPathData
, PathDataCacheKeyTraits
> PathDataMruCache
;
151 typedef EnhancedXyMru
<ScanLineDataCacheKey
, SharedPtrConstScanLineData
, ScanLineDataCacheKeyTraits
> ScanLineDataMruCache
;
153 typedef EnhancedXyMru
<OverlayNoBlurKey
, SharedPtrOverlay
, OverlayNoBlurKeyTraits
> OverlayNoBlurMruCache
;
155 typedef EnhancedXyMru
<OverlayKey
, SharedPtrOverlay
, OverlayKeyTraits
> OverlayMruCache
;
160 static const int TEXT_INFO_CACHE_ITEM_NUM
= 2048;
161 static const int ASS_TAG_LIST_CACHE_ITEM_NUM
= 256;
162 static const int SUBPIXEL_VARIANCE_CACHE_ITEM_NUM
= 256;
163 static const int OVERLAY_CACHE_ITEM_NUM
= 256;
165 static const int OVERLAY_NO_BLUR_CACHE_ITEM_NUM
= 256;
166 static const int SCAN_LINE_DATA_CACHE_ITEM_NUM
= 256;
167 static const int PATH_CACHE_ITEM_NUM
= 256;
168 static const int WORD_CACHE_ITEM_NUM
= 512;
170 static TextInfoMruCache
* GetTextInfoCache();
171 static AssTagListMruCache
* GetAssTagListMruCache();
172 static OverlayMruCache
* GetSubpixelVarianceCache();
173 static OverlayMruCache
* GetOverlayMruCache();
174 static OverlayNoBlurMruCache
* GetOverlayNoBlurMruCache();
175 static ScanLineDataMruCache
* GetScanLineDataMruCache();
176 static PathDataMruCache
* GetPathDataMruCache();
177 static CWordMruCache
* GetCWordMruCache();
179 static TextInfoMruCache
* s_text_info_cache
;
180 static AssTagListMruCache
* s_ass_tag_list_cache
;
181 static OverlayMruCache
* s_subpixel_variance_cache
;
182 static OverlayMruCache
* s_overlay_mru_cache
;
183 static OverlayNoBlurMruCache
* s_overlay_no_blur_mru_cache
;
184 static PathDataMruCache
* s_path_data_mru_cache
;
185 static ScanLineDataMruCache
* s_scan_line_data_mru_cache
;
186 static CWordMruCache
* s_word_mru_cache
;
189 #endif // end of __CACHE_MANAGER_H_310C134F_844C_4590_A4D2_AD30165AF10A__