mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-10 14:22:46 -06:00
.benchmarks
git-svn-id: svn://ultimatepp.org/upp/trunk@12490 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
88757bbd66
commit
d34e8704f6
6 changed files with 55 additions and 20 deletions
|
|
@ -6,10 +6,16 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <LionBenchmark/test.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
void PaintLion(Painter& sw);
|
||||
void PythagorasTree(Painter& sw);
|
||||
void Demo(Painter& sw);
|
||||
void ClippingExample(Painter& sw);
|
||||
void PolyPolygon(Painter& sw);
|
||||
void TextOnPath(Painter& sw);
|
||||
void Dash(Painter& sw);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ file
|
|||
demo.cpp,
|
||||
Clipping.cpp,
|
||||
PolyPolygon.cpp,
|
||||
TextOnPath.cpp,
|
||||
main.cpp,
|
||||
info.txt;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void PolyPolygon(Painter& sw)
|
|||
subpolygon_counts[0], sizeof(subpolygon_counts) / sizeof(int),
|
||||
disjunct_counts, sizeof(disjunct_counts) / sizeof(int),
|
||||
LtBlue(), 4, LtRed(), I64(0xF0F0F0F00F0F0F0F));
|
||||
// sw.DrawPolyPolyline(lpoints[0], sizeof(lpoints) / sizeof(Point),
|
||||
// lcounts[0], sizeof(lcounts) / sizeof(int),
|
||||
// 4, Color(0, 192, 0));
|
||||
sw.DrawPolyPolyline(lpoints[0], sizeof(lpoints) / sizeof(Point),
|
||||
lcounts[0], sizeof(lcounts) / sizeof(int),
|
||||
4, Color(0, 192, 0));
|
||||
}
|
||||
|
|
|
|||
21
benchmarks/LionBenchmark/TextOnPath.cpp
Normal file
21
benchmarks/LionBenchmark/TextOnPath.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "LionBenchmark.h"
|
||||
|
||||
void TextOnPath(Painter& sw)
|
||||
{
|
||||
Font fnt = Roman(100);
|
||||
FontInfo fi = fnt.Info();
|
||||
double pos = 0;
|
||||
const char *s = "Hello world, this is text on path!";
|
||||
int l = GetTextSize(s, fnt).cx;
|
||||
double r = l / (2 * M_PI);
|
||||
sw.Circle(300, 300, r).Stroke(1, Red());
|
||||
while(*s) {
|
||||
double w = fi[*s];
|
||||
sw.BeginOnPath(pos + w / 2, true);
|
||||
sw.Character(-w / 2, -fi.GetAscent(), *s++, fnt)
|
||||
.Fill(0, -fi.GetAscent(), Yellow(), 0, fi.GetDescent(), Blue())
|
||||
.Stroke(1, Black());
|
||||
sw.End();
|
||||
pos += w;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
#include "LionBenchmark.h"
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <LionBenchmark/test.iml>
|
||||
#include <Draw/iml_header.h>
|
||||
|
||||
#define IMAGECLASS TestImg
|
||||
#define IMAGEFILE <LionBenchmark/test.iml>
|
||||
#include <Draw/iml_source.h>
|
||||
|
|
@ -28,3 +24,16 @@ void Demo(Painter& sw)
|
|||
sw.End();
|
||||
}
|
||||
}
|
||||
|
||||
void Dash(Painter& sw)
|
||||
{
|
||||
sw.Move(50, 50).Line(400, 200).Dash("2").Stroke(5, Blue());
|
||||
sw.Translate(0, 10);
|
||||
sw.Move(50, 50).Line(400, 200).Dash("10 5").Stroke(5, Blue());
|
||||
sw.Translate(0, 10);
|
||||
sw.Move(50, 50).Line(400, 200).Dash("10 5 5 5").Stroke(5, Blue());
|
||||
sw.Translate(0, 10);
|
||||
sw.Move(50, 50).Line(400, 200).Dash("1").Stroke(5, Blue());
|
||||
sw.Translate(0, 10);
|
||||
sw.Move(50, 50).Line(400, 200).Dash("1 2 3 4 5").Stroke(5, Blue());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@ void Task(Painter& sw)
|
|||
// PythagorasTree(sw);
|
||||
// Demo(sw);
|
||||
// ClippingExample(sw);
|
||||
PolyPolygon(sw);
|
||||
// PolyPolygon(sw);
|
||||
// TextOnPath(sw);
|
||||
Dash(sw);
|
||||
|
||||
sw.End();
|
||||
}
|
||||
|
||||
|
|
@ -71,13 +74,6 @@ BaseAttr a, b;
|
|||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
RDUMP(sizeof(BaseAttr));
|
||||
Array<BaseAttr> h;
|
||||
__BREAK__;
|
||||
|
||||
memcpy(&h.Add(), &a, sizeof(BaseAttr));
|
||||
|
||||
return;
|
||||
#if 1 && !defined(_DEBUG)
|
||||
RDUMP(MemoryUsedKb());
|
||||
|
||||
|
|
@ -89,15 +85,17 @@ GUI_APP_MAIN
|
|||
sw.Co();
|
||||
// for(int i = 0; i < 10; i++)
|
||||
PaintLion(sw);
|
||||
for(int pass = 0; pass < 4; pass++) {
|
||||
for(int pass = 0; pass < 2; pass++) {
|
||||
int time0 = msecs();
|
||||
int n = 0;
|
||||
BufferPainter sw(ib);
|
||||
while(msecs(time0) < 1000) {
|
||||
n++;
|
||||
{
|
||||
BufferPainter sw(ib);
|
||||
sw.Co(pass & 1);
|
||||
sw.PreClip(pass & 2);
|
||||
Task(sw);
|
||||
while(msecs(time0) < 1000) {
|
||||
n++;
|
||||
Task(sw);
|
||||
}
|
||||
}
|
||||
tm[pass] = (double)msecs(time0) / n;
|
||||
RLOG(pass << ": " << n << ", " << tm[pass] << " ms");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue