mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
CtrlCore: Improved Image cache behaviour in Win32
git-svn-id: svn://ultimatepp.org/upp/trunk@12788 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
508ddd6d97
commit
31affcdb46
2 changed files with 10 additions and 0 deletions
|
|
@ -339,6 +339,12 @@ void SystemDraw::SysDrawImageOp(int x, int y, const Image& img, const Rect& src,
|
|||
LLOG("SysDrawImageOp " << img.GetSerialId() << ' ' << img.GetSize());
|
||||
ImageSysDataMaker m;
|
||||
static LRUCache<ImageSysData, int64> cache;
|
||||
static int Rsz;
|
||||
Rsz += img.GetLength();
|
||||
if(Rsz > 200 * 200) { // we do not want to do this for each small image painted...
|
||||
Rsz = 0;
|
||||
cache.Remove([](const ImageSysData& object) { return object.img.GetRefCount() == 1; });
|
||||
}
|
||||
LLOG("SysImage cache pixels " << cache.GetSize() << ", count " << cache.GetCount());
|
||||
Size sz = Ctrl::GetPrimaryScreenArea().GetSize();
|
||||
m.img = IsPrinter() && GetDeviceCaps(GetHandle(), NUMCOLORS) == 2 ? Dither(img, 360) : img; // If printer does not support color, dither
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue