.examples

git-svn-id: svn://ultimatepp.org/upp/trunk@12507 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-11-11 12:41:20 +00:00
parent 172688825d
commit b8a15f2b79
3 changed files with 9 additions and 7 deletions

View file

@ -181,9 +181,9 @@ void PaintLion(Painter& sw)
static Vector<ColorPolygon> l = Lion();
for(int i = 0; i < l.GetCount(); i++) {
Vector<Pointf>& p = l[i].point;
sw.Move(p[0].x, p[0].y);
sw.Move(p[0]);
for(int j = 1; j < p.GetCount(); j++)
sw.Line(p[j].x, p[j].y);
sw.Line(p[j]);
sw.Fill(l[i].color);
}
}

View file

@ -12,7 +12,7 @@ void RadialMaskBlending(Painter& sw)
sw.End();
for(int y = 0; y < tsz.cx; y += tsz.cy)
sw.Text(10, y, txt, Roman(40))
.Fill(Blue());
.Fill(Red());
sw.End();
sw.Begin();
sw.BeginMask();

View file

@ -57,25 +57,27 @@ void App::Print()
void App::Benchmark()
{
double tm[2];
ImageBuffer ib(2000, 2000);
for(int pass = 0; pass < 1 + !!ctrl.mt; pass++) {
int time0 = GetTickCount();
int n = 0;
int time;
BufferPainter sw(ib, ctrl.quality);
for(;;) {
time = GetTickCount();
if(time - time0 > 1000) break;
ImageBuffer ib(800, 600);
BufferPainter sw(ib, ctrl.quality);
sw.Co(pass);
sw.Begin();
DoPaint(sw);
sw.End();
n++;
}
tm[pass] = double(time - time0) / n;
}
if(ctrl.mt)
PromptOK(Format("ST %.2f ms, MT %.2f ms, ST/MT %.2f", tm[0], tm[1], tm[0] / tm[1]));
PromptOK(Format("ST %.3f ms, MT %.3f ms, ST/MT %.3f", tm[0], tm[1], tm[0] / tm[1]));
else
PromptOK(Format("%.2f ms", tm[0]));
PromptOK(Format("%.3f ms", tm[0]));
}
void App::Paint(Draw& w)