[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 68 1 file changed, 58 insertions(+), 10 deletions(-) New commits: commit cca52572c73a7e41960744b71241f8fa8804470f Author: Michael Meeks michael.me...@collabora.com Date: Thu Nov 13 13:48:24 2014 + vcldemo: add OutputDevice / copyBits test case. Change-Id: Ie585daba1d1a1f1dc9f2957c19462a501131d10a diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index fa38874..06a6d86 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -510,20 +510,67 @@ public: struct DrawToVirtualDevice : public RegionRenderer { +enum RenderType { +RENDER_AS_BITMAP, +RENDER_AS_OUTDEV, +RENDER_AS_BITMAPEX, +RENDER_AS_ALPHA_OUTDEV +}; + +void SizeAndRender(OutputDevice rDev, Rectangle r, RenderType eType, + const RenderContext rCtx) +{ +VirtualDevice *pNested; + +if ((int)eType RENDER_AS_BITMAPEX) +pNested = new VirtualDevice(rDev); +else +pNested = new VirtualDevice(rDev,0,0); + +pNested-SetOutputSizePixel(r.GetSize()); +Rectangle aWhole(Point(0,0), r.GetSize()); + +// mini me +rCtx.mpDemoWin-drawToDevice(*pNested, true); + +if (eType == RENDER_AS_BITMAP) +{ +Bitmap aBitmap(pNested-GetBitmap(Point(0,0),aWhole.GetSize())); +rDev.DrawBitmap(r.TopLeft(), aBitmap); +} +else if (eType == RENDER_AS_BITMAPEX) +{ +BitmapEx aBitmapEx(pNested-GetBitmapEx(Point(0,0),aWhole.GetSize())); +rDev.DrawBitmapEx(r.TopLeft(), aBitmapEx); +} +else if (eType == RENDER_AS_OUTDEV || + eType == RENDER_AS_ALPHA_OUTDEV) +{ +rDev.DrawOutDev(r.TopLeft(), r.GetSize(), +aWhole.TopLeft(), aWhole.GetSize(), +*pNested); +} +delete pNested; +} virtual void RenderRegion(OutputDevice rDev, Rectangle r, const RenderContext rCtx) SAL_OVERRIDE { // avoid infinite recursion if (rCtx.mbVDev) return; -VirtualDevice aNested(rDev); -aNested.SetOutputSizePixel(r.GetSize()); -Rectangle aWhole(Point(0,0), r.GetSize()); -// mini me -rCtx.mpDemoWin-drawToDevice(aNested, true); -Bitmap aBitmap(aNested.GetBitmap(Point(0,0),aWhole.GetSize())); -rDev.DrawBitmap(r.TopLeft(), aBitmap); +if (rCtx.meStyle == RENDER_EXPANDED) +{ +std::vectorRectangle aRegions(DemoWin::partition(rDev, 2, 2)); +DemoWin::clearRects(rDev, aRegions); + +RenderType eRenderTypes[] = { RENDER_AS_BITMAP, RENDER_AS_OUTDEV, + RENDER_AS_BITMAPEX, RENDER_AS_ALPHA_OUTDEV }; +for (size_t i = 0; i aRegions.size(); i++) +SizeAndRender(rDev, aRegions[i], eRenderTypes[i], rCtx); +} +else +SizeAndRender(rDev, r, RENDER_AS_BITMAP, rCtx); } }; @@ -578,17 +625,18 @@ public: } }; -void drawToDevice(OutputDevice rDev, bool bVdev) +void drawToDevice(OutputDevice rDev, bool bVDev) { RenderContext aCtx; -aCtx.mbVDev = bVdev; +aCtx.mbVDev = bVDev; aCtx.mpDemoWin = this; Rectangle aWholeWin(Point(0,0), rDev.GetOutputSizePixel()); drawBackground(rDev, aWholeWin); -if (mnSelectedRenderer = 0) +if (!bVDev /* want everything in the vdev */ +mnSelectedRenderer = 0) { aCtx.meStyle = RENDER_EXPANDED; maRenderers[mnSelectedRenderer]-RenderRegion(rDev, aWholeWin, aCtx); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2d887667ec64fe453c0b113b0b92159958430897 Author: Louis-Francis Ratté-Boulianne l...@collabora.com Date: Wed Nov 12 14:55:33 2014 -0500 vcldemo: Draw mini-view of the whole window in the last rectangle Change-Id: I74e8807e6a4f50b99fdc761bbdbef6e43405a3ed diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 340d53c..87f4784 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -626,7 +626,7 @@ void DemoWin::InitRenderers() maRenderers.push_back(new DrawPolyPolygons()); maRenderers.push_back(new DrawToVirtualDevice()); maRenderers.push_back(new DrawIcons()); -maRenderers.push_back(new DrawBitmap()); +maRenderers.push_back(new FetchDrawBitmap()); } class DemoApp : public Application ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit 7d99b95b29804a5497d524e4e09f58199de8f77c Author: Louis-Francis Ratté-Boulianne l...@collabora.com Date: Wed Nov 12 18:13:27 2014 -0500 vcldemo: Add some values to the gradient arrays Change-Id: I6c51bce7503866f39e72957752303e4d28145afb diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index ff76a12..fa38874 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -371,20 +371,20 @@ public: sal_uInt32 nStartCols[] = { COL_RED, COL_RED, COL_RED, COL_GREEN, COL_GREEN, COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN, -COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN, -COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK +COL_BLACK, COL_LIGHTGRAY, COL_WHITE, COL_BLUE, COL_CYAN, +COL_WHITE, COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK }; sal_uInt32 nEndCols[] = { -COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK, +COL_WHITE, COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK, COL_RED, COL_RED, COL_RED, COL_GREEN, COL_GREEN, COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN }; GradientStyle eStyles[] = { GradientStyle_LINEAR, GradientStyle_AXIAL, GradientStyle_RADIAL, GradientStyle_ELLIPTICAL, GradientStyle_SQUARE, -GradientStyle_RECT, GradientStyle_FORCE_EQUAL_SIZE, GradientStyle_LINEAR, GradientStyle_RADIAL, +GradientStyle_RECT, GradientStyle_FORCE_EQUAL_SIZE, GradientStyle_LINEAR, GradientStyle_RADIAL, GradientStyle_LINEAR, GradientStyle_LINEAR, GradientStyle_AXIAL, GradientStyle_RADIAL, GradientStyle_ELLIPTICAL, GradientStyle_SQUARE, -GradientStyle_RECT, GradientStyle_FORCE_EQUAL_SIZE, GradientStyle_LINEAR, GradientStyle_RADIAL +GradientStyle_RECT, GradientStyle_FORCE_EQUAL_SIZE, GradientStyle_LINEAR, GradientStyle_RADIAL, GradientStyle_LINEAR }; sal_uInt16 nAngles[] = { 0, 0, 0, 0, 0, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 61 1 file changed, 61 insertions(+) New commits: commit 2495761cbcc879e7faea1a0291999dfb17cdc8bb Author: Michael Meeks michael.me...@collabora.com Date: Tue Nov 11 21:51:58 2014 + vcldemo: click to invalidate bits and bounce a floatwin around. Change-Id: I0c417842393eb32132fd430b8bf31e93e7ec3b27 diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 16574d9..2ea89f0 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -24,6 +24,8 @@ #include vcl/wrkwin.hxx #include vcl/virdev.hxx #include vcl/graphicfilter.hxx +#include vcl/button.hxx +#include vcl/floatwin.hxx #if 0 # define FIXME_SELF_INTERSECTING_WORKING @@ -48,6 +50,8 @@ class DemoWin : public DemoBase public: DemoWin() : DemoBase() + , mpButton(NULL) + , mpButtonWin(NULL) { // Needed to find images OUString aPath; @@ -69,6 +73,15 @@ public: maIntroBW.Filter( BMP_FILTER_EMBOSS_GREY ); } +// Bouncing windows on click ... +PushButton *mpButton; +FloatingWindow *mpButtonWin; +AutoTimer maBounce; +int mnBounceX, mnBounceY; +DECL_LINK(BounceTimerCb, void *); + +virtual void MouseButtonDown( const MouseEvent rMEvt ) SAL_OVERRIDE; + void drawToDevice(OutputDevice r, bool bVdev); virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE @@ -287,6 +300,54 @@ public: } }; +IMPL_LINK_NOARG(DemoWin,BounceTimerCb) +{ +mpButton-Check(mnBounceX0); +mpButton-SetPressed(mnBounceY0); + +Point aCur = mpButtonWin-GetPosPixel(); +static const int nMovePix = 10; +aCur.Move(mnBounceX * nMovePix, mnBounceX * nMovePix); +Size aWinSize = GetSizePixel(); +if (aCur.X() = 0 || aCur.X() = aWinSize.Width()) +mnBounceX *= -1; +if (aCur.Y() = 0 || aCur.Y() = aWinSize.Height()) +mnBounceX *= -1; +mpButtonWin-SetPosPixel(aCur); + +// All smoke and mirrors to test sub-region invalidation underneath +Rectangle aRect(aCur, mpButtonWin-GetSizePixel()); +Invalidate(aRect); +return 0; +} + +void DemoWin::MouseButtonDown( const MouseEvent rMEvt ) +{ +(void) rMEvt; +if (!mpButton) +{ +mpButtonWin = new FloatingWindow(this); +mpButton = new PushButton(mpButtonWin); +mpButton-SetSymbol(SymbolType::HELP); +mpButton-SetText(PushButton demo); +mpButton-SetPosSizePixel(Point(0,0), mpButton-GetOptimalSize()); +mpButton-Show(); +mpButtonWin-SetPosSizePixel(Point(0,0), mpButton-GetOptimalSize()); +mpButtonWin-Show(); +mnBounceX = 1; mnBounceX = 1; +maBounce.SetTimeoutHdl(LINK(this,DemoWin,BounceTimerCb)); +maBounce.SetTimeout(55); +maBounce.Start(); +} +else +{ +maBounce.Stop(); +delete mpButtonWin; +mpButtonWin = NULL; +mpButton = NULL; +} +} + std::vectorRectangle DemoWin::partitionAndClear(OutputDevice rDev, int nX, int nY) { Rectangle r; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 435 1 file changed, 257 insertions(+), 178 deletions(-) New commits: commit 792fd337ef3948cde8715a0b12c8ca1e4ea7e0d6 Author: Michael Meeks michael.me...@collabora.com Date: Tue Nov 11 22:24:39 2014 + vcldemo: re-factor rendering panes, to enable zooming. Change-Id: Ib50fcba992293ec661912444a051a02d856c7189 diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 2ea89f0..33c11e1 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -43,11 +43,32 @@ public: OutputDevice getOutDev() { return *this; } }; +enum RenderStyle { +RENDER_THUMB,// small view n to a page +RENDER_EXPANDED, // expanded view of this renderer +}; + class DemoWin : public DemoBase { Bitmap maIntroBW; BitmapEx maIntro; +struct RenderContext { +RenderStyle meStyle; +boolmbVDev; +DemoWin*mpDemoWin; +}; +struct RegionRenderer { +public: +virtual ~RegionRenderer() {} +virtual void RenderRegion(OutputDevice rDev, Rectangle r, + const RenderContext rCtx) = 0; +}; + +std::vector RegionRenderer * maRenderers; + +void InitRenderers(); + public: DemoWin() : DemoBase() , mpButton(NULL) @@ -71,6 +92,8 @@ public: #endif maIntroBW = maIntro.GetBitmap(); maIntroBW.Filter( BMP_FILTER_EMBOSS_GREY ); + +InitRenderers(); } // Bouncing windows on click ... @@ -82,8 +105,6 @@ public: virtual void MouseButtonDown( const MouseEvent rMEvt ) SAL_OVERRIDE; -void drawToDevice(OutputDevice r, bool bVdev); - virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE { fprintf(stderr, DemoWin::Paint(%ld,%ld,%ld,%ld)\n, rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight()); @@ -104,199 +125,263 @@ public: rDev.DrawGradient(r, aGradient); } -void drawRadialLines(OutputDevice rDev, Rectangle r) +struct DrawRadialLines : public RegionRenderer { -rDev.SetFillColor(Color(COL_LIGHTRED)); -rDev.SetLineColor(Color(COL_BLACK)); -rDev.DrawRect( r ); - -for(int i=0; ir.GetHeight(); i+=15) -rDev.DrawLine( Point(r.Left(), r.Top()+i), Point(r.Right(), r.Bottom()-i) ); -for(int i=0; ir.GetWidth(); i+=15) -rDev.DrawLine( Point(r.Left()+i, r.Bottom()), Point(r.Right()-i, r.Top()) ); - -// Should draw a white-line across the middle -Color aLastPixel( COL_WHITE ); -Point aCenter((r.Left() + r.Right())/2 - 4, - (r.Top() + r.Bottom())/2 - 4); -for(int i=0; i8; i++) +virtual void RenderRegion(OutputDevice rDev, Rectangle r, + const RenderContext ) SAL_OVERRIDE { -rDev.DrawPixel(aCenter, aLastPixel); -aLastPixel = rDev.GetPixel(aCenter); -aCenter.Move(1,1); +rDev.SetFillColor(Color(COL_LIGHTRED)); +rDev.SetLineColor(Color(COL_BLACK)); +rDev.DrawRect( r ); + +for(int i=0; ir.GetHeight(); i+=15) +rDev.DrawLine( Point(r.Left(), r.Top()+i), Point(r.Right(), r.Bottom()-i) ); +for(int i=0; ir.GetWidth(); i+=15) +rDev.DrawLine( Point(r.Left()+i, r.Bottom()), Point(r.Right()-i, r.Top()) ); + +// Should draw a white-line across the middle +Color aLastPixel( COL_WHITE ); +Point aCenter((r.Left() + r.Right())/2 - 4, + (r.Top() + r.Bottom())/2 - 4); +for(int i=0; i8; i++) +{ +rDev.DrawPixel(aCenter, aLastPixel); +aLastPixel = rDev.GetPixel(aCenter); +aCenter.Move(1,1); +} } -} - -void drawText(OutputDevice rDev, Rectangle r) +}; +struct DrawText : public RegionRenderer { -rDev.SetTextColor( Color( COL_BLACK ) ); -vcl::Font aFont( OUString( Times ), Size( 0, 25 ) ); -rDev.SetFont( aFont ); -rDev.DrawText( r, OUString( Just a simple text ) ); -} +virtual void RenderRegion(OutputDevice rDev, Rectangle r, + const RenderContext ) SAL_OVERRIDE +{ +rDev.SetTextColor( Color( COL_BLACK ) ); +vcl::Font aFont( OUString( Times ), Size( 0, 25 ) ); +rDev.SetFont( aFont ); +rDev.DrawText( r, OUString( Just a simple text ) ); +} +}; -void drawPoly(OutputDevice rDev, Rectangle r) // pretty +struct DrawCheckered : public RegionRenderer { -drawCheckered(rDev, r); - -long nDx = r.GetWidth()/20; -long nDy = r.GetHeight()/20; -Rectangle aShrunk(r); -aShrunk.Move(nDx, nDy); -aShrunk.SetSize(Size(r.GetWidth()-nDx*2, -
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 53 +++- 1 file changed, 44 insertions(+), 9 deletions(-) New commits: commit e121f267cca6a5ed82f6fc5485233e9621a23515 Author: Michael Meeks michael.me...@collabora.com Date: Tue Nov 11 22:55:38 2014 + vcldemo: render an enlarged view on mouse click. Change-Id: I9021ab4744b16f967eaa5006128d30621b421d7a diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 33c11e1..8e033a9 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -53,6 +53,9 @@ class DemoWin : public DemoBase Bitmap maIntroBW; BitmapEx maIntro; +int mnSegmentsX; +int mnSegmentsY; + struct RenderContext { RenderStyle meStyle; boolmbVDev; @@ -66,11 +69,15 @@ class DemoWin : public DemoBase }; std::vector RegionRenderer * maRenderers; +sal_Int32 mnSelectedRenderer; void InitRenderers(); public: DemoWin() : DemoBase() + , mnSegmentsX(4) + , mnSegmentsY(3) + , mnSelectedRenderer(-1) , mpButton(NULL) , mpButtonWin(NULL) { @@ -114,14 +121,12 @@ public: std::vectorRectangle partitionAndClear(OutputDevice rDev, int nX, int nY); -void drawBackground(OutputDevice rDev) +void drawBackground(OutputDevice rDev, Rectangle r) { -Rectangle r(Point(0,0), rDev.GetOutputSizePixel()); Gradient aGradient; aGradient.SetStartColor(COL_BLUE); aGradient.SetEndColor(COL_GREEN); aGradient.SetStyle(GradientStyle_LINEAR); -//aGradient.SetBorder(r.GetSize().Width()/20); rDev.DrawGradient(r, aGradient); } @@ -373,15 +378,25 @@ public: void drawToDevice(OutputDevice rDev, bool bVdev) { RenderContext aCtx; -aCtx.meStyle = RENDER_THUMB; aCtx.mbVDev = bVdev; aCtx.mpDemoWin = this; -drawBackground(rDev); +Rectangle aWholeWin(Point(0,0), rDev.GetOutputSizePixel()); + +drawBackground(rDev, aWholeWin); -std::vectorRectangle aRegions(partitionAndClear(rDev, 4, 3)); -for (size_t i = 0; i maRenderers.size(); i++) -maRenderers[i]-RenderRegion(rDev, aRegions[i], aCtx); +if (mnSelectedRenderer = 0) +{ +aCtx.meStyle = RENDER_EXPANDED; +maRenderers[mnSelectedRenderer]-RenderRegion(rDev, aWholeWin, aCtx); +} +else +{ +aCtx.meStyle = RENDER_THUMB; +std::vectorRectangle aRegions(partitionAndClear(rDev, mnSegmentsX, mnSegmentsY)); +for (size_t i = 0; i maRenderers.size(); i++) +maRenderers[i]-RenderRegion(rDev, aRegions[i], aCtx); +} } }; @@ -408,7 +423,27 @@ IMPL_LINK_NOARG(DemoWin,BounceTimerCb) void DemoWin::MouseButtonDown( const MouseEvent rMEvt ) { -(void) rMEvt; +// click to zoom out +if (mnSelectedRenderer = 0) +{ +mnSelectedRenderer = -1; +Invalidate(); +return; +} + +// click on a region to zoom into it +std::vectorRectangle aRegions(partitionAndClear(*this, mnSegmentsX, mnSegmentsY)); +for (size_t i = 0; i aRegions.size(); i++) +{ +if (aRegions[i].IsInside(rMEvt.GetPosPixel())) +{ +mnSelectedRenderer = i; +Invalidate(); +return; +} +} + +// otherwise bounce floating windows if (!mpButton) { mpButtonWin = new FloatingWindow(this); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 153 +--- 1 file changed, 107 insertions(+), 46 deletions(-) New commits: commit c2e47f60779e8f2b2365da5f1f80deeb7833d312 Author: Michael Meeks michael.me...@collabora.com Date: Tue Nov 11 23:32:35 2014 + vcldemo: render a selection of odd gradients. Change-Id: Ic3d2f795d453b9c48316d78d0d50486624cdc2b1 diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 8e033a9..08a0e64 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -118,8 +118,46 @@ public: drawToDevice(getOutDev(), false); } -std::vectorRectangle partitionAndClear(OutputDevice rDev, - int nX, int nY); +static std::vectorRectangle partition(OutputDevice rDev, int nX, int nY) +{ +Rectangle r; +std::vectorRectangle aRegions; + +// Make small cleared area for these guys +Size aSize(rDev.GetOutputSizePixel()); +long nBorderSize = aSize.Width() / 32; +long nBoxWidth = (aSize.Width() - nBorderSize*(nX+1)) / nX; +long nBoxHeight = (aSize.Height() - nBorderSize*(nY+1)) / nY; +for (int y = 0; y nY; y++ ) +{ +for (int x = 0; x nX; x++ ) +{ +r.SetPos(Point(nBorderSize + (nBorderSize + nBoxWidth) * x, + nBorderSize + (nBorderSize + nBoxHeight) * y)); +r.SetSize(Size(nBoxWidth, nBoxHeight)); +aRegions.push_back(r); +} +} + +return aRegions; +} + +static void clearRects(OutputDevice rDev, std::vectorRectangle rRects) +{ +for (size_t i = 0; i rRects.size(); i++) +{ +// knock up a nice little border +rDev.SetLineColor(COL_GRAY); +rDev.SetFillColor(COL_LIGHTGRAY); +if (i % 2) +{ +int nBorderSize = rRects[i].GetWidth() / 5; +rDev.DrawRect(rRects[i], nBorderSize, nBorderSize); +} +else +rDev.DrawRect(rRects[i]); +} +} void drawBackground(OutputDevice rDev, Rectangle r) { @@ -165,7 +203,7 @@ public: rDev.SetTextColor( Color( COL_BLACK ) ); vcl::Font aFont( OUString( Times ), Size( 0, 25 ) ); rDev.SetFont( aFont ); -rDev.DrawText( r, OUString( Just a simple text ) ); +rDev.DrawText( r, OUString( Click any rect to zoom ) ); } }; @@ -215,15 +253,70 @@ public: struct DrawGradient : public RegionRenderer { virtual void RenderRegion(OutputDevice rDev, Rectangle r, - const RenderContext ) SAL_OVERRIDE + const RenderContext rCtx) SAL_OVERRIDE { -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); +if (rCtx.meStyle == RENDER_EXPANDED) +{ +std::vectorRectangle aRegions(DemoWin::partition(rDev, 5, 4)); +sal_uInt32 nStartCols[] = { +COL_RED, COL_RED, COL_RED, COL_GREEN, COL_GREEN, +COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN, +COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN, +COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK +}; +sal_uInt32 nEndCols[] = { +COL_WHITE, COL_WHITE, COL_BLACK, COL_BLACK, +COL_RED, COL_RED, COL_RED, COL_GREEN, COL_GREEN, +COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN, +COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN +}; +GradientStyle eStyles[] = { +GradientStyle_LINEAR, GradientStyle_AXIAL, GradientStyle_RADIAL, GradientStyle_ELLIPTICAL, GradientStyle_SQUARE, +GradientStyle_RECT, GradientStyle_FORCE_EQUAL_SIZE, GradientStyle_LINEAR, GradientStyle_RADIAL, +GradientStyle_LINEAR, GradientStyle_AXIAL, GradientStyle_RADIAL, GradientStyle_ELLIPTICAL, GradientStyle_SQUARE, +GradientStyle_RECT, GradientStyle_FORCE_EQUAL_SIZE, GradientStyle_LINEAR, GradientStyle_RADIAL +}; +sal_uInt16 nAngles[] = { +0, 0, 0, 0, 0, +15, 30, 45, 60, 75, +90, 120, 135, 160, 180, +0, 0, 0, 0, 0 +}; +sal_uInt16 nBorders[] = { +0, 0, 0, 0, 0, +1, 10, 100, 10, 1, +0, 0, 0, 0, 0, +
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 55 ++-- 1 file changed, 53 insertions(+), 2 deletions(-) New commits: commit 5148bb3b4b5191335b8d260283c3c2aaae70cc02 Author: Michael Meeks michael.me...@collabora.com Date: Wed Nov 12 00:02:03 2014 + vcldemo: add some clipping tests under the checkerboard tile. Change-Id: I801931055aeba38e9173fb04dcc44b220cd3f17e diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 08a0e64..340d53c 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -210,9 +210,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::vectorRectangle 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()); +} } }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 170 +++- 1 file changed, 97 insertions(+), 73 deletions(-) New commits: commit 396112002904da353cc88bd090487ba694689d4d Author: Michael Meeks michael.me...@collabora.com Date: Sat Nov 8 21:34:10 2014 + vcldemo: re-factor to allow rendering to any outputdevice. Change-Id: Ie3367c004d89043fb78d0b2dcd49254323353a4c diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index d753c0d..9b314df 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -32,13 +32,23 @@ using namespace css; -class DemoWin : public WorkWindow +class DemoBase : +public WorkWindow // hide OutputDevice if necessary +{ +public: +DemoBase() : WorkWindow( NULL, WB_APP | WB_STDWORK) +{ +} +OutputDevice getOutDev() { return *this; } +}; + +class DemoWin : public DemoBase { Bitmap maIntroBW; BitmapEx maIntro; public: -DemoWin() : WorkWindow( NULL, WB_APP | WB_STDWORK) +DemoWin() : DemoBase() { // Needed to find images OUString aPath; @@ -60,32 +70,39 @@ public: maIntroBW.Filter( BMP_FILTER_EMBOSS_GREY ); } -virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE; +void drawToDevice(OutputDevice r); -std::vectorRectangle partitionAndClear(int nX, int nY); +virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE +{ +fprintf(stderr, DemoWin::Paint(%ld,%ld,%ld,%ld)\n, rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight()); +drawToDevice(getOutDev()); +} -void drawBackground() +std::vectorRectangle partitionAndClear(OutputDevice rDev, + int nX, int nY); + +void drawBackground(OutputDevice rDev) { -Rectangle r(Point(0,0), GetSizePixel()); +Rectangle r(Point(0,0), rDev.GetOutputSizePixel()); Gradient aGradient; aGradient.SetStartColor(COL_BLUE); aGradient.SetEndColor(COL_GREEN); aGradient.SetStyle(GradientStyle_LINEAR); //aGradient.SetBorder(r.GetSize().Width()/20); -DrawGradient(r, aGradient); +rDev.DrawGradient(r, aGradient); } -void drawRadialLines(Rectangle r) +void drawRadialLines(OutputDevice rDev, Rectangle r) { -SetFillColor(Color(COL_LIGHTRED)); -SetLineColor(Color(COL_BLACK)); -DrawRect( r ); +rDev.SetFillColor(Color(COL_LIGHTRED)); +rDev.SetLineColor(Color(COL_BLACK)); +rDev.DrawRect( r ); // FIXME: notice these appear reflected at the bottom not the top. for(int i=0; ir.GetHeight(); i+=15) -DrawLine( Point(r.Left(), r.Top()+i), Point(r.Right(), r.Bottom()-i) ); +rDev.DrawLine( Point(r.Left(), r.Top()+i), Point(r.Right(), r.Bottom()-i) ); for(int i=0; ir.GetWidth(); i+=15) -DrawLine( Point(r.Left()+i, r.Bottom()), Point(r.Right()-i, r.Top()) ); +rDev.DrawLine( Point(r.Left()+i, r.Bottom()), Point(r.Right()-i, r.Top()) ); // Should draw a white-line across the middle Color aLastPixel( COL_WHITE ); @@ -93,23 +110,25 @@ public: (r.Top() + r.Bottom())/2 - 4); for(int i=0; i8; i++) { -DrawPixel(aCenter, aLastPixel); -aLastPixel = GetPixel(aCenter); +rDev.DrawPixel(aCenter, aLastPixel); +aLastPixel = rDev.GetPixel(aCenter); aCenter.Move(1,1); } } -void drawText(Rectangle r) +void drawText(OutputDevice rDev, Rectangle r) + { -SetTextColor( Color( COL_BLACK ) ); +rDev.SetTextColor( Color( COL_BLACK ) ); vcl::Font aFont( OUString( Times ), Size( 0, 25 ) ); -SetFont( aFont ); -DrawText( r, OUString( Just a simple text ) ); +rDev.SetFont( aFont ); +rDev.DrawText( r, OUString( Just a simple text ) ); } -void drawPoly(Rectangle r) // pretty +void drawPoly(OutputDevice rDev, Rectangle r) + // pretty { -drawCheckered(r); +drawCheckered(rDev, r); long nDx = r.GetWidth()/20; long nDy = r.GetHeight()/20; @@ -119,22 +138,25 @@ public: r.GetHeight()-nDy*2)); Polygon aPoly(aShrunk); tools::PolyPolygon aPPoly(aPoly); -SetLineColor(Color(COL_RED)); -SetFillColor(Color(COL_RED)); +rDev.SetLineColor(Color(COL_RED)); +rDev.SetFillColor(Color(COL_RED)); // This hits the optional 'drawPolyPolygon' code-path -DrawTransparent(aPPoly, 64); +rDev.DrawTransparent(aPPoly, 64); } -void drawEllipse(Rectangle r) +void drawEllipse(OutputDevice rDev, Rectangle r) + { -SetLineColor(Color(COL_RED)); -SetFillColor(Color(COL_GREEN)); -DrawEllipse(r); +rDev.SetLineColor(Color(COL_RED)); +
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) New commits: commit b5a6d9109e2a30b344e22a6c97893bb03b71dadb Author: Michael Meeks michael.me...@collabora.com Date: Sat Nov 8 21:41:13 2014 + vcldemo: add a virtualdevice test. Change-Id: I8ff8c74e13a128d778b487ec2818820df9d5058a diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 9b314df..cae3fb0b 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -22,6 +22,7 @@ #include vcl/svapp.hxx #include vcl/pngread.hxx #include vcl/wrkwin.hxx +#include vcl/virdev.hxx #include vcl/graphicfilter.hxx #if 0 @@ -70,12 +71,12 @@ public: maIntroBW.Filter( BMP_FILTER_EMBOSS_GREY ); } -void drawToDevice(OutputDevice r); +void drawToDevice(OutputDevice r, bool bVdev); virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE { fprintf(stderr, DemoWin::Paint(%ld,%ld,%ld,%ld)\n, rRect.getX(), rRect.getY(), rRect.getWidth(), rRect.getHeight()); -drawToDevice(getOutDev()); +drawToDevice(getOutDev(), false); } std::vectorRectangle partitionAndClear(OutputDevice rDev, @@ -233,8 +234,19 @@ public: rDev.DrawPolyPolygon(aPolyPoly); #endif } -void fetchDrawBitmap(OutputDevice rDev, Rectangle r) +void drawToVirtualDevice(OutputDevice rDev, Rectangle r) +{ +VirtualDevice aNested; +aNested.SetOutputSize(r.GetSize()); +Rectangle aWhole(Point(0,0), r.GetSize()); +// mini me +drawToDevice(aNested, true); + +Bitmap aBitmap(aNested.GetBitmap(Point(0,0),aWhole.GetSize())); +rDev.DrawBitmap(r.TopLeft(), aBitmap); +} +void fetchDrawBitmap(OutputDevice rDev, Rectangle r) { // FIXME: should work ... Bitmap aBitmap(GetBitmap(Point(0,0),rDev.GetOutputSizePixel())); @@ -282,7 +294,7 @@ std::vectorRectangle DemoWin::partitionAndClear(OutputDevice rDev, int nX, in return aRegions; } -void DemoWin::drawToDevice(OutputDevice rDev) +void DemoWin::drawToDevice(OutputDevice rDev, bool bVdev) { drawBackground(rDev); @@ -297,8 +309,10 @@ void DemoWin::drawToDevice(OutputDevice rDev) drawBitmap(rDev, aRegions[6]); drawGradient(rDev, aRegions[7]); drawPolyPolgons(rDev, aRegions[8]); +if (!bVdev) +drawToVirtualDevice(rDev, aRegions[9]); // last - thumbnail all the above -fetchDrawBitmap(rDev, aRegions[9]); +fetchDrawBitmap(rDev, aRegions[10]); } class DemoApp : public Application ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/outdevgrind.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 51d61a22e1d6d95fde18fa434e233aa0087e4846 Author: Jan Holesovsky ke...@collabora.com Date: Fri Nov 7 11:42:50 2014 +0100 Fix the Windows build. Change-Id: Ic95f241ea1b4cadddfacb46a1fff157555c8c8b5 diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index 262d550..66763e0 100644 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -48,7 +48,6 @@ #include boost/bind.hpp #include stdio.h -#include unistd.h using namespace ::com::sun::star; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 66 +--- 1 file changed, 57 insertions(+), 9 deletions(-) New commits: commit 7dedb96d7a82f206dfa69ca6ed6a61e569dcddf8 Author: Michael Meeks michael.me...@collabora.com Date: Fri Nov 7 11:23:43 2014 + vcldemo: initial bitmap tests. Change-Id: I2841e689b732467f2168450dc47464b322baa183 diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index e381f09..1fdd751 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include rtl/bootstrap.hxx #include comphelper/processfactory.hxx #include cppuhelper/bootstrap.hxx #include com/sun/star/lang/XMultiServiceFactory.hpp @@ -16,16 +17,41 @@ #include vcl/vclmain.hxx +#include tools/urlobj.hxx +#include tools/stream.hxx #include vcl/svapp.hxx +#include vcl/pngread.hxx #include vcl/wrkwin.hxx +#include vcl/graphicfilter.hxx using namespace css; class DemoWin : public WorkWindow { +Bitmap maIntroBW; +BitmapEx maIntro; + public: DemoWin() : WorkWindow( NULL, WB_APP | WB_STDWORK) { +// Needed to find images +OUString aPath; +rtl::Bootstrap::get(SYSBINDIR, aPath); +#ifdef FIXME_THIS_FAILS +rtl::Bootstrap::set(BRAND_BASE_DIR, aPath + /..); +if (Application::LoadBrandBitmap(intro, maIntro)) +Application::Abort(Failed to load intro image); +#else +aPath = aPath + /intro.png; +SvFileStream aFileStream( aPath, STREAM_READ ); +GraphicFilter aGraphicFilter(false); +Graphic aGraphic; +if (aGraphicFilter.ImportGraphic(aGraphic, aPath, aFileStream) != 0) +Application::Abort(Failed to load intro image: + aPath); +maIntro = aGraphic.GetBitmapEx(); +#endif +maIntroBW = maIntro.GetBitmap(); +maIntroBW.Filter( BMP_FILTER_EMBOSS_GREY ); } virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE; @@ -46,9 +72,10 @@ public: void drawRadialLines(Rectangle r) { SetFillColor(Color(COL_LIGHTRED)); -SetLineColor(Color(COL_LIGHTGREEN)); +SetLineColor(Color(COL_BLACK)); DrawRect( r ); +// FIXME: notice these appear reflected at the bottom not the top. for(int i=0; ir.GetHeight(); i+=15) DrawLine( Point(r.Left(), r.Top()+i), Point(r.Right(), r.Bottom()-i) ); for(int i=0; ir.GetWidth(); i+=15) @@ -69,12 +96,10 @@ public: SetLineColor(Color(COL_RED)); //DrawPolyLine(aPoly); } - void drawPolyPoly(Rectangle r) { (void)r; } - void drawCheckered(Rectangle r) { DrawCheckered(r.TopLeft(), r.GetSize()); @@ -82,13 +107,31 @@ public: void drawGradient(Rectangle r) { Gradient aGradient; -aGradient.SetStartColor(COL_BLUE); -aGradient.SetEndColor(COL_GREEN); +aGradient.SetStartColor(COL_YELLOW); +aGradient.SetEndColor(COL_RED); //aGradient.SetAngle(45); -aGradient.SetStyle(GradientStyle_LINEAR); +aGradient.SetStyle(GradientStyle_RECT); aGradient.SetBorder(r.GetSize().Width()/20); DrawGradient(r, aGradient); } +void drawBitmap(Rectangle r) +{ +Bitmap aBitmap(maIntroBW); +aBitmap.Scale(r.GetSize(), BMP_SCALE_BESTQUALITY); +DrawBitmap(r.TopLeft(), aBitmap); +} +void drawBitmapEx(Rectangle r) +{ +BitmapEx aBitmap(maIntro); +aBitmap.Scale(r.GetSize(), BMP_SCALE_BESTQUALITY); +DrawBitmapEx(r.TopLeft(), aBitmap); +} +void fetchDrawBitmap(Rectangle r) +{ +Bitmap aBitmap(GetBitmap(Point(0,0),GetSizePixel())); +aBitmap.Scale(r.GetSize(), BMP_SCALE_BESTQUALITY); +DrawBitmap(r.TopLeft(), aBitmap); +} }; std::vectorRectangle DemoWin::partitionAndClear(int nX, int nY) @@ -100,8 +143,7 @@ std::vectorRectangle DemoWin::partitionAndClear(int nX, int nY) Size aSize(GetSizePixel()); long nBorderSize = aSize.Width() / 32; long nBoxWidth = (aSize.Width() - nBorderSize*(nX+1)) / nX; -long nBoxHeight = (aSize.Height() - nBorderSize*(nX+1)) / nY; -//SL_DEBUG(Size aSize boxes nBoxWidth x nBoxHeight border nBorderSize); +long nBoxHeight = (aSize.Height() - nBorderSize*(nY+1)) / nY; for (int y = 0; y nY; y++ ) { for (int x = 0; x nX; x++ ) @@ -117,7 +159,8 @@ std::vectorRectangle DemoWin::partitionAndClear(int nX, int nY) DrawRect(r); else DrawRect(r); -// DrawRect(r, nBorderSize, nBorderSize); FIXME - lfrb +// FIXME: rendering these guys doesn't work at all +// DrawRect(r, nBorderSize, nBorderSize); aRegions.push_back(r); } @@ -140,7 +183,12 @@ void DemoWin::Paint( const Rectangle rRect ) drawPoly(aRegions[i++]);
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/vcldemo.cxx | 56 1 file changed, 56 insertions(+) New commits: commit 0ec02a11bac301f07ca818875189ab3eaf713f14 Author: Michael Meeks michael.me...@collabora.com Date: Fri Nov 7 15:11:38 2014 + vcldemo: more interesting pieces, DrawPoint, DrawTransparent and more. Change-Id: I77c6e5c54a9d0e71014e8c7905132a56e39a302a diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index b58c70f..b3c488c 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -27,6 +27,7 @@ #if 0 # define FIXME_ALPHA_WORKING # define FIXME_ROUNDED_RECT_WORKING +# define FIXME_DRAW_TRANSPARENT_WORKING #endif using namespace css; @@ -85,6 +86,17 @@ public: DrawLine( Point(r.Left(), r.Top()+i), Point(r.Right(), r.Bottom()-i) ); for(int i=0; ir.GetWidth(); i+=15) DrawLine( Point(r.Left()+i, r.Bottom()), Point(r.Right()-i, r.Top()) ); + +// Should draw a white-line across the middle +Color aLastPixel( COL_WHITE ); +Point aCenter((r.Left() + r.Right())/2 - 4, + (r.Top() + r.Bottom())/2 - 4); +for(int i=0; i8; i++) +{ +DrawPixel(aCenter, aLastPixel); +aLastPixel = GetPixel(aCenter); +aCenter.Move(1,1); +} } void drawText(Rectangle r) @@ -152,6 +164,49 @@ public: DrawBitmapEx(r.TopLeft(), aBitmap); #endif } +void drawPolyPolgons(Rectangle r) +{ +struct { +double nX, nY; +} aPoints[] = { { 0.1, 0.1 }, { 0.9, 0.9 }, +{ 0.9, 0.1 }, { 0.1, 0.9 }, +{ 0.1, 0.1 } }; + +tools::PolyPolygon aPolyPoly; +// Render 4x polygons aggregate into another PolyPolygon +for (int x = 0; x 2; x++) +{ +for (int y = 0; y 2; y++) +{ +Rectangle aSubRect(r); +aSubRect.Move(x * r.GetWidth()/3, y * r.GetHeight()/3); +aSubRect.SetSize(Size(r.GetWidth()/2, r.GetHeight()/4)); +Polygon aPoly(SAL_N_ELEMENTS(aPoints)); +for (size_t v = 0; v SAL_N_ELEMENTS(aPoints); v++) +{ +aPoly.SetPoint(Point(aSubRect.Left() + + aSubRect.GetWidth() * aPoints[v].nX, + aSubRect.Top() + + aSubRect.GetHeight() * aPoints[v].nY), + v); +} +SetLineColor(Color(COL_YELLOW)); +SetFillColor(Color(COL_BLACK)); +DrawPolygon(aPoly); + +// now move and add to the polypolygon +aPoly.Move(0, r.GetHeight()/2); +aPolyPoly.Insert(aPoly); +} +} +SetLineColor(Color(COL_LIGHTRED)); +SetFillColor(Color(COL_GREEN)); +#ifdef FIXME_DRAW_TRANSPARENT_WORKING +DrawTransparent(aPolyPoly, 50); +#else +DrawPolyPolygon(aPolyPoly); +#endif +} void fetchDrawBitmap(Rectangle r) { // FIXME: should work ... @@ -217,6 +272,7 @@ void DemoWin::Paint( const Rectangle rRect ) drawBitmapEx(aRegions[i++]); drawBitmap(aRegions[i++]); drawGradient(aRegions[i++]); +drawPolyPolgons(aRegions[i++]); // last - thumbnail all the above fetchDrawBitmap(aRegions[i++]); assert(i=12); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/icontest.cxx | 218 --- 1 file changed, 4 insertions(+), 214 deletions(-) New commits: commit 15e15f5ed18fc46c83a1afb31bf4c0a67e78793d Author: Michael Meeks michael.me...@collabora.com Date: Fri Nov 7 05:42:51 2014 + icontest: remove hand-coded opengl path. Change-Id: I5e465e1dacfd5d2c3a34fe2f3aefc263bccc14c5 diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx index f9b0709..5c73b92 100644 --- a/vcl/workben/icontest.cxx +++ b/vcl/workben/icontest.cxx @@ -80,21 +80,6 @@ public: virtual void Resize() SAL_OVERRIDE; }; -class MyOpenGLWorkWindow : public MyWorkWindow -{ -public: -bool mbHaveTexture; -OpenGLWindow *mpOpenGLWindow; -GLuint mnTextureName; -float mnTextureAspect; - -void LoadTexture(); - -MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle ); - -virtual void Paint( const Rectangle rRect ) SAL_OVERRIDE; -}; - MyWorkWindow::MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) : WorkWindow(pParent, nWinStyle) , mpBitmap(NULL) @@ -145,165 +130,6 @@ void MyWorkWindow::Paint( const Rectangle rRect ) Invalidate( INVALIDATE_CHILDREN ); } -MyOpenGLWorkWindow::MyOpenGLWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) -: MyWorkWindow(pParent, nWinStyle) -, mnTextureName(0) -, mnTextureAspect(0) -{ -mbHaveTexture = false; -mpOpenGLWindow = new OpenGLWindow( this ); -mpOpenGLWindow-SetSizePixel( Size( WIDTH, HEIGHT ) ); -mpOpenGLWindow-Show(); -mpOpenGLWindow-EnableInput(); -} - -void MyOpenGLWorkWindow::LoadTexture() -{ -mbHaveTexture = true; - -glEnable(GL_TEXTURE_2D); -CHECK_GL_ERROR(); - -glPixelStorei(GL_UNPACK_ALIGNMENT, 1); -CHECK_GL_ERROR(); - -glGenTextures( 1, mnTextureName ); -CHECK_GL_ERROR(); - -glBindTexture(GL_TEXTURE_2D, mnTextureName); -CHECK_GL_ERROR(); - -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); -CHECK_GL_ERROR(); -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); -CHECK_GL_ERROR(); -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -CHECK_GL_ERROR(); -glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -CHECK_GL_ERROR(); - -BitmapEx aBitmap( maGraphic.GetBitmapEx( ) ); -Size aBitmapSize( aBitmap.GetSizePixel() ); - -GLint maxTexSize; -glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxTexSize); -CHECK_GL_ERROR(); - -SAL_INFO(vcl.icontest, GL_MAX_TEXTURE_SIZE: maxTexSize); - -if (aBitmapSize.Width() maxTexSize || aBitmapSize.Height() maxTexSize) -{ -Size aNewSize(aBitmapSize); -if (aNewSize.Width() maxTexSize) -{ -aNewSize.setHeight(aNewSize.Height() * (((float) maxTexSize) / aNewSize.Width())); -aNewSize.setWidth(maxTexSize); -} -if (aNewSize.Height() maxTexSize) -{ -aNewSize.setWidth(aNewSize.Width() * (((float) maxTexSize) / aNewSize.Height())); -aNewSize.setHeight(maxTexSize); -} -SAL_INFO(vcl.icontest, Scaling to aNewSize); -aBitmap.Scale(aNewSize, BMP_SCALE_SUPER); -aBitmapSize = aNewSize; -} - -SAL_INFO(vcl.icontest, GLEW_ARB_texture_non_power_of_two: (GLEW_ARB_texture_non_power_of_two ? YES : NO)); - -GLsizei texWidth(aBitmapSize.Width()), texHeight(aBitmapSize.Height()); - -mnTextureAspect = ((float) aBitmapSize.Width()) / aBitmapSize.Height(); - -if (!GLEW_ARB_texture_non_power_of_two) -{ -texWidth = texHeight = std::max(aBitmapSize.Width(), aBitmapSize.Height()); -if (!glm::isPowerOfTwo(texWidth)) -{ -texWidth = glm::powerOfTwoAbove(texWidth); -texHeight = texWidth; -} - -aBitmap.Expand(texWidth - aBitmapSize.Width(), texHeight - aBitmapSize.Height()); - -mnTextureAspect = 1; -} - -SAL_INFO(vcl.icontest, Texture size: texWidth x texHeight); - -GLubyte *buffer = new GLubyte[texWidth * texHeight * 4]; -OpenGLHelper::ConvertBitmapExToRGBATextureBuffer( aBitmap, buffer, true ); - -glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, - texWidth, texHeight, - 0, GL_RGBA, GL_UNSIGNED_BYTE, - buffer); -CHECK_GL_ERROR(); - -delete[] buffer; -} - -void MyOpenGLWorkWindow::Paint( const Rectangle ) -{ -std::cout == Paint! mnPaintCount++ (OpenGL) GetSizePixel() getTimeNow() - mnStartTime std::endl; -OpenGLContext aCtx = mpOpenGLWindow-getContext(); -aCtx.requestLegacyContext(); -CHECK_GL_ERROR(); - -if (!mbHaveTexture) -LoadTexture(); - -aCtx.setWinSize( Size( WIDTH+1, HEIGHT+1 ) ); -CHECK_GL_ERROR(); - -aCtx.makeCurrent(); -CHECK_GL_ERROR(); - -glViewport( 0, 0, WIDTH, HEIGHT ); -CHECK_GL_ERROR(); - -glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -CHECK_GL_ERROR(); - -
[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben
vcl/workben/outdevgrind.cxx | 17 + 1 file changed, 17 insertions(+) New commits: commit 2fa384e1b88f63215e1f03c9d6bf5e53c31d438c Author: Michael Meeks michael.me...@collabora.com Date: Fri Nov 7 06:02:57 2014 + outdevgrind: remove VirtualDevice pieces for now. Change-Id: Ided27750ff59c4c0b477d049ccb59760e87ce69e diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index 2e95437..262d550 100644 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -40,6 +40,8 @@ #include vcl/gradient.hxx #include vcl/lineinfo.hxx +#include rtl/bootstrap.hxx + #include osl/time.h #include boost/function.hpp @@ -109,6 +111,7 @@ void setupMethodStubs( functor_vector_type res ) const OUStringaString(This is a test); const LineInfoaLineInfo(LINE_SOLID,5); +#ifdef FIXME_VDEV // unfortunately, VDevs have inaccessible copy constructors static VirtualDevice aVDev; static VirtualDevice aVDevBW(1); @@ -120,6 +123,18 @@ void setupMethodStubs( functor_vector_type res ) const Bitmap aBitmap( aVDev.GetBitmap(aPt1,aVDevSize) ); const Bitmap aBitmapBW( aVDevBW.GetBitmap(aPt1,aVDevSize) ); const Bitmap aBitmapAlien( aVDevSize, 8 ); +#else +BitmapEx aIntro; +rtl::Bootstrap::set(BRAND_BASE_DIR, .); +if (Application::LoadBrandBitmap (intro, aIntro)) +Application::Abort( Failed to load intro image, run inside program/ ); + +const Bitmap aBitmap( aIntro.GetBitmap() ); +BitmapaBitmapBW( aBitmap ); +aBitmapBW.Filter( BMP_FILTER_EMBOSS_GREY ); +Bitmap aBitmapAlien( Size( 100, 100 ), 8 ); +aBitmapAlien.Erase( COL_RED ); +#endif const BitmapExaBitmapEx( aBitmap, aBitmapBW ); const BitmapExaBitmapExBW( aBitmapBW, aBitmapBW ); @@ -284,6 +299,7 @@ void setupMethodStubs( functor_vector_type res ) aRect2.TopLeft(), aRect2.GetSize(), aRect.TopLeft(), aRect.GetSize())); +#ifdef FIXME_VDEV /* void DrawOutDev( const Point rDestPt, const Size rDestSize, const Point rSrcPt, const Size rSrcSize, const OutputDevice rOutDev ); @@ -315,6 +331,7 @@ void setupMethodStubs( functor_vector_type res ) aRect2.TopLeft(), aRect2.GetSize(), aRect.TopLeft(), aRect.GetSize(), boost::cref(aVDev) )); +#endif /* void CopyArea( const Point rDestPt, const Point rSrcPt, const Size rSrcSize, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits