[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - vcl/workben

Michael Meeks michael.meeks at collabora.com
Sat Nov 8 13:40:55 PST 2014


 vcl/workben/vcldemo.cxx |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

New commits:
commit b5a6d9109e2a30b344e22a6c97893bb03b71dadb
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Nov 8 21:41:13 2014 +0000

    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::vector<Rectangle> 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::vector<Rectangle> 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


More information about the Libreoffice-commits mailing list