vcl/qa/cppunit/outdev.cxx | 27 ++++++++++++---- vcl/win/source/gdi/salvd.cxx | 2 - vcl/workben/vcldemo.cxx | 70 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 87 insertions(+), 12 deletions(-)
New commits: commit a34b0fd130857804fd12a24c781b68e7a78169f7 Author: Michael Meeks <michael.me...@collabora.com> Date: Mon Dec 1 13:45:03 2014 +0000 vcl: improve vcldemo & outdev test. Change-Id: I1ebc3c3b3cffabc8ba446ecd45ac2d9b0d45aff1 diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index 47e8dcf..de02ffc 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -15,6 +15,9 @@ #include <vcl/bmpacc.hxx> #include <vcl/wrkwin.hxx> +#include <tools/stream.hxx> +#include <vcl/pngwrite.hxx> + class VclOutdevTest : public test::BootstrapFixture { public: @@ -36,18 +39,30 @@ void VclOutdevTest::testVirtualDevice() aVDev.DrawPixel(Point(1,2),COL_GREEN); aVDev.DrawPixel(Point(31,30),COL_RED); - CPPUNIT_ASSERT(aVDev.GetPixel(Point(0,0)) == COL_WHITE); - CPPUNIT_ASSERT(aVDev.GetPixel(Point(1,2)) == COL_GREEN); - CPPUNIT_ASSERT(aVDev.GetPixel(Point(31,30)) == COL_RED); - CPPUNIT_ASSERT(aVDev.GetPixel(Point(30,31)) == COL_WHITE); - Size aSize = aVDev.GetOutputSizePixel(); CPPUNIT_ASSERT(aSize == Size(32,32)); Bitmap aBmp = aVDev.GetBitmap(Point(),aSize); - Bitmap::ScopedReadAccess pAcc(aBmp); + +#if 0 + OUString rFileName("/tmp/foo-unx.png"); + try { + vcl::PNGWriter aWriter( aBmp ); + SvFileStream sOutput( rFileName, STREAM_WRITE ); + aWriter.Write( sOutput ); + sOutput.Close(); + } catch (...) { + SAL_WARN("vcl", "Error writing png to " << rFileName); + } +#endif + + CPPUNIT_ASSERT(aVDev.GetPixel(Point(0,0)) == COL_WHITE); + CPPUNIT_ASSERT(aVDev.GetPixel(Point(1,2)) == COL_GREEN); + CPPUNIT_ASSERT(aVDev.GetPixel(Point(31,30)) == COL_RED); + CPPUNIT_ASSERT(aVDev.GetPixel(Point(30,31)) == COL_WHITE); // Gotcha: y and x swap for BitmapReadAccess: deep joy. + Bitmap::ScopedReadAccess pAcc(aBmp); CPPUNIT_ASSERT(pAcc->GetPixel(0,0) == Color(COL_WHITE)); CPPUNIT_ASSERT(pAcc->GetPixel(2,1) == Color(COL_GREEN)); CPPUNIT_ASSERT(pAcc->GetPixel(30,31) == Color(COL_RED)); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index a70de2d..eac8f45 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -15,6 +15,7 @@ #include <com/sun/star/ucb/UniversalContentBroker.hpp> #include <vcl/vclmain.hxx> +#include <vcl/layout.hxx> #include <tools/urlobj.hxx> #include <tools/stream.hxx> @@ -1107,17 +1108,68 @@ public: } }; +class DemoWidgets : public WorkWindow +{ + VclBox *mpBox; +public: + DemoWidgets() : + WorkWindow(NULL, WB_STDWORK) + { + SetText("VCL widget demo"); + + mpBox = new VclVBox(this, false, 3); + + Wallpaper aWallpaper(BitmapEx("sfx2/res/startcenter-logo.png")); + aWallpaper.SetStyle(WALLPAPER_BOTTOMRIGHT); + aWallpaper.SetColor(COL_RED); + + mpBox->SetBackground(aWallpaper); + mpBox->Show(); + + Show(); + } + virtual ~DemoWidgets() + { + } + virtual void Paint(const Rectangle&) + { + Rectangle aWholeSize(Point(0, 0),GetOutputSizePixel()); + vcl::Region aClip(aWholeSize); + Rectangle aExclude(Rectangle(Point(50,50),Size(100,100))); + aClip.Exclude(aExclude); + + Wallpaper aWallpaper(COL_GREEN); + + Push(PushFlags::CLIPREGION); + IntersectClipRegion(aClip); + DrawWallpaper(aWholeSize, aWallpaper); + Pop(); + + VirtualDevice aDev(*this); + aDev.EnableRTL(IsRTLEnabled()); + aDev.SetOutputSizePixel(aExclude.GetSize()); + + Rectangle aSubRect(aWholeSize); + aSubRect.Move(-aExclude.Left(), -aExclude.Top()); + aDev.DrawWallpaper(aSubRect, aWallpaper ); + + DrawOutDev(aExclude.TopLeft(), aExclude.GetSize(), + Point( 0, 0 ), aExclude.GetSize(), aDev ); + } +}; class DemoApp : public Application { int showHelp(DemoRenderer &rRenderer) { - fprintf(stderr,"vcldemo - a VCL test app\n"); - fprintf(stderr," --help - print this text\n"); - fprintf(stderr," --show <renderer> - start with a given renderer, options are:\n"); + fprintf(stderr, "vcldemo - a VCL test app\n"); + fprintf(stderr, " --help - print this text\n"); + fprintf(stderr, " --show <renderer> - start with a given renderer, options are:\n"); OUString aRenderers(rRenderer.getRendererList()); - fprintf(stderr," %s\n\n", + fprintf(stderr, " %s\n", rtl::OUStringToOString(aRenderers, RTL_TEXTENCODING_UTF8).getStr()); + fprintf(stderr, " --widgets - launch the widget test.\n"); + fprintf(stderr, "\n"); return 0; } @@ -1128,6 +1180,7 @@ public: { try { + bool bWidgets = false; DemoRenderer aRenderer; for (sal_Int32 i = 0; i < GetCommandLineParamCount(); i++) @@ -1143,12 +1196,19 @@ public: else aRenderer.selectRenderer(GetCommandLineParam(++i)); } + else if (aArg == "--widgets") + bWidgets = true; } DemoWin aMainWin(aRenderer); + boost::scoped_ptr<DemoWidgets> aWidgets; aMainWin.SetText("Interactive VCL demo #1"); - aMainWin.Show(); + + if (bWidgets) + aWidgets.reset(new DemoWidgets()); + else + aMainWin.Show(); Application::Execute(); } commit 6ed4bcb327e3e2fe11ba9e2fe23d6cb2e9e9d9a2 Author: Michael Meeks <michael.me...@collabora.com> Date: Mon Dec 1 12:27:31 2014 +0000 vcl: Windows build fix - squash me into re-init ... Change-Id: Ieef945c9694b227376362b032feb3603a6921f41 diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 07d9ce8..2b00464 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -218,7 +218,7 @@ bool WinSalVirtualDevice::SetSize( long nDX, long nDY ) if (mpGraphics) { WinOpenGLSalGraphicsImpl *pImpl; - pImpl = dynamic_cast< WinOpenGLSalGraphicsImpl * >(mpGraphics->getImpl()); + pImpl = dynamic_cast< WinOpenGLSalGraphicsImpl * >(mpGraphics->GetImpl()); if (pImpl) pImpl->Init(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits