summaryrefslogtreecommitdiff
path: root/vcl/workben
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-11-12 00:02:03 +0000
committerMichael Meeks <michael.meeks@collabora.com>2014-11-12 00:07:05 +0000
commit98f9baa5253f7bb8034f148519f31f548b1452fa (patch)
treee4b61f237209900711a88944b30a1fbe4ed77380 /vcl/workben
parenta05fe51feb29301968299d6167fa1acb0d5850e0 (diff)
vcldemo: add some clipping tests under the checkerboard tile.
Change-Id: I801931055aeba38e9173fb04dcc44b220cd3f17e
Diffstat (limited to 'vcl/workben')
-rw-r--r--vcl/workben/vcldemo.cxx55
1 files changed, 53 insertions, 2 deletions
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 4bf7993a9748..0aae8459531b 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -195,9 +195,60 @@ public:
struct DrawCheckered : public RegionRenderer
{
virtual void RenderRegion(OutputDevice &rDev, Rectangle r,
- const RenderContext &) SAL_OVERRIDE
+ const RenderContext &rCtx) SAL_OVERRIDE
{
- rDev.DrawCheckered(r.TopLeft(), r.GetSize());
+ if (rCtx.meStyle == RENDER_EXPANDED)
+ {
+ std::vector<Rectangle> aRegions(DemoWin::partition(rDev, 2, 2));
+ for (size_t i = 0; i < aRegions.size(); i++)
+ {
+ vcl::Region aRegion;
+ Rectangle aSub(aRegions[i]);
+ Rectangle aSmaller(aSub);
+ aSmaller.Move(10,10);
+ aSmaller.setWidth(aSmaller.getWidth()-20);
+ aSmaller.setHeight(aSmaller.getHeight()-24);
+ switch (i) {
+ case 0:
+ aRegion = vcl::Region(aSub);
+ break;
+ case 1:
+ aRegion = vcl::Region(aSmaller);
+ aRegion.XOr(aSub);
+ break;
+ case 2:
+ {
+ Polygon aPoly(aSub);
+ aPoly.Rotate(aSub.Center(), 450);
+ aPoly.Clip(aSmaller);
+ aRegion = vcl::Region(aPoly);
+ break;
+ }
+ case 3:
+ {
+ tools::PolyPolygon aPolyPoly;
+ sal_Int32 nTW = aSub.GetWidth()/6;
+ sal_Int32 nTH = aSub.GetHeight()/6;
+ Rectangle aTiny(Point(4, 4), Size(nTW*2, nTH*2));
+ aPolyPoly.Insert(Polygon(aTiny));
+ aTiny.Move(nTW*3, nTH*3);
+ aPolyPoly.Insert(Polygon(aTiny));
+ aTiny.Move(nTW, nTH);
+ aPolyPoly.Insert(Polygon(aTiny));
+
+ aRegion = vcl::Region(aPolyPoly);
+ break;
+ }
+ } // switch
+ rDev.SetClipRegion(aRegion);
+ rDev.DrawCheckered(aSub.TopLeft(), aSub.GetSize());
+ rDev.SetClipRegion();
+ }
+ }
+ else
+ {
+ rDev.DrawCheckered(r.TopLeft(), r.GetSize());
+ }
}
};