Bugfix: PGS YVU => YUV
[xy_vsfilter.git] / src / subtitles / xy_clipper_paint_machine.cpp
blobfbaf8f5373056b7b087771951ca9d25032c25a24
1 #include "stdafx.h"
2 #include "xy_clipper_paint_machine.h"
3 #include "RTS.h"
4 #include "Rasterizer.h"
5 #include "cache_manager.h"
6 #include "subpixel_position_controler.h"
8 //////////////////////////////////////////////////////////////////////////
9 //
10 // CClipperPaintMachine
13 void CClipperPaintMachine::Paint(SharedPtrGrayImage2 *output)
15 ASSERT(output);
16 if (m_clipper!=NULL)
18 ClipperAlphaMaskCacheKey key(m_clipper);
19 key.UpdateHashValue();
20 ClipperAlphaMaskMruCache * cache = CacheManager::GetClipperAlphaMaskMruCache();
21 POSITION pos = cache->Lookup(key);
22 if( pos!=NULL )
24 *output = cache->GetAt(pos);
25 cache->UpdateCache(pos);
27 else
29 (*output).reset(m_clipper->Paint());
30 cache->UpdateCache(key, *output);
35 CRect CClipperPaintMachine::CalcDirtyRect()
37 return CRect(0,0,INT_MAX, INT_MAX);//fix me: not a decent state machine yet
40 const ClipperAlphaMaskCacheKey& CClipperPaintMachine::GetHashKey()
42 return m_hash_key;