ultimatepp/uppdev/ImageDisplayCtrl/ImageDisplayCtrl.cpp
cxl 351994a6cc Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

30 lines
1.1 KiB
C++

#include "ImageDisplayCtrl.h"
void ImageDisplayCtrl::Paint(Draw& w) {
RLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": ImageDisplayCtrl::Paint");
if (image.IsVoid() || image.IsEmpty()) {
Size win = GetSize();
w.DrawRect(win,SColorPaper());
} else {
Size win = GetSize();
Size im = image.GetSize();
Size fsz = image.FitSize(win);
Rect imagerect = Rect(win).CenterRect(fsz);
Rect top(GetSize());
Rect bottom(GetSize());
Rect left(GetSize());
Rect right(GetSize());
top.bottom = imagerect.top;
bottom.top = imagerect.bottom;
left.right = imagerect.left;
right.left = imagerect.right;
w.DrawRect(top,SColorPaper());
w.DrawRect(left,SColorPaper());
w.DrawRect(right,SColorPaper());
w.DrawRect(bottom,SColorPaper());
RLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": DrawImage, " << image.GetSize() << " -> " << imagerect.Size());
w.DrawImage(imagerect, image);
RLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": //DrawImage");
}
RLOG(GetSysTime() << " % " << (unsigned)msecs() % 10000 << ": //ImageDisplayCtrl::Paint");
}