[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl2' - vcl/workben
Michael Meeks
michael.meeks at collabora.com
Sun Nov 16 17:06:55 PST 2014
vcl/workben/vcldemo.cxx | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
New commits:
commit 79d1c87bc27231905f21b382e36eae87480e9359
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Nov 17 02:07:44 2014 +0100
vcldemo: repair mini view, and add alpha blended page corner alike.
Change-Id: I0c047a2b8940e2be76c94bf9de5423aa7e0eff8b
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index b553153..3fb14d6 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -54,6 +54,7 @@ class DemoRenderer
RenderStyle meStyle;
bool mbVDev;
DemoRenderer *mpDemoRenderer;
+ Size maSize;
};
struct RegionRenderer {
public:
@@ -117,16 +118,15 @@ public:
static std::vector<Rectangle> partition(const RenderContext &rCtx, int nX, int nY)
{
- return rCtx.mpDemoRenderer->partition(nX, nY);
+ return rCtx.mpDemoRenderer->partition(rCtx.maSize, nX, nY);
}
- std::vector<Rectangle> partition(int nX, int nY)
+ std::vector<Rectangle> partition(Size aSize, int nX, int nY)
{
Rectangle r;
std::vector<Rectangle> aRegions;
// Make small cleared area for these guys
- Size aSize(GetSizePixel());
long nBorderSize = aSize.Width() / 32;
long nBoxWidth = (aSize.Width() - nBorderSize*(nX+1)) / nX;
long nBoxHeight = (aSize.Height() - nBorderSize*(nY+1)) / nY;
@@ -431,7 +431,6 @@ public:
Gradient aGradient;
aGradient.SetStartColor(COL_YELLOW);
aGradient.SetEndColor(COL_RED);
- // aGradient.SetAngle(45);
aGradient.SetStyle(GradientStyle_RECT);
aGradient.SetBorder(r.GetSize().Width()/20);
rDev.DrawGradient(r, aGradient);
@@ -478,8 +477,23 @@ public:
aWriter.Write(aStream);
}
#endif
-
- rDev.DrawBitmapEx(r.Center(), aShadowStretch);
+ Point aRenderPt(r.Center());
+ aRenderPt.Move(-nSlice-1, 0);
+ rDev.DrawBitmapEx(aRenderPt, aShadowStretch);
+
+ AlphaMask aWholeMask(aPageShadowMask.GetBitmap());
+ aBlockColor = Bitmap(aPageShadowMask.GetSizePixel(), 24);
+ aBlockColor.Erase(COL_GREEN);
+ BitmapEx aWhole(aBlockColor, aWholeMask);
+
+ aRenderPt = Point(r.Center());
+ aRenderPt.Move(nSlice+1, 0);
+
+ // An offset background for alpha rendering
+ rDev.SetFillColor(COL_BLUE);
+ Rectangle aSurround(r.Center(), Size(aPageShadowMask.GetSizePixel()));
+ rDev.DrawRect(aSurround);
+ rDev.DrawBitmapEx(aRenderPt, aWhole);
}
virtual void RenderRegion(OutputDevice &rDev, Rectangle r,
@@ -586,7 +600,7 @@ public:
Rectangle aWhole(Point(0,0), r.GetSize());
// mini me
- rCtx.mpDemoRenderer->drawToDevice(*pNested, true);
+ rCtx.mpDemoRenderer->drawToDevice(*pNested, r.GetSize(), true);
if (eType == RENDER_AS_BITMAP)
{
@@ -774,11 +788,12 @@ public:
}
};
- void drawToDevice(OutputDevice &rDev, bool bVDev)
+ void drawToDevice(OutputDevice &rDev, Size aSize, bool bVDev)
{
RenderContext aCtx;
aCtx.mbVDev = bVDev;
aCtx.mpDemoRenderer = this;
+ aCtx.maSize = aSize;
Rectangle aWholeWin(Point(0,0), rDev.GetOutputSizePixel());
@@ -793,7 +808,7 @@ public:
else
{
aCtx.meStyle = RENDER_THUMB;
- std::vector<Rectangle> aRegions(partition(mnSegmentsX, mnSegmentsY));
+ std::vector<Rectangle> aRegions(partition(aSize, mnSegmentsX, mnSegmentsY));
DemoRenderer::clearRects(rDev, aRegions);
for (size_t i = 0; i < maRenderers.size(); i++)
maRenderers[i]->RenderRegion(rDev, aRegions[i], aCtx);
@@ -882,7 +897,7 @@ bool DemoRenderer::MouseButtonDown(const MouseEvent& rMEvt)
}
// click on a region to zoom into it
- std::vector<Rectangle> aRegions(partition(mnSegmentsX, mnSegmentsY));
+ std::vector<Rectangle> aRegions(partition(GetSizePixel(), mnSegmentsX, mnSegmentsY));
for (size_t i = 0; i < aRegions.size(); i++)
{
if (aRegions[i].IsInside(rMEvt.GetPosPixel()))
@@ -994,7 +1009,7 @@ public:
{
mrRenderer.SetSizePixel(GetSizePixel());
fprintf(stderr, "DemoWin::Paint(%ld,%ld,%ld,%ld)\n", rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight());
- mrRenderer.drawToDevice(*this, false);
+ mrRenderer.drawToDevice(*this, GetSizePixel(), false);
}
};
More information about the Libreoffice-commits
mailing list