canvas/source/directx/dx_textlayout_drawhelper.cxx             |   28 
 canvas/source/vcl/backbuffer.cxx                               |    2 
 canvas/source/vcl/bitmapbackbuffer.cxx                         |    2 
 chart2/source/view/main/3DChartObjects.cxx                     |    3 
 chart2/source/view/main/DummyXShape.cxx                        |    3 
 cppcanvas/source/mtfrenderer/transparencygroupaction.cxx       |    2 
 desktop/CppunitTest_desktop_lib.mk                             |    1 
 desktop/qa/desktop_lib/test_desktop_lib.cxx                    |    6 
 desktop/source/lib/init.cxx                                    |   27 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx   |    3 
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx      |   19 
 external/cairo/UnpackedTarball_cairo.mk                        |    1 
 external/cairo/cairo/cairo.GL_RGBA.patch                       |   41 
 filter/source/graphicfilter/eps/eps.cxx                        |    2 
 filter/source/msfilter/msdffimp.cxx                            |    2 
 include/LibreOfficeKit/LibreOfficeKitEnums.h                   |    2 
 include/vcl/salgtype.hxx                                       |    9 
 include/vcl/virdev.hxx                                         |   47 
 libreofficekit/source/gtk/lokdocview.cxx                       |   22 
 libreofficekit/source/gtk/tilebuffer.cxx                       |    9 
 libreofficekit/source/gtk/tilebuffer.hxx                       |   17 
 sc/source/core/data/documen8.cxx                               |    4 
 sd/source/ui/presenter/PresenterTextView.cxx                   |    5 
 sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx |    2 
 svl/source/numbers/zformat.cxx                                 |    5 
 svtools/source/table/gridtablerenderer.cxx                     |    3 
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx        |    4 
 svx/source/dialog/dialcontrol.cxx                              |    2 
 sw/source/core/doc/DocumentDeviceManager.cxx                   |    4 
 sw/source/uibase/uno/unotxdoc.cxx                              |    4 
 vcl/Library_vcl.mk                                             |    6 
 vcl/Library_vclplug_gtk3.mk                                    |    1 
 vcl/generic/glyphs/gcach_ftyp.cxx                              |  272 -----
 vcl/generic/glyphs/gcach_rbmp.cxx                              |  251 -----
 vcl/headless/svpbmp.cxx                                        |    2 
 vcl/headless/svpcairotextrender.cxx                            |   43 
 vcl/headless/svpcairotextrender.hxx                            |   34 
 vcl/headless/svpgdi.cxx                                        |   43 
 vcl/headless/svpglyphcache.cxx                                 |   71 +
 vcl/headless/svpinst.cxx                                       |   46 
 vcl/headless/svptext.cxx                                       |   14 
 vcl/headless/svptextrender.cxx                                 |  500 
----------
 vcl/headless/svpvd.cxx                                         |   11 
 vcl/inc/cairotextrender.hxx                                    |    4 
 vcl/inc/generic/glyphcache.hxx                                 |   29 
 vcl/inc/headless/svpbmp.hxx                                    |    2 
 vcl/inc/headless/svpgdi.hxx                                    |   12 
 vcl/inc/headless/svpinst.hxx                                   |   15 
 vcl/inc/headless/svptextrender.hxx                             |   85 -
 vcl/inc/headless/svpvd.hxx                                     |    4 
 vcl/inc/opengl/x11/salvd.hxx                                   |    2 
 vcl/inc/osx/salinst.h                                          |    2 
 vcl/inc/quartz/salvd.h                                         |    2 
 vcl/inc/salinst.hxx                                            |    3 
 vcl/inc/unx/gtk/gtkinst.hxx                                    |    2 
 vcl/inc/unx/salinst.h                                          |    4 
 vcl/inc/unx/salvd.h                                            |    2 
 vcl/inc/win/salinst.h                                          |    2 
 vcl/opengl/x11/salvd.cxx                                       |   17 
 vcl/qa/cppunit/lifecycle.cxx                                   |    2 
 vcl/quartz/salvd.cxx                                           |   27 
 vcl/source/gdi/bitmapex.cxx                                    |    3 
 vcl/source/gdi/gdimtf.cxx                                      |    2 
 vcl/source/gdi/pdfwriter_impl.cxx                              |    2 
 vcl/source/gdi/virdev.cxx                                      |   64 -
 vcl/source/outdev/text.cxx                                     |    6 
 vcl/source/outdev/transparent.cxx                              |    2 
 vcl/source/window/paint.cxx                                    |    4 
 vcl/unx/generic/gdi/cairo_xlib_cairo.cxx                       |   23 
 vcl/unx/generic/gdi/cairo_xlib_cairo.hxx                       |    4 
 vcl/unx/generic/gdi/cairotextrender.cxx                        |    2 
 vcl/unx/generic/gdi/salvd.cxx                                  |   25 
 vcl/unx/gtk/gtkinst.cxx                                        |    6 
 vcl/unx/gtk/gtksalframe.cxx                                    |    4 
 vcl/unx/gtk3/cairo_gtk3_cairo.cxx                              |    2 
 vcl/unx/gtk3/gtk3cairotextrender.cxx                           |   43 
 vcl/unx/gtk3/gtk3cairotextrender.hxx                           |   34 
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx                      |    3 
 vcl/win/source/gdi/salvd.cxx                                   |   13 
 vcl/workben/vcldemo.cxx                                        |    2 
 80 files changed, 536 insertions(+), 1499 deletions(-)

New commits:
commit 96ff6372e15fa17211650ec6f0da13771a572a42
Author: Laurent Balland-Poirier <laurent.balland-poir...@laposte.net>
Date:   Thu Nov 19 22:49:59 2015 +0100

    tdf#95677 Force sign to exponent for Excel export
    
    Change-Id: I7896d1d064cd92fd45a6b32ac64f534f68213169
    Reviewed-on: https://gerrit.libreoffice.org/20064
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 479b28a..690e045 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4861,6 +4861,11 @@ OUString SvNumberformat::GetMappedFormatstring( const 
NfKeywordTable& rKeywords,
                     case NF_SYMBOLTYPE_THSEP :
                         aStr.append( rLocWrp.getNumThousandSep() );
                         break;
+                    case NF_SYMBOLTYPE_EXP :
+                        // tdf#95677: Excel does not support exponent without 
sign
+                        aStr.append( rKeywords[NF_KEY_E] );
+                        aStr.append( "+" );
+                        break;
                     case NF_SYMBOLTYPE_DATESEP :
                         aStr.append( rLocWrp.getDateSep() );
                         break;
commit d058765ff3c4f3aaa84c3f9bec774aed8a8b32a3
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Nov 23 11:04:26 2015 +0000

    updae getTileMode
    
    Change-Id: Ic8d67f08d40f475020c0534570fe3bea07aa431b

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 69ff1c3..0a1844a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -963,7 +963,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
 
 static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/)
 {
-    return LOK_TILEMODE_RGBA;
+    return LOK_TILEMODE_BGRA;
 }
 
 static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index b713f0e..a0f5e88 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -36,7 +36,7 @@ LibreOfficeKitPartMode;
 typedef enum
 {
     LOK_TILEMODE_RGBA,
-    LOK_TILEMODE_ARGB
+    LOK_TILEMODE_BGRA
 }
 LibreOfficeKitTileMode;
 
commit 3dc8907dd32281192c47030d16c5628eccc23564
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Nov 19 12:07:27 2015 +0000

    we always have cairo and top down devices now
    
    Change-Id: I0eb3083bf402e86f95206e619e5da2e76aa627a8

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 1fd0820..1a625fc 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -184,14 +184,7 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long 
nWidth, long nHeight,
     }
 
     cairo_t* cr = getCairoContext();
-    if (!cr)
-        return bRet;
-
-    if (!m_aDevice->isTopDown())
-    {
-        cairo_scale(cr, 1, -1.0);
-        cairo_translate(cr, 0.0, -m_aDevice->getSize().getY());
-    }
+    assert(cr && m_aDevice->isTopDown());
 
     clipRegion(cr);
 
@@ -739,14 +732,7 @@ bool SvpSalGraphics::drawPolyPolygon(const 
basegfx::B2DPolyPolygon& rPolyPoly, d
     }
 
     cairo_t* cr = getCairoContext();
-    if (!cr)
-        return false;
-
-    if (!m_aDevice->isTopDown())
-    {
-        cairo_scale(cr, 1, -1.0);
-        cairo_translate(cr, 0.0, -m_aDevice->getSize().getY());
-    }
+    assert(cr && m_aDevice->isTopDown());
 
     clipRegion(cr);
 
commit b639fe60eab2a221e23dc9d509f9281857d656a3
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Nov 19 11:51:47 2015 +0000

    VirtualDevices either match another device depth, or are 1 bit
    
    cairo can therefore always render to a svp virtual device with
    need for a fallback
    
    Change-Id: I5d03ae541820389e26f7448444444be009fb28a4

diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx 
b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index 574a969..c530aaa 100644
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -84,7 +84,7 @@ namespace dxcanvas
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(hdc);
-        ScopedVclPtrInstance<VirtualDevice> 
xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR);
+        ScopedVclPtrInstance<VirtualDevice> 
xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
 
         // disable font antialiasing - GDI does not handle alpha
         // surfaces properly.
@@ -240,7 +240,7 @@ namespace dxcanvas
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( NULL ));
-        ScopedVclPtrInstance<VirtualDevice> 
xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR);
+        ScopedVclPtrInstance<VirtualDevice> 
xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::DEFAULT);
 
         // create the font
         const css::rendering::FontRequest& rFontRequest = 
rCanvasFont->getFontRequest();
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index 39a1b67..143f7a2 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -27,7 +27,7 @@ namespace vclcanvas
     BackBuffer::BackBuffer( const OutputDevice& rRefDevice,
                             bool                bMonochromeBuffer ) :
         maVDev( VclPtr<VirtualDevice>::Create( rRefDevice,
-                                   bMonochromeBuffer ? DeviceFormat::BITMASK : 
DeviceFormat::FULLCOLOR ) )
+                                   bMonochromeBuffer ? DeviceFormat::BITMASK : 
DeviceFormat::DEFAULT ) )
     {
         if( !bMonochromeBuffer )
         {
diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx 
b/canvas/source/vcl/bitmapbackbuffer.cxx
index 1fb22b0..c746b18 100644
--- a/canvas/source/vcl/bitmapbackbuffer.cxx
+++ b/canvas/source/vcl/bitmapbackbuffer.cxx
@@ -112,7 +112,7 @@ namespace vclcanvas
             // VDev not yet created, do it now. Create an alpha-VDev,
             // if bitmap has transparency.
             mpVDev = maBitmap->IsTransparent() ?
-                VclPtr<VirtualDevice>::Create( mrRefDevice, 
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR ) :
+                VclPtr<VirtualDevice>::Create( mrRefDevice, 
DeviceFormat::DEFAULT, DeviceFormat::DEFAULT ) :
                 VclPtr<VirtualDevice>::Create( mrRefDevice );
 
             OSL_ENSURE( mpVDev,
diff --git a/chart2/source/view/main/3DChartObjects.cxx 
b/chart2/source/view/main/3DChartObjects.cxx
index 9a72479..e8bb046 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -77,7 +77,7 @@ const TextCacheItem& TextCache::getText(OUString const & 
rText, bool bIs3dText)
         return *itr->second;
 
     ScopedVclPtrInstance< VirtualDevice > 
pDevice(*Application::GetDefaultDevice(),
-                                                  DeviceFormat::FULLCOLOR, 
DeviceFormat::FULLCOLOR);
+                                                  DeviceFormat::DEFAULT, 
DeviceFormat::DEFAULT);
     vcl::Font aFont;
     if(bIs3dText)
         aFont = vcl::Font("Brillante St",Size(0,0));
diff --git a/chart2/source/view/main/DummyXShape.cxx 
b/chart2/source/view/main/DummyXShape.cxx
index add14b3..a6f9ed1 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -836,7 +836,7 @@ DummyText::DummyText(const OUString& rText, const 
tNameSequence& rNames,
         vcl::Font aFont;
         std::for_each(maProperties.begin(), maProperties.end(), 
FontAttribSetter(aFont));
         ScopedVclPtrInstance< VirtualDevice > 
pDevice(*Application::GetDefaultDevice(),
-                                                      DeviceFormat::FULLCOLOR, 
DeviceFormat::FULLCOLOR);
+                                                      DeviceFormat::DEFAULT, 
DeviceFormat::DEFAULT);
         pDevice->Erase();
         Rectangle aRect;
         pDevice->SetFont(aFont);
diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx 
b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
index 7962877..9d75134a 100644
--- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
+++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
@@ -241,7 +241,7 @@ namespace cppcanvas
                     // render our content into an appropriately sized
                     // VirtualDevice with alpha channel
                     ScopedVclPtrInstance<VirtualDevice> aVDev(
-                        *::Application::GetDefaultDevice(), 
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR );
+                        *::Application::GetDefaultDevice(), 
DeviceFormat::DEFAULT, DeviceFormat::DEFAULT );
                     aVDev->SetOutputSizePixel( aBitmapSizePixel );
                     aVDev->SetMapMode();
 
diff --git a/desktop/CppunitTest_desktop_lib.mk 
b/desktop/CppunitTest_desktop_lib.mk
index bbedfdc..2119e15 100644
--- a/desktop/CppunitTest_desktop_lib.mk
+++ b/desktop/CppunitTest_desktop_lib.mk
@@ -16,6 +16,7 @@ $(eval $(call 
gb_CppunitTest_add_exception_objects,desktop_lib, \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
+       basebmp \
        comphelper \
        cppu \
        cppuhelper \
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 0874eed..07607dd 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -14,7 +14,7 @@
 #include <com/sun/star/awt/Key.hpp>
 #include <com/sun/star/awt/XReschedule.hpp>
 #include <com/sun/star/awt/Toolkit.hpp>
-
+#include <basebmp/bitmapdevice.hxx>
 #include <boost/property_tree/json_parser.hpp>
 #include <comphelper/processfactory.hxx>
 #include <sfx2/objsh.hxx>
@@ -316,7 +316,9 @@ void DesktopLOKTest::testPaintTile()
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     int nCanvasWidth = 100;
     int nCanvasHeight = 300;
-    std::vector<unsigned char> aBuffer(nCanvasWidth * nCanvasHeight * 4);
+    sal_Int32 nStride = 
basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX,
+                                                               nCanvasWidth);
+    std::vector<unsigned char> aBuffer(nStride * nCanvasHeight);
     int nTilePosX = 0;
     int nTilePosY = 0;
     int nTileWidth = 1000;
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 68eb01d..69ff1c3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -882,12 +882,12 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
     SystemGraphicsData aData;
     aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer);
     // the Size argument is irrelevant, I hope
-    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), 
DeviceFormat::FULLCOLOR);
+    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), 
DeviceFormat::DEFAULT);
 
     pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
                     nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #elif defined(ANDROID)
-    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::FULLCOLOR) ;
+    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT) ;
 
     boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >());
 
@@ -900,20 +900,19 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
     pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
                     nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #else
-    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::FULLCOLOR) ;
+    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT) ;
 
     // Set background to transparent by default.
-    memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4);
     pDevice->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
 
     boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() 
);
 
     // Allocate a separate buffer for the alpha device.
-    std::vector<sal_uInt8> aAlpha(nCanvasWidth * nCanvasHeight);
-    memset(aAlpha.data(), 0, nCanvasWidth * nCanvasHeight);
-// TO_DO: enable alpha
-//    boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), 
NoDelete<sal_uInt8>());
-    boost::shared_array<sal_uInt8> aAlphaBuffer;
+    sal_Int32 nStride = 
basebmp::getBitmapDeviceStrideForWidth(basebmp::Format::ThirtyTwoBitTcMaskBGRX,
+                                                               nCanvasWidth);
+    std::vector<sal_uInt8> aAlpha(nCanvasHeight * nStride);
+
+    boost::shared_array<sal_uInt8> aAlphaBuffer(aAlpha.data(), 
NoDelete<sal_uInt8>());
 
     pDevice->SetOutputSizePixelScaleOffsetAndBuffer(
                 Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(),
@@ -927,11 +926,15 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
     {
         for (int nCol = 0; nCol < nCanvasWidth; ++nCol)
         {
-            const int nOffset = (nCanvasWidth * nRow) + nCol;
+            const int nOffset = (nRow * nStride) + nCol * 4;
             // VCL's transparent is 0, RGBA's transparent is 0xff.
-            pBuffer[nOffset * 4 +3] = 0xff - aAlpha[nOffset];
+            pBuffer[nOffset + 3] = 0xff - aAlpha[nOffset];
+            double fAlpha = pBuffer[nOffset + 3]/255.0;
+            for (int i = 0; i < 3; ++i)
+                pBuffer[nOffset + i] *= fAlpha;
         }
     }
+
 #endif
 
     static bool bDebug = getenv("LOK_DEBUG") != nullptr;
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 2d1d498..e7ff5a1 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -162,7 +162,7 @@ namespace
         // no success yet, create new buffer
         if(!pRetval)
         {
-            pRetval = VclPtr<VirtualDevice>::Create(rOutDev, bMonoChrome ? 
DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR);
+            pRetval = VclPtr<VirtualDevice>::Create(rOutDev, bMonoChrome ? 
DeviceFormat::BITMASK : DeviceFormat::DEFAULT);
             pRetval->SetOutputSizePixel(rSizePixel, bClear);
         }
         else
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index 59654f6..a43a19d 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -22,7 +22,14 @@
 
 #include <sal/types.h>
 
-enum class DeviceFormat { NONE = -1, FULLCOLOR = 0, BITMASK = 1, GRAYSCALE = 8 
};
+enum class DeviceFormat {
+                            NONE = -1,
+                            DEFAULT = 0,
+                            BITMASK = 1,
+#ifdef IOS
+                            GRAYSCALE = 8
+#endif
+                        };
 
 typedef sal_uInt32 SalColor;
 #define MAKE_SALCOLOR( r, g, b )    
((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16))
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 76076ba..cd6db85 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -74,38 +74,39 @@ public:
     /** Create a virtual device of size 1x1
 
         @param nBitCount
-        Bit depth of the generated virtual device. Use 0 here, to
-        indicate: take default screen depth. Only 0, 1 and 8
-        are allowed here, with 1 denoting binary mask and 8 a graylevel mask.
+        Device format of the generated virtual device. Use 
DeviceFormat::DEFAULT here, to
+        indicate: take default screen depth. Only DeviceFormat::BITMASK
+        is the other possibility to denote a binary mask.
      */
-    explicit            VirtualDevice(DeviceFormat eFormat = 
DeviceFormat::FULLCOLOR);
+    explicit            VirtualDevice(DeviceFormat eFormat = 
DeviceFormat::DEFAULT);
 
     /** Create a virtual device of size 1x1
 
         @param rCompDev
         The generated vdev will be compatible to this device.
 
-        @param nBitCount
-        Bit depth of the generated virtual device. Use 0 here, to
-        indicate: take default screen depth.
+        @param eFormat
+        Device format of the generated virtual device. Use 
DeviceFormat::DEFAULT here, to
+        indicate: take default screen depth. Only DeviceFormat::BITMASK
+        is the other possibility to denote a binary mask.
      */
      explicit           VirtualDevice(const OutputDevice& rCompDev,
-                                      DeviceFormat eFormat = 
DeviceFormat::FULLCOLOR);
+                                      DeviceFormat eFormat = 
DeviceFormat::DEFAULT);
 
     /** Create a virtual device  of size 1x1 with alpha channel
 
         @param rCompDev
         The generated vdev will be compatible to this device.
 
-        @param nBitCount
-        Bit depth of the generated virtual device. Use 0 here, to
-        indicate: take default screen depth. Only 0 and 1
-        are allowed here, with 1 denoting binary mask.
-
-        @param nAlphaBitCount
-        Bit depth of the generated virtual device. Use 0 here, to
-        indicate: take default screen depth. Only 0 and 1
-        are allowed here, with 1 denoting binary mask.
+        @param eFormat
+        Device format of the generated virtual device. Use 
DeviceFormat::DEFAULT here, to
+        indicate: take default screen depth. Only DeviceFormat::BITMASK
+        is the other possibility to denote a binary mask.
+
+        @param eAlphaFormat
+        Device format of the generated virtual device. Use 
DeviceFormat::DEFAULT here, to
+        indicate: take default screen depth. Only DeviceFormat::BITMASK
+        is the other possibility to denote a binary mask.
      */
      explicit           VirtualDevice( const OutputDevice& rCompDev,
                                        DeviceFormat eFormat, DeviceFormat 
eAlphaFormat);
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx 
b/sd/source/ui/presenter/PresenterTextView.cxx
index db281d6..02f0b31 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -242,7 +242,7 @@ PresenterTextView::Implementation::Implementation()
       msTotalHeightPropertyName("TotalHeight"),
       mxBitmap(),
       mpCanvas(),
-      
mpOutputDevice(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR)),
+      
mpOutputDevice(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 
DeviceFormat::DEFAULT, DeviceFormat::DEFAULT)),
       mpEditEngine(nullptr),
       mpEditEngineItemPool(EditEngine::CreatePool()),
       maSize(100,100),
@@ -455,7 +455,7 @@ Reference<rendering::XBitmap> 
PresenterTextView::Implementation::GetBitmap()
     {
         mpOutputDevice.disposeAndClear();
         mpOutputDevice = 
VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(),
-                                                       
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR);
+                                                       DeviceFormat::DEFAULT, 
DeviceFormat::DEFAULT);
         mpOutputDevice->SetMapMode(MAP_PIXEL);
         mpOutputDevice->SetOutputSizePixel(maSize);
         mpOutputDevice->SetLineColor();
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx 
b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 84590d8..fdef07a 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -135,7 +135,7 @@ void InsertionIndicatorOverlay::Create (
     // Create virtual devices for bitmap and mask whose bitmaps later be
     // combined to form the BitmapEx of the icon.
     ScopedVclPtrInstance<VirtualDevice> pContent(
-        *mrSlideSorter.GetContentWindow(), DeviceFormat::FULLCOLOR, 
DeviceFormat::FULLCOLOR);
+        *mrSlideSorter.GetContentWindow(), DeviceFormat::DEFAULT, 
DeviceFormat::DEFAULT);
     pContent->SetOutputSizePixel(aIconSize);
 
     pContent->SetFillColor();
diff --git a/svtools/source/table/gridtablerenderer.cxx 
b/svtools/source/table/gridtablerenderer.cxx
index bae4ee3..3c935ab 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -84,8 +84,8 @@ namespace svt { namespace table
 
             Point const aBitmapPos( 0, 0 );
             Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight 
);
-            ScopedVclPtrInstance< VirtualDevice > aDevice(i_device, 
DeviceFormat::FULLCOLOR,
-                                                          
DeviceFormat::FULLCOLOR);
+            ScopedVclPtrInstance< VirtualDevice > aDevice(i_device, 
DeviceFormat::DEFAULT,
+                                                          
DeviceFormat::DEFAULT);
             aDevice->SetOutputSizePixel( aBitmapSize );
 
             DecorationView aDecoView(aDevice.get());
diff --git a/svx/source/dialog/dialcontrol.cxx 
b/svx/source/dialog/dialcontrol.cxx
index c93c0ac..77f62b1 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -35,7 +35,7 @@ namespace svx {
 const long DIAL_OUTER_WIDTH = 8;
 
 DialControlBmp::DialControlBmp(vcl::Window& rParent) :
-    VirtualDevice(rParent, DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR),
+    VirtualDevice(rParent, DeviceFormat::DEFAULT, DeviceFormat::DEFAULT),
     mbEnabled(true),
     mrParent(rParent),
     mnCenterX(0),
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 738be4b..a8ddf71 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3426,7 +3426,7 @@ void SAL_CALL SwXTextDocument::paintTile( const 
::css::uno::Any& Parent, ::sal_I
     sal_Int64 nWindowHandle;
     Parent >>= nWindowHandle;
     aData.hWnd = (HWND) nWindowHandle;
-    ScopedVclPtrInstance<VirtualDevice> xDevice(&aData, Size(1, 1), 
DeviceFormat::FULLCOLOR);
+    ScopedVclPtrInstance<VirtualDevice> xDevice(&aData, Size(1, 1), 
DeviceFormat::DEFAULT);
     paintTile(*xDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, 
nTileWidth, nTileHeight);
     #else
     // TODO: support other platforms
diff --git a/vcl/headless/svpcairotextrender.cxx 
b/vcl/headless/svpcairotextrender.cxx
index 06abf0c..681d65d 100644
--- a/vcl/headless/svpcairotextrender.cxx
+++ b/vcl/headless/svpcairotextrender.cxx
@@ -22,13 +22,7 @@ GlyphCache& SvpCairoTextRender::getPlatformGlyphCache()
 
 cairo_t* SvpCairoTextRender::getCairoContext()
 {
-    cairo_t* pRet = mrParent.getCairoContext();
-    if (!pRet)
-    {
-        mxTmpSurface = mrParent.createSimpleMask();
-        pRet = SvpSalGraphics::createCairoContext(mxTmpSurface);
-    }
-    return pRet;
+    return mrParent.getCairoContext();
 }
 
 void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
@@ -42,22 +36,8 @@ void SvpCairoTextRender::clipRegion(cairo_t* cr)
     mrParent.clipRegion(cr);
 }
 
-basebmp::BitmapDeviceSharedPtr SvpCairoTextRender::createSimpleMask()
-{
-    return mrParent.createSimpleMask();
-}
-
 void SvpCairoTextRender::drawSurface(cairo_t*)
 {
-    //typically we have drawn directly to the real surface, in edge-cases of
-    //strange surface depths, we'll have drawn into a tmp surface, so flush
-    //it
-    if (mxTmpSurface)
-    {
-        // blend text color into target using the glyph's mask
-        mrParent.BlendTextColor(basebmp::Color(GetTextColor()), mxTmpSurface, 
basegfx::B2IPoint(0, 0));
-        mxTmpSurface.reset();
-    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpcairotextrender.hxx 
b/vcl/headless/svpcairotextrender.hxx
index daae42c..1a0a1ec 100644
--- a/vcl/headless/svpcairotextrender.hxx
+++ b/vcl/headless/svpcairotextrender.hxx
@@ -17,7 +17,6 @@ class SvpSalGraphics;
 class SvpCairoTextRender : public CairoTextRender
 {
 protected:
-    basebmp::BitmapDeviceSharedPtr mxTmpSurface;
     SvpSalGraphics& mrParent;
 
 public:
@@ -28,7 +27,6 @@ public:
     virtual void getSurfaceOffset(double& nDX, double& nDY) override;
     virtual void clipRegion(cairo_t* cr) override;
     virtual void drawSurface(cairo_t* cr) override;
-    virtual basebmp::BitmapDeviceSharedPtr createSimpleMask() override;
 };
 
 #endif
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 05e673c..1fd0820 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -122,12 +122,6 @@ namespace
 
 #endif
 
-basebmp::BitmapDeviceSharedPtr SvpSalGraphics::createSimpleMask() const
-{
-    return basebmp::createBitmapDevice(m_aOrigDevice->getSize(), true, 
basebmp::Format::OneBitLsbGrey,
-                cairo_format_stride_for_width(CAIRO_FORMAT_A1, 
m_aOrigDevice->getSize().getX()));
-}
-
 void SvpSalGraphics::clipRegion(cairo_t* cr)
 {
     RectangleVector aRectangles;
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index fe381fb..ec7039a 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -446,12 +446,9 @@ Format 
SvpSalInstance::getBaseBmpFormatForDeviceFormat(DeviceFormat eFormat)
     {
         case DeviceFormat::BITMASK:
             return Format::OneBitMsbPal;
-        case DeviceFormat::GRAYSCALE:
-            return Format::EightBitPal;
         default:
             return SVP_CAIRO_FORMAT;
     }
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 9eb39f26..cb6720c 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -133,18 +133,4 @@ SystemFontData SvpSalGraphics::GetSysFontData( int 
nFallbacklevel ) const
 
 #endif // ENABLE_CAIRO_CANVAS
 
-void SvpSalGraphics::BlendTextColor(const basebmp::Color &rTextColor, const 
basebmp::BitmapDeviceSharedPtr &rAlphaMask,
-                                    const basegfx::B2IPoint &rDstPoint)
-{
-    // blend text color into target using the glyph's mask
-    const basegfx::B2IBox aSrcRect(basegfx::B2ITuple(0,0), 
rAlphaMask->getSize());
-    const basegfx::B2IBox aClipRect(rDstPoint, rAlphaMask->getSize());
-
-    SvpSalGraphics::ClipUndoHandle aUndo(this);
-    if (isClippedSetup(aClipRect, aUndo))
-        return;
-
-    m_aDevice->drawMaskedColor(rTextColor, rAlphaMask, aSrcRect, rDstPoint, 
m_aClipMap);
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index 1ff7d94..60b1b8f 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -81,10 +81,6 @@ protected:
     virtual cairo_t*            getCairoContext() = 0;
     virtual void                getSurfaceOffset(double& nDX, double& nDY) = 0;
     virtual void                drawSurface(cairo_t* cr) = 0;
-    virtual basebmp::BitmapDeviceSharedPtr createSimpleMask()
-    {
-        return basebmp::BitmapDeviceSharedPtr();
-    }
 
     bool                        setFont( const FontSelectPattern *pEntry, int 
nFallbackLevel );
 
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 5320909..686301d 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -64,9 +64,6 @@ class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics
 
 public:
     static GlyphCache& getPlatformGlyphCache();
-    void BlendTextColor(const basebmp::Color &rTextColor, const 
basebmp::BitmapDeviceSharedPtr &rAlphaMask,
-                        const basegfx::B2IPoint &rDstPoint);
-    basebmp::BitmapDeviceSharedPtr createSimpleMask() const;
     void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice);
 
 private:
diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx
index 627661a..d6b8eaf 100644
--- a/vcl/opengl/x11/salvd.cxx
+++ b/vcl/opengl/x11/salvd.cxx
@@ -44,16 +44,12 @@ X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( 
SalGraphics* pGraphics,
 {
     assert(mpGraphics);
 
-    // TODO Do we really need the requested bit count?
     sal_uInt16 nBitCount;
     switch (eFormat)
     {
         case DeviceFormat::BITMASK:
             nBitCount = 1;
             break;
-        case DeviceFormat::GRAYSCALE:
-            nBitCount = 8;
-            break;
         default:
             nBitCount = pGraphics->GetBitCount();
             break;
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index b7717fa..c09dd44 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -115,9 +115,11 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( 
AquaSalGraphics* pGraphic, long &nDX
             case DeviceFormat::BITMASK:
                 mnBitmapDepth = 1;
                 break;
+#ifdef IOS
             case DeviceFormat::GRAYSCALE:
                 mnBitmapDepth = 8;
                 break;
+#endif
             default:
                 mnBitmapDepth = 0;
                 break;
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index a75afd6..f390855 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -698,7 +698,7 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, 
const long aStandardSize
     Rectangle aRect(aEmptyPoint, aStdSize );
 
     ScopedVclPtrInstance< VirtualDevice > 
aVirDevice(*Application::GetDefaultDevice(),
-                                                     DeviceFormat::FULLCOLOR, 
DeviceFormat::BITMASK);
+                                                     DeviceFormat::DEFAULT, 
DeviceFormat::BITMASK);
     aVirDevice->SetOutputSizePixel( aStdSize );
     aVirDevice->SetFillColor( COL_TRANSPARENT );
     aVirDevice->SetLineColor( COL_TRANSPARENT );
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index b7be53b..21d1f11 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -886,7 +886,7 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile&         
rMtf,
                                      const Gradient&      rGrad     )
 {
     // Generate comment, GradientEx and Gradient actions (within DrawGradient)
-    ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, 
DeviceFormat::FULLCOLOR);
+    ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, 
DeviceFormat::DEFAULT);
     aVDev->EnableOutput( false );
     GDIMetaFile aGradMtf;
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index a454704..13906b4 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2222,7 +2222,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice()
 {
     if( ! m_pReferenceDevice )
     {
-        VclPtrInstance<VirtualDevice> pVDev(DeviceFormat::FULLCOLOR);
+        VclPtrInstance<VirtualDevice> pVDev(DeviceFormat::DEFAULT);
 
         m_pReferenceDevice = pVDev;
 
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 4557dc2..cab8fa3 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -165,8 +165,6 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* 
pOutDev,
     {
         case DeviceFormat::BITMASK:
             mnBitCount = 1;
-        case DeviceFormat::GRAYSCALE:
-            mnBitCount = 8;
         default:
             mnBitCount = pOutDev->GetBitCount();
             break;
@@ -453,7 +451,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(
     const basebmp::RawMemorySharedArray &pBuffer, const 
basebmp::RawMemorySharedArray &pAlphaBuffer )
 {
     if (pAlphaBuffer)
-        meAlphaFormat = DeviceFormat::GRAYSCALE;
+        meAlphaFormat = DeviceFormat::DEFAULT;
 
     if (pBuffer) {
         MapMode mm = GetMapMode();
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index d2b452c..6402639 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1437,8 +1437,8 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 
     // paint metafile to VDev
     VclPtrInstance<VirtualDevice> pMaskedDevice(*i_pTargetOutDev,
-                                                DeviceFormat::FULLCOLOR,
-                                                DeviceFormat::FULLCOLOR);
+                                                DeviceFormat::DEFAULT,
+                                                DeviceFormat::DEFAULT);
     pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
     pMaskedDevice->EnableRTL( IsRTLEnabled() );
     aMtf.WindStart();
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx 
b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index a45faa4..11d4e6c 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -301,9 +301,8 @@ namespace cairo
      **/
     int X11Surface::getDepth() const
     {
-        if( maSysData.pRenderFormat )
+        if (maSysData.pRenderFormat)
             return 
static_cast<XRenderPictFormat*>(maSysData.pRenderFormat)->depth;
-
         return -1;
     }
 
@@ -315,15 +314,13 @@ namespace cairo
     DeviceFormat X11Surface::getFormat() const
     {
         if (!maSysData.pRenderFormat)
-            return DeviceFormat::FULLCOLOR;
+            return DeviceFormat::DEFAULT;
         switch 
(static_cast<XRenderPictFormat*>(maSysData.pRenderFormat)->depth)
         {
             case 1:
                 return DeviceFormat::BITMASK;
-            case 8:
-                return DeviceFormat::GRAYSCALE;
             default:
-                return DeviceFormat::FULLCOLOR;
+                return DeviceFormat::DEFAULT;
         }
     }
 }
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index d86677b..97b1d3b 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -104,9 +104,6 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* 
pGraphics, long &nDX, long
         case DeviceFormat::BITMASK:
             nBitCount = 1;
             break;
-        case DeviceFormat::GRAYSCALE:
-            nBitCount = 8;
-            break;
         default:
             nBitCount = pGraphics->GetBitCount();
             break;
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 09ce9a0..39c3453 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -406,7 +406,7 @@ void GtkSalFrame::doKeyCallback( guint state,
     if (keyval == GDK_0)
     {
         fprintf( stderr, "force widget_queue_draw\n");
-        gtk_widget_queue_draw (m_pFixedContainer);
+        gtk_widget_queue_draw(GTK_WIDGET(m_pFixedContainer));
         return;
     }
     else if (keyval == GDK_1)
diff --git a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx 
b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
index 25e5a0c..4f6c793 100644
--- a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
+++ b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
@@ -109,7 +109,7 @@ namespace cairo
 
     VclPtr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
     {
-        return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), 
DeviceFormat::FULLCOLOR);
+        return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT);
     }
 
 }
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index 9b2136c..2cfef6f 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -79,9 +79,6 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( 
SalGraphics* pSGraphics,
         case DeviceFormat::BITMASK:
             nBitCount = 1;
             break;
-        case DeviceFormat::GRAYSCALE:
-            nBitCount = 8;
-            break;
         default:
             nBitCount = 0;
             break;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 7e398ed..768e725 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -789,7 +789,7 @@ public:
             if ((int)eType < RENDER_AS_BITMAPEX)
                 pNested = VclPtr<VirtualDevice>::Create(rDev).get();
             else
-                pNested = 
VclPtr<VirtualDevice>::Create(rDev,DeviceFormat::FULLCOLOR,DeviceFormat::FULLCOLOR).get();
+                pNested = 
VclPtr<VirtualDevice>::Create(rDev,DeviceFormat::DEFAULT,DeviceFormat::DEFAULT).get();
 
             pNested->SetOutputSizePixel(r.GetSize());
             Rectangle aWhole(Point(0,0), r.GetSize());
commit c43a3a58677b467274ce6c21d7db1a6c0cc65cb4
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Nov 17 13:03:23 2015 +0000

    establish that Virtual Devices either match Physical Device depth or ...
    
    are 1 or (rarely) 8 bit and lock that down.
    
    Change-Id: I3d946ebef34ffb71c5adea7aa420af50e9584e05

diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx 
b/canvas/source/directx/dx_textlayout_drawhelper.cxx
index 3db3996..574a969 100644
--- a/canvas/source/directx/dx_textlayout_drawhelper.cxx
+++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx
@@ -84,12 +84,12 @@ namespace dxcanvas
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(hdc);
-        VirtualDevice aVirtualDevice(&aSystemGraphicsData, Size(1, 1), 0);
+        ScopedVclPtrInstance<VirtualDevice> 
xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR);
 
         // disable font antialiasing - GDI does not handle alpha
         // surfaces properly.
         if( bAlphaSurface )
-            aVirtualDevice.SetAntialiasing(AntialiasingFlags::DisableText);
+            xVirtualDevice->SetAntialiasing(AntialiasingFlags::DisableText);
 
         if(rText.Length)
         {
@@ -105,7 +105,7 @@ namespace dxcanvas
                     rRenderState.DeviceColor,
                     mxGraphicDevice->getDeviceColorSpace());
             aColor.SetTransparency(0);
-            aVirtualDevice.SetTextColor(aColor);
+            xVirtualDevice->SetTextColor(aColor);
 
             // create the font
             const css::rendering::FontRequest& rFontRequest = 
rCanvasFont->getFontRequest();
@@ -132,7 +132,7 @@ namespace dxcanvas
             // adjust to stretched font
             if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
             {
-                const Size aSize = aVirtualDevice.GetFontMetric( aFont 
).GetSize();
+                const Size aSize = xVirtualDevice->GetFontMetric( aFont 
).GetSize();
                 const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
                 double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
 
@@ -145,7 +145,7 @@ namespace dxcanvas
             }
 
             // set font
-            aVirtualDevice.SetFont(aFont);
+            xVirtualDevice->SetFont(aFont);
 
             // create world transformation matrix
             ::basegfx::B2DHomMatrix aWorldTransform;
@@ -170,7 +170,7 @@ namespace dxcanvas
 
                 aClipPoly.transform(aMatrix);
                 const vcl::Region& rClipRegion = 
vcl::Region(::tools::PolyPolygon(aClipPoly));
-                aVirtualDevice.IntersectClipRegion(rClipRegion);
+                xVirtualDevice->IntersectClipRegion(rClipRegion);
             }
 
             if(rRenderState.Clip.is())
@@ -178,7 +178,7 @@ namespace dxcanvas
                 ::basegfx::B2DPolyPolygon 
aClipPoly(dxcanvas::tools::polyPolygonFromXPolyPolygon2D(rRenderState.Clip));
                 aClipPoly.transform(aWorldTransform);
                 const vcl::Region& rClipRegion = 
vcl::Region(::tools::PolyPolygon(aClipPoly));
-                aVirtualDevice.IntersectClipRegion(rClipRegion);
+                xVirtualDevice->IntersectClipRegion(rClipRegion);
             }
 
             // set world transform
@@ -210,7 +210,7 @@ namespace dxcanvas
                     pDXArray[i] = basegfx::fround( rLogicalAdvancements[i] );
 
                 // draw the String
-                aVirtualDevice.DrawTextArray( aEmptyPoint,
+                xVirtualDevice->DrawTextArray( aEmptyPoint,
                                               aText,
                                               pDXArray.get(),
                                               rText.StartPosition,
@@ -219,7 +219,7 @@ namespace dxcanvas
             else
             {
                 // draw the String
-                aVirtualDevice.DrawText( aEmptyPoint,
+                xVirtualDevice->DrawText( aEmptyPoint,
                                          aText,
                                          rText.StartPosition,
                                          rText.Length );
@@ -240,7 +240,7 @@ namespace dxcanvas
         SystemGraphicsData aSystemGraphicsData;
         aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
         aSystemGraphicsData.hDC = reinterpret_cast< ::HDC >(GetDC( NULL ));
-        VirtualDevice aVirtualDevice(&aSystemGraphicsData, Size(1, 1), 0);
+        ScopedVclPtrInstance<VirtualDevice> 
xVirtualDevice(&aSystemGraphicsData, Size(1, 1), DeviceFormat::FULLCOLOR);
 
         // create the font
         const css::rendering::FontRequest& rFontRequest = 
rCanvasFont->getFontRequest();
@@ -261,7 +261,7 @@ namespace dxcanvas
         // adjust to stretched font
         if(!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11))
         {
-            const Size aSize = aVirtualDevice.GetFontMetric( aFont ).GetSize();
+            const Size aSize = xVirtualDevice->GetFontMetric( aFont 
).GetSize();
             const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 );
             double fStretch = (rFontMatrix.m00 + rFontMatrix.m01);
 
@@ -274,11 +274,11 @@ namespace dxcanvas
         }
 
         // set font
-        aVirtualDevice.SetFont(aFont);
+        xVirtualDevice->SetFont(aFont);
 
         // need metrics for Y offset, the XCanvas always renders
         // relative to baseline
-        const ::FontMetric& aMetric( aVirtualDevice.GetFontMetric() );
+        const ::FontMetric& aMetric( xVirtualDevice->GetFontMetric() );
 
         const sal_Int32 nAboveBaseline( -aMetric.GetIntLeading() - 
aMetric.GetAscent() );
         const sal_Int32 nBelowBaseline( aMetric.GetDescent() );
@@ -292,7 +292,7 @@ namespace dxcanvas
         else
         {
             return geometry::RealRectangle2D( 0, nAboveBaseline,
-                                              aVirtualDevice.GetTextWidth(
+                                              xVirtualDevice->GetTextWidth(
                                                   rText.Text,
                                                   
::canvas::tools::numeric_cast<sal_uInt16>(rText.StartPosition),
                                                   
::canvas::tools::numeric_cast<sal_uInt16>(rText.Length) ),
diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx
index 64ddc44..39a1b67 100644
--- a/canvas/source/vcl/backbuffer.cxx
+++ b/canvas/source/vcl/backbuffer.cxx
@@ -27,7 +27,7 @@ namespace vclcanvas
     BackBuffer::BackBuffer( const OutputDevice& rRefDevice,
                             bool                bMonochromeBuffer ) :
         maVDev( VclPtr<VirtualDevice>::Create( rRefDevice,
-                                   sal_uInt16(bMonochromeBuffer) ) )
+                                   bMonochromeBuffer ? DeviceFormat::BITMASK : 
DeviceFormat::FULLCOLOR ) )
     {
         if( !bMonochromeBuffer )
         {
diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx 
b/canvas/source/vcl/bitmapbackbuffer.cxx
index 3f7fdd0..1fb22b0 100644
--- a/canvas/source/vcl/bitmapbackbuffer.cxx
+++ b/canvas/source/vcl/bitmapbackbuffer.cxx
@@ -112,7 +112,7 @@ namespace vclcanvas
             // VDev not yet created, do it now. Create an alpha-VDev,
             // if bitmap has transparency.
             mpVDev = maBitmap->IsTransparent() ?
-                VclPtr<VirtualDevice>::Create( mrRefDevice, 0, 0 ) :
+                VclPtr<VirtualDevice>::Create( mrRefDevice, 
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR ) :
                 VclPtr<VirtualDevice>::Create( mrRefDevice );
 
             OSL_ENSURE( mpVDev,
diff --git a/chart2/source/view/main/3DChartObjects.cxx 
b/chart2/source/view/main/3DChartObjects.cxx
index 1b8cc7b..9a72479 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -76,7 +76,8 @@ const TextCacheItem& TextCache::getText(OUString const & 
rText, bool bIs3dText)
     if(itr != maTextCache.end())
         return *itr->second;
 
-    ScopedVclPtrInstance< VirtualDevice > 
pDevice(*Application::GetDefaultDevice(), 0, 0);
+    ScopedVclPtrInstance< VirtualDevice > 
pDevice(*Application::GetDefaultDevice(),
+                                                  DeviceFormat::FULLCOLOR, 
DeviceFormat::FULLCOLOR);
     vcl::Font aFont;
     if(bIs3dText)
         aFont = vcl::Font("Brillante St",Size(0,0));
diff --git a/chart2/source/view/main/DummyXShape.cxx 
b/chart2/source/view/main/DummyXShape.cxx
index ae242c2..add14b3 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -835,7 +835,8 @@ DummyText::DummyText(const OUString& rText, const 
tNameSequence& rNames,
     {
         vcl::Font aFont;
         std::for_each(maProperties.begin(), maProperties.end(), 
FontAttribSetter(aFont));
-        ScopedVclPtrInstance< VirtualDevice > 
pDevice(*Application::GetDefaultDevice(), 0, 0);
+        ScopedVclPtrInstance< VirtualDevice > 
pDevice(*Application::GetDefaultDevice(),
+                                                      DeviceFormat::FULLCOLOR, 
DeviceFormat::FULLCOLOR);
         pDevice->Erase();
         Rectangle aRect;
         pDevice->SetFont(aFont);
diff --git a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx 
b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
index 11885b0..7962877 100644
--- a/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
+++ b/cppcanvas/source/mtfrenderer/transparencygroupaction.cxx
@@ -241,7 +241,7 @@ namespace cppcanvas
                     // render our content into an appropriately sized
                     // VirtualDevice with alpha channel
                     ScopedVclPtrInstance<VirtualDevice> aVDev(
-                        *::Application::GetDefaultDevice(), 0, 0 );
+                        *::Application::GetDefaultDevice(), 
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR );
                     aVDev->SetOutputSizePixel( aBitmapSizePixel );
                     aVDev->SetMapMode();
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 211371e..68eb01d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -882,12 +882,12 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
     SystemGraphicsData aData;
     aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer);
     // the Size argument is irrelevant, I hope
-    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), 
(sal_uInt16)0);
+    ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), 
DeviceFormat::FULLCOLOR);
 
     pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
                     nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #elif defined(ANDROID)
-    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
(sal_uInt16)0) ;
+    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::FULLCOLOR) ;
 
     boost::shared_array<sal_uInt8> aBuffer(pBuffer, NoDelete< sal_uInt8 >());
 
@@ -900,7 +900,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
     pDoc->paintTile(*pDevice.get(), nCanvasWidth, nCanvasHeight,
                     nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 #else
-    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
(sal_uInt16)0) ;
+    ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::FULLCOLOR) ;
 
     // Set background to transparent by default.
     memset(pBuffer, 0, nCanvasWidth * nCanvasHeight * 4);
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 21bd6c6..be7ff65 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -96,7 +96,8 @@ namespace
         if(maAnimation.Count())
         {
             ScopedVclPtrInstance< VirtualDevice > 
aVirtualDevice(*Application::GetDefaultDevice());
-            ScopedVclPtrInstance< VirtualDevice > 
aVirtualDeviceMask(*Application::GetDefaultDevice(), 1L);
+            ScopedVclPtrInstance< VirtualDevice > 
aVirtualDeviceMask(*Application::GetDefaultDevice(),
+                                                                     
DeviceFormat::BITMASK);
 
             // Prepare VirtualDevices and their states
             aVirtualDevice->EnableMapMode(false);
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 06b7b5b..2d1d498 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -47,7 +47,7 @@ namespace
         VDevBuffer();
         virtual ~VDevBuffer();
 
-        VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, 
bool bClear, sal_Int32 nBits);
+        VirtualDevice* alloc(OutputDevice& rOutDev, const Size& rSizePixel, 
bool bClear, bool bMonoChrome);
         void free(VirtualDevice& rDevice);
 
         // Timer virtuals
@@ -80,13 +80,12 @@ namespace
         }
     }
 
-    VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& 
rSizePixel, bool bClear, sal_Int32 nBits)
+    VirtualDevice* VDevBuffer::alloc(OutputDevice& rOutDev, const Size& 
rSizePixel, bool bClear, bool bMonoChrome)
     {
         ::osl::MutexGuard aGuard(m_aMutex);
         VirtualDevice* pRetval = nullptr;
 
-        if (nBits == 0)
-            nBits = rOutDev.GetBitCount();
+        sal_Int32 nBits = bMonoChrome ? 1 : rOutDev.GetBitCount();
 
         if(!maFreeBuffers.empty())
         {
@@ -97,7 +96,7 @@ namespace
             {
                 OSL_ENSURE(*a, "Empty pointer in VDevBuffer (!)");
 
-                if(nBits == (*a)->GetBitCount())
+                if (nBits == (*a)->GetBitCount())
                 {
                     // candidate is valid due to bit depth
                     if(aFound != maFreeBuffers.end())
@@ -163,7 +162,7 @@ namespace
         // no success yet, create new buffer
         if(!pRetval)
         {
-            pRetval = VclPtr<VirtualDevice>::Create(rOutDev, nBits);
+            pRetval = VclPtr<VirtualDevice>::Create(rOutDev, bMonoChrome ? 
DeviceFormat::BITMASK : DeviceFormat::FULLCOLOR);
             pRetval->SetOutputSizePixel(rSizePixel, bClear);
         }
         else
@@ -243,9 +242,9 @@ namespace drawinglayer
             // rendering, especially shadows, is broken on iOS unless
             // we pass 'true' here. Are virtual devices always de
             // facto cleared when created on other platforms?
-            mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
true, 0);
+            mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
true, false);
 #else
-            mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
false, 0);
+            mpContent = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
false, false);
 #endif
 
             // #i93485# assert when copying from window to VDev is used
@@ -361,7 +360,7 @@ namespace drawinglayer
         assert(mpContent && "impBufferDevice: No content, check isVisible() 
before accessing (!)");
         if (!mpMask)
         {
-            mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
true, 1);
+            mpMask = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
true, true);
             mpMask->SetMapMode(mpContent->GetMapMode());
 
             // do NOT copy AA flag for mask!
@@ -375,7 +374,7 @@ namespace drawinglayer
         OSL_ENSURE(mpContent, "impBufferDevice: No content, check isVisible() 
before accessing (!)");
         if(!mpAlpha)
         {
-            mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
true, 0);
+            mpAlpha = getVDevBuffer().alloc(mrOutDev, maDestPixel.GetSize(), 
true, false);
             mpAlpha->SetMapMode(mpContent->GetMapMode());
 
             // copy AA flag for new target; masking needs to be smooth
diff --git a/filter/source/graphicfilter/eps/eps.cxx 
b/filter/source/graphicfilter/eps/eps.cxx
index 3c63a76..8bc304e 100644
--- a/filter/source/graphicfilter/eps/eps.cxx
+++ b/filter/source/graphicfilter/eps/eps.cxx
@@ -2125,7 +2125,7 @@ void PSWriter::ImplText( const OUString& rUniString, 
const Point& rPos, const lo
         vcl::Font    aNotRotatedFont( maFont );
         aNotRotatedFont.SetOrientation( 0 );
 
-        ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+        ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
         pVirDev->SetMapMode( rVDev.GetMapMode() );
         pVirDev->SetFont( aNotRotatedFont );
         pVirDev->SetTextAlign( eTextAlign );
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 235c274..55951e8 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4394,7 +4394,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
                                 rOutliner.SetStyleSheetPool( 
static_cast<SfxStyleSheetPool*>(pModel->GetStyleSheetPool()) );
                             rOutliner.SetUpdateMode( false );
                             rOutliner.SetText( *pParaObj );
-                            ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+                            ScopedVclPtrInstance< VirtualDevice > 
pVirDev(DeviceFormat::BITMASK);
                             pVirDev->SetMapMode( MAP_100TH_MM );
                             sal_Int32 i, nParagraphs = 
rOutliner.GetParagraphCount();
                             if ( nParagraphs )
diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index 8a34009..59654f6 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -22,6 +22,8 @@
 
 #include <sal/types.h>
 
+enum class DeviceFormat { NONE = -1, FULLCOLOR = 0, BITMASK = 1, GRAYSCALE = 8 
};
+
 typedef sal_uInt32 SalColor;
 #define MAKE_SALCOLOR( r, g, b )    
((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16))
 #define SALCOLOR_RED( n )           ((sal_uInt8)((n)>>16))
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 740b9bf..76076ba 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -22,6 +22,7 @@
 
 #include <basebmp/bitmapdevice.hxx>
 #include <vcl/dllapi.h>
+#include <vcl/salgtype.hxx>
 #include <vcl/outdev.hxx>
 
 class SalVirtualDevice;
@@ -39,10 +40,11 @@ private:
     VclPtr<VirtualDevice>  mpNext;
     sal_uInt16          mnBitCount;
     bool                mbScreenComp;
-    sal_Int8            mnAlphaDepth;
+    DeviceFormat        meFormat;
+    DeviceFormat        meAlphaFormat;
     sal_uInt8           meRefDevMode;
 
-    SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, 
long nDY, sal_uInt16 nBitCount, const SystemGraphicsData *pData = nullptr );
+    SAL_DLLPRIVATE void ImplInitVirDev( const OutputDevice* pOutDev, long nDX, 
long nDY, DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr );
     SAL_DLLPRIVATE bool InnerImplSetOutputSizePixel( const Size& rNewSize, 
bool bErase,
                                                      const 
basebmp::RawMemorySharedArray &pBuffer );
     SAL_DLLPRIVATE bool ImplSetOutputSizePixel( const Size& rNewSize, bool 
bErase,
@@ -76,7 +78,7 @@ public:
         indicate: take default screen depth. Only 0, 1 and 8
         are allowed here, with 1 denoting binary mask and 8 a graylevel mask.
      */
-    explicit            VirtualDevice( sal_uInt16 nBitCount = 0 );
+    explicit            VirtualDevice(DeviceFormat eFormat = 
DeviceFormat::FULLCOLOR);
 
     /** Create a virtual device of size 1x1
 
@@ -87,8 +89,8 @@ public:
         Bit depth of the generated virtual device. Use 0 here, to
         indicate: take default screen depth.
      */
-     explicit           VirtualDevice( const OutputDevice& rCompDev,
-                                       sal_uInt16 nBitCount = 0 );
+     explicit           VirtualDevice(const OutputDevice& rCompDev,
+                                      DeviceFormat eFormat = 
DeviceFormat::FULLCOLOR);
 
     /** Create a virtual device  of size 1x1 with alpha channel
 
@@ -106,14 +108,14 @@ public:
         are allowed here, with 1 denoting binary mask.
      */
      explicit           VirtualDevice( const OutputDevice& rCompDev,
-                                       sal_uInt16 nBitCount, sal_uInt16 
nAlphaBitCount );
+                                       DeviceFormat eFormat, DeviceFormat 
eAlphaFormat);
 
     /** Create a virtual device using an existing system dependent device or 
graphics context
         Any rendering will happen directly on the context and not on any 
intermediate bitmap.
         Note: This might not be supported on all platforms !
     */
     explicit            VirtualDevice(const SystemGraphicsData *pData, const 
Size &rSize,
-                                      sal_uInt16 nBitCount);
+                                      DeviceFormat eFormat);
 
     virtual             ~VirtualDevice();
     virtual void        dispose() override;
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index d975c3f..12be826 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -193,9 +193,9 @@ VirtualDevice* ScDocument::GetVirtualDevice_100th_mm()
     if (!pVirtualDevice_100th_mm)
     {
 #ifdef IOS
-        pVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create( 8 );
+        pVirtualDevice_100th_mm = 
VclPtr<VirtualDevice>::Create(DeviceFormat::GRAYSCALE);
 #else
-        pVirtualDevice_100th_mm = VclPtr<VirtualDevice>::Create( 1 );
+        pVirtualDevice_100th_mm = 
VclPtr<VirtualDevice>::Create(DeviceFormat::BITMASK);
 #endif
         
pVirtualDevice_100th_mm->SetReferenceDevice(VirtualDevice::REFDEV_MODE_MSO1);
         MapMode aMapMode( pVirtualDevice_100th_mm->GetMapMode() );
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx 
b/sd/source/ui/presenter/PresenterTextView.cxx
index face96dd..db281d6 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -242,7 +242,7 @@ PresenterTextView::Implementation::Implementation()
       msTotalHeightPropertyName("TotalHeight"),
       mxBitmap(),
       mpCanvas(),
-      
mpOutputDevice(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 
0, 0)),
+      
mpOutputDevice(VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR)),
       mpEditEngine(nullptr),
       mpEditEngineItemPool(EditEngine::CreatePool()),
       maSize(100,100),
@@ -454,7 +454,8 @@ Reference<rendering::XBitmap> 
PresenterTextView::Implementation::GetBitmap()
     if ( ! mxBitmap.is())
     {
         mpOutputDevice.disposeAndClear();
-        mpOutputDevice = 
VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(), 0, 0);
+        mpOutputDevice = 
VclPtr<VirtualDevice>::Create(*Application::GetDefaultDevice(),
+                                                       
DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR);
         mpOutputDevice->SetMapMode(MAP_PIXEL);
         mpOutputDevice->SetOutputSizePixel(maSize);
         mpOutputDevice->SetLineColor();
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx 
b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 7e06c12..84590d8 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -135,7 +135,7 @@ void InsertionIndicatorOverlay::Create (
     // Create virtual devices for bitmap and mask whose bitmaps later be
     // combined to form the BitmapEx of the icon.
     ScopedVclPtrInstance<VirtualDevice> pContent(
-        *mrSlideSorter.GetContentWindow(), 0, 0);
+        *mrSlideSorter.GetContentWindow(), DeviceFormat::FULLCOLOR, 
DeviceFormat::FULLCOLOR);
     pContent->SetOutputSizePixel(aIconSize);
 
     pContent->SetFillColor();
diff --git a/svtools/source/table/gridtablerenderer.cxx 
b/svtools/source/table/gridtablerenderer.cxx
index b3eca3e..bae4ee3 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -84,7 +84,8 @@ namespace svt { namespace table
 
             Point const aBitmapPos( 0, 0 );
             Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight 
);
-            ScopedVclPtrInstance< VirtualDevice > aDevice( i_device, 0, 0 );
+            ScopedVclPtrInstance< VirtualDevice > aDevice(i_device, 
DeviceFormat::FULLCOLOR,
+                                                          
DeviceFormat::FULLCOLOR);
             aDevice->SetOutputSizePixel( aBitmapSize );
 
             DecorationView aDecoView(aDevice.get());
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 9fa46c5..5deea95 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -166,7 +166,7 @@ void CalculateHorizontalScalingFactor( const SdrObject* 
pCustomShape,
     aFont.SetOrientation( 0 );
     // initializing virtual device
 
-    ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+    ScopedVclPtrInstance< VirtualDevice > pVirDev(DeviceFormat::BITMASK);
     pVirDev->SetMapMode( MAP_100TH_MM );
     pVirDev->SetFont( aFont );
 
@@ -260,7 +260,7 @@ void GetTextAreaOutline( const FWData& rFWData, const 
SdrObject* pCustomShape, F
             aFont.SetWeight( rWeightItem.GetWeight() );
 
             // initializing virtual device
-            ScopedVclPtrInstance< VirtualDevice > pVirDev( 1 );
+            ScopedVclPtrInstance< VirtualDevice > 
pVirDev(DeviceFormat::BITMASK);
             pVirDev->SetMapMode( MAP_100TH_MM );
             pVirDev->SetFont( aFont );
             pVirDev->EnableRTL();
diff --git a/svx/source/dialog/dialcontrol.cxx 
b/svx/source/dialog/dialcontrol.cxx
index 18f6a5c..c93c0ac 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -35,7 +35,7 @@ namespace svx {
 const long DIAL_OUTER_WIDTH = 8;
 
 DialControlBmp::DialControlBmp(vcl::Window& rParent) :
-    VirtualDevice(rParent, 0, 0),
+    VirtualDevice(rParent, DeviceFormat::FULLCOLOR, DeviceFormat::FULLCOLOR),
     mbEnabled(true),
     mrParent(rParent),
     mnCenterX(0),
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx 
b/sw/source/core/doc/DocumentDeviceManager.cxx
index 234a0e2..1b47d29 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -261,9 +261,9 @@ DocumentDeviceManager::~DocumentDeviceManager()
 VirtualDevice& DocumentDeviceManager::CreateVirtualDevice_() const
 {
 #ifdef IOS
-    VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create( 8 );
+    VclPtr<VirtualDevice> pNewVir = 
VclPtr<VirtualDevice>::Create(DeviceFormat::GRAYSCALE);
 #else
-    VclPtr<VirtualDevice> pNewVir = VclPtr<VirtualDevice>::Create( 1 );
+    VclPtr<VirtualDevice> pNewVir = 
VclPtr<VirtualDevice>::Create(DeviceFormat::BITMASK);
 #endif
 
     pNewVir->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 4bede99..738be4b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3426,8 +3426,8 @@ void SAL_CALL SwXTextDocument::paintTile( const 
::css::uno::Any& Parent, ::sal_I
     sal_Int64 nWindowHandle;
     Parent >>= nWindowHandle;
     aData.hWnd = (HWND) nWindowHandle;
-    VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)32);
-    paintTile( aDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, 
nTileWidth, nTileHeight );
+    ScopedVclPtrInstance<VirtualDevice> xDevice(&aData, Size(1, 1), 
DeviceFormat::FULLCOLOR);
+    paintTile(*xDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, 
nTileWidth, nTileHeight);
     #else
     // TODO: support other platforms
     (void)Parent;
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 8c0363b..722b4dd 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -45,7 +45,7 @@ bool SvpSalBitmap::Create( const Size& rSize,
 
     SvpSalInstance* pInst = SvpSalInstance::s_pDefaultInstance;
     assert( pInst );
-    basebmp::Format nFormat = pInst->getFormatForBitCount( nBitCount );
+    basebmp::Format nFormat = pInst->getBaseBmpFormatForBitCount( nBitCount );
 
     B2IVector aSize( rSize.Width(), rSize.Height() );
     if( aSize.getX() == 0 )
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index fc24200..fe381fb 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -227,10 +227,10 @@ void SvpSalInstance::DestroyObject( SalObject* pObject )
 
 SalVirtualDevice* SvpSalInstance::CreateVirtualDevice( SalGraphics* /* 
pGraphics */,
                                                        long &nDX, long &nDY,
-                                                       sal_uInt16 nBitCount,
+                                                       DeviceFormat eFormat,
                                                        const 
SystemGraphicsData* /* pData */ )
 {
-    SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice( nBitCount );
+    SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice(eFormat);
     pNew->SetSize( nDX, nDY );
     return pNew;
 }
@@ -416,7 +416,7 @@ void SvpSalTimer::Start( sal_uLong nMS )
     m_pInstance->StartTimer( nMS );
 }
 
-Format SvpSalInstance::getFormatForBitCount( sal_uInt16 nBitCount )
+Format SvpSalInstance::getBaseBmpFormatForBitCount( sal_uInt16 nBitCount )
 {
     switch( nBitCount )
     {
@@ -439,4 +439,19 @@ Format SvpSalInstance::getFormatForBitCount( sal_uInt16 
nBitCount )
      }
 
 }
+
+Format SvpSalInstance::getBaseBmpFormatForDeviceFormat(DeviceFormat eFormat)
+{
+    switch (eFormat)
+    {
+        case DeviceFormat::BITMASK:
+            return Format::OneBitMsbPal;
+        case DeviceFormat::GRAYSCALE:
+            return Format::EightBitPal;
+        default:
+            return SVP_CAIRO_FORMAT;
+    }
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svpvd.cxx b/vcl/headless/svpvd.cxx
index f861ac7..3cc8b5f 100644
--- a/vcl/headless/svpvd.cxx
+++ b/vcl/headless/svpvd.cxx
@@ -67,10 +67,10 @@ bool SvpSalVirtualDevice::SetSizeUsingBuffer( long nNewDX, 
long nNewDY,
     {
         SvpSalInstance* pInst = SvpSalInstance::s_pDefaultInstance;
         assert( pInst );
-        basebmp::Format nFormat = pInst->getFormatForBitCount( m_nBitCount );
+        basebmp::Format nFormat = 
pInst->getBaseBmpFormatForDeviceFormat(m_eFormat);
         sal_Int32 nStride = basebmp::getBitmapDeviceStrideForWidth(nFormat, 
aDevSize.getX());
 
-        if ( m_nBitCount == 1 )
+        if (m_eFormat == DeviceFormat::BITMASK)
         {
             std::vector< basebmp::Color > aDevPal(2);
             aDevPal[0] = basebmp::Color( 0, 0, 0 );
diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx
index 5d926f5..cf30aae 100644
--- a/vcl/inc/headless/svpinst.hxx
+++ b/vcl/inc/headless/svpinst.hxx
@@ -125,7 +125,7 @@ public:
     // pData allows for using a system dependent graphics or device context
     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics* pGraphics,
                                                      long &nDX, long &nDY,
-                                                     sal_uInt16 nBitCount, 
const SystemGraphicsData *pData = nullptr ) override;
+                                                     DeviceFormat eFormat, 
const SystemGraphicsData *pData = nullptr ) override;
 
     // Printer
     // pSetupData->mpDriverData can be 0
@@ -167,7 +167,8 @@ public:
 
     virtual GenPspGraphics *CreatePrintGraphics() override;
 
-    ::basebmp::Format getFormatForBitCount( sal_uInt16 );
+    ::basebmp::Format getBaseBmpFormatForBitCount(sal_uInt16);
+    ::basebmp::Format getBaseBmpFormatForDeviceFormat(DeviceFormat);
 };
 
 #endif // INCLUDED_VCL_INC_HEADLESS_SVPINST_HXX
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index bfa055f..4241d38 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -28,12 +28,12 @@ class SvpSalGraphics;
 
 class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
 {
-    sal_uInt16                          m_nBitCount;
+    DeviceFormat                        m_eFormat;
     basebmp::BitmapDeviceSharedPtr      m_aDevice;
     std::list< SvpSalGraphics* >        m_aGraphics;
 
 public:
-    SvpSalVirtualDevice( sal_uInt16 nBitCount ) : m_nBitCount(nBitCount) {}
+    SvpSalVirtualDevice(DeviceFormat eFormat) : m_eFormat(eFormat) {}
     virtual ~SvpSalVirtualDevice();
 
     // SalVirtualDevice
diff --git a/vcl/inc/opengl/x11/salvd.hxx b/vcl/inc/opengl/x11/salvd.hxx
index 0ab611e..4993194 100644
--- a/vcl/inc/opengl/x11/salvd.hxx
+++ b/vcl/inc/opengl/x11/salvd.hxx
@@ -33,7 +33,7 @@ class X11OpenGLSalVirtualDevice : public SalVirtualDevice
 public:
     X11OpenGLSalVirtualDevice( SalGraphics *pGraphics,
                                long &nDX, long &nDY,
-                               sal_uInt16 nBitCount,
+                               DeviceFormat eFormat,
                                const SystemGraphicsData *pData,
                                X11SalGraphics* pNewGraphics);
     virtual ~X11OpenGLSalVirtualDevice();
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index 2e909ee..151da02 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -88,7 +88,7 @@ public:
     virtual void            DestroyObject( SalObject* pObject ) override;
     virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
                                                    long &nDX, long &nDY,
-                                                   sal_uInt16 nBitCount,
+                                                   DeviceFormat eFormat,
                                                    const SystemGraphicsData 
*pData ) override;
     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
                                                ImplJobSetup* pSetupData ) 
override;
diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h
index 7159d16..4dec371 100644
--- a/vcl/inc/quartz/salvd.h
+++ b/vcl/inc/quartz/salvd.h
@@ -53,7 +53,7 @@ private:
     void Destroy();
 
 public:
-    AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY, 
sal_uInt16 nBitCount, const SystemGraphicsData *pData );
+    AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX, long &nDY, 
DeviceFormat eFormat, const SystemGraphicsData *pData );
     virtual ~AquaSalVirtualDevice();
 
     virtual SalGraphics*            AcquireGraphics() override;
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index a5f8806..6ed84b9 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -28,6 +28,7 @@
 #include "tools/solar.h"
 #include "displayconnectiondispatch.hxx"
 #include "vcl/dllapi.h"
+#include "vcl/salgtype.hxx"
 #include <sal/types.h>
 
 #include "rtl/ref.hxx"
@@ -90,7 +91,7 @@ public:
     virtual SalVirtualDevice*
                             CreateVirtualDevice( SalGraphics* pGraphics,
                                                  long &rDX, long &rDY,
-                                                 sal_uInt16 nBitCount, const 
SystemGraphicsData *pData = nullptr ) = 0;
+                                                 DeviceFormat eFormat, const 
SystemGraphicsData *pData = nullptr ) = 0;
 
     // Printer
     // pSetupData->mpDriverData can be 0
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index ca469a2..3dd8f0d 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -76,7 +76,7 @@ public:
     virtual void                AddToRecentDocumentList(const OUString& 
rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override;
     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics*,
                                                      long &nDX, long &nDY,
-                                                     sal_uInt16 nBitCount,
+                                                     DeviceFormat eFormat,
                                                      const SystemGraphicsData* 
) override;
     virtual SalBitmap*          CreateSalBitmap() override;
 
diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h
index e736faa..5ccb9a1 100644
--- a/vcl/inc/unx/salinst.h
+++ b/vcl/inc/unx/salinst.h
@@ -57,11 +57,11 @@ public:
 
     /// Gtk vclplug needs to pass GtkSalGraphics to X11SalVirtualDevice, so 
create it, and pass as pNewGraphics.
     virtual SalVirtualDevice* CreateX11VirtualDevice(SalGraphics* pGraphics, 
long &nDX, long &nDY,
-            sal_uInt16 nBitCount, const SystemGraphicsData* pData, 
X11SalGraphics* pNewGraphics);
+            DeviceFormat eFormat, const SystemGraphicsData* pData, 
X11SalGraphics* pNewGraphics);
 
     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics* pGraphics,
                                                      long &nDX, long &nDY,
-                                                     sal_uInt16 nBitCount, 
const SystemGraphicsData *pData = NULL ) override;
+                                                     DeviceFormat eFormat, 
const SystemGraphicsData *pData = NULL ) override;
     virtual void                PostPrintersChanged() override;
     virtual GenPspGraphics     *CreatePrintGraphics() override;
 
diff --git a/vcl/inc/unx/salvd.h b/vcl/inc/unx/salvd.h
index fbe173f..ca83c84 100644
--- a/vcl/inc/unx/salvd.h
+++ b/vcl/inc/unx/salvd.h
@@ -45,7 +45,7 @@ class X11SalVirtualDevice : public SalVirtualDevice
 
 public:
     X11SalVirtualDevice(SalGraphics *pGraphics, long &nDX, long &nDY,
-            sal_uInt16 nBitCount, const SystemGraphicsData *pData, 
X11SalGraphics* pNewGraphics);
+            DeviceFormat eFormat, const SystemGraphicsData *pData, 
X11SalGraphics* pNewGraphics);
 
     virtual ~X11SalVirtualDevice();
 
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index 4c1bc7f..c50aaa5 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -53,7 +53,7 @@ public:
     virtual void            DestroyObject( SalObject* pObject ) override;
     virtual SalVirtualDevice*   CreateVirtualDevice( SalGraphics* pGraphics,
                                                      long &nDX, long &nDY,
-                                                     sal_uInt16 nBitCount, 
const SystemGraphicsData *pData ) override;
+                                                     DeviceFormat eFormat, 
const SystemGraphicsData *pData ) override;
     virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
                                                ImplJobSetup* pSetupData ) 
override;
     virtual void            DestroyInfoPrinter( SalInfoPrinter* pPrinter ) 
override;
diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx
index 9c8c20e..627661a 100644
--- a/vcl/opengl/x11/salvd.cxx
+++ b/vcl/opengl/x11/salvd.cxx
@@ -35,7 +35,7 @@ void X11SalGraphics::Init( X11OpenGLSalVirtualDevice *pDevice 
)
 
 X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics,
                                                       long &nDX, long &nDY,
-                                                      sal_uInt16 nBitCount,
+                                                      DeviceFormat eFormat,
                                                       const SystemGraphicsData 
*pData,
                                                       X11SalGraphics* 
pNewGraphics) :
     mpGraphics(pNewGraphics),
@@ -43,9 +43,22 @@ X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( 
SalGraphics* pGraphics,
     mnXScreen( 0 )
 {
     assert(mpGraphics);
+
     // TODO Do we really need the requested bit count?
-    if( !nBitCount && pGraphics )
-        nBitCount = pGraphics->GetBitCount();
+    sal_uInt16 nBitCount;
+    switch (eFormat)
+    {
+        case DeviceFormat::BITMASK:
+            nBitCount = 1;
+            break;
+        case DeviceFormat::GRAYSCALE:
+            nBitCount = 8;
+            break;
+        default:
+            nBitCount = pGraphics->GetBitCount();
+            break;
+
+    }
 
     // TODO Check where a VirtualDevice is created from SystemGraphicsData
     assert( pData == nullptr ); (void)pData;
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 748f603..0d6c0c1 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -74,7 +74,7 @@ void LifecycleTest::testVirtualDevice()
     VclPtr<VirtualDevice> pVDev = VclPtr< VirtualDevice >::Create();
     ScopedVclPtrInstance< VirtualDevice > pVDev2;
     VclPtrInstance<VirtualDevice> pVDev3;
-    VclPtrInstance<VirtualDevice> pVDev4( 1 );
+    VclPtrInstance<VirtualDevice> pVDev4(DeviceFormat::BITMASK);
     CPPUNIT_ASSERT(!!pVDev && !!pVDev2 && !!pVDev3 && !!pVDev4);
 }
 
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 485ac20..b7717fa 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -38,7 +38,7 @@
 
 SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( SalGraphics* pGraphics,
                                                         long &nDX, long &nDY,
-                                                        sal_uInt16 nBitCount,
+                                                        DeviceFormat eFormat,
                                                         const 
SystemGraphicsData *pData )
 {
     // #i92075# can be called first in a thread
@@ -48,29 +48,29 @@ SalVirtualDevice* AquaSalInstance::CreateVirtualDevice( 
SalGraphics* pGraphics,
     if( pData )
     {
         return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( 
pGraphics ),
-                                         nDX, nDY, nBitCount, pData );
+                                         nDX, nDY, eFormat, pData );
     }
     else
     {
-        AquaSalVirtualDevice* pNew = new AquaSalVirtualDevice( NULL, nDX, nDY, 
nBitCount, NULL );
+        AquaSalVirtualDevice* pNew = new AquaSalVirtualDevice( NULL, nDX, nDY, 
eFormat, NULL );
         pNew->SetSize( nDX, nDY );
         return pNew;
     }
 #else
     return new AquaSalVirtualDevice( static_cast< AquaSalGraphics* >( 
pGraphics ),
-                                     nDX, nDY, nBitCount, pData );
+                                     nDX, nDY, eFormat, pData );
 #endif
 }
 
 AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long 
&nDX, long &nDY,
-                                            sal_uInt16 nBitCount, const 
SystemGraphicsData *pData )
+                                            DeviceFormat eFormat, const 
SystemGraphicsData *pData )
   : mbGraphicsUsed( false )
   , mxBitmapContext( nullptr )
   , mnBitmapDepth( 0 )
   , mxLayer( nullptr )
 {
     SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::AquaSalVirtualDevice() 
this=" << this
-              << " size=(" << nDX << "x" << nDY << ") bitcount=" << nBitCount 
<<
+              << " size=(" << nDX << "x" << nDY << ") bitcount=" << 
static_cast<int>(eFormat) <<
               " pData=" << pData << " context=" << (pData ? pData->rCGContext 
: nullptr) );
 
     if( pGraphic && pData && pData->rCGContext )
@@ -110,7 +110,18 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( 
AquaSalGraphics* pGraphic, long &nDX
         // create empty new virtual device
         mbForeignContext = false;           // the mxContext is created within 
VCL
         mpGraphics = new AquaSalGraphics(); // never fails
-        mnBitmapDepth = nBitCount;
+        switch (eFormat)
+        {
+            case DeviceFormat::BITMASK:
+                mnBitmapDepth = 1;
+                break;
+            case DeviceFormat::GRAYSCALE:
+                mnBitmapDepth = 8;
+                break;
+            default:
+                mnBitmapDepth = 0;
+                break;
+        }
 #ifdef MACOSX
         // inherit resolution from reference device
         if( pGraphic )
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 906d3eb..a75afd6 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -697,7 +697,8 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, 
const long aStandardSize
     Size aStdSize( aStandardSize, aStandardSize );
     Rectangle aRect(aEmptyPoint, aStdSize );
 
-    ScopedVclPtrInstance< VirtualDevice > aVirDevice( 
*Application::GetDefaultDevice(), 0, 1 );
+    ScopedVclPtrInstance< VirtualDevice > 
aVirDevice(*Application::GetDefaultDevice(),
+                                                     DeviceFormat::FULLCOLOR, 
DeviceFormat::BITMASK);
     aVirDevice->SetOutputSizePixel( aStdSize );
     aVirDevice->SetFillColor( COL_TRANSPARENT );
     aVirDevice->SetLineColor( COL_TRANSPARENT );
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 51fb545..b7be53b 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -886,7 +886,7 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile&         
rMtf,
                                      const Gradient&      rGrad     )
 {
     // Generate comment, GradientEx and Gradient actions (within DrawGradient)
-    ScopedVclPtrInstance< VirtualDevice > aVDev(  rMapDev, 0  );
+    ScopedVclPtrInstance< VirtualDevice > aVDev(rMapDev, 
DeviceFormat::FULLCOLOR);
     aVDev->EnableOutput( false );
     GDIMetaFile aGradMtf;
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 2384ef3..a454704 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2222,7 +2222,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice()
 {
     if( ! m_pReferenceDevice )
     {
-        VclPtrInstance<VirtualDevice> pVDev( 0 );
+        VclPtrInstance<VirtualDevice> pVDev(DeviceFormat::FULLCOLOR);
 
         m_pReferenceDevice = pVDev;
 
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 41a604b..4557dc2 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -125,9 +125,9 @@ void VirtualDevice::ReleaseGraphics( bool bRelease )
 }
 
 void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
-                                    long nDX, long nDY, sal_uInt16 nBitCount, 
const SystemGraphicsData *pData )
+                                    long nDX, long nDY, DeviceFormat eFormat, 
const SystemGraphicsData *pData )
 {
-    SAL_INFO( "vcl.virdev", "ImplInitVirDev(" << nDX << "," << nDY << "," << 
nBitCount << ")" );
+    SAL_INFO( "vcl.virdev", "ImplInitVirDev(" << nDX << "," << nDY << "," << 
static_cast<int>(eFormat) << ")" );
 
     bool bErase = nDX > 0 && nDY > 0;
 
@@ -149,7 +149,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* 
pOutDev,
         (void)pOutDev->AcquireGraphics();
     pGraphics = pOutDev->mpGraphics;
     if ( pGraphics )
-        mpVirDev = pSVData->mpDefInst->CreateVirtualDevice( pGraphics, nDX, 
nDY, nBitCount, pData );
+        mpVirDev = pSVData->mpDefInst->CreateVirtualDevice(pGraphics, nDX, 
nDY, eFormat, pData);
     else
         mpVirDev = nullptr;
     if ( !mpVirDev )
@@ -160,13 +160,23 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* 
pOutDev,
             css::uno::Reference< css::uno::XInterface >() );
     }
 
-    mnBitCount      = ( nBitCount ? nBitCount : pOutDev->GetBitCount() );
+    meFormat        = eFormat;
+    switch (meFormat)
+    {
+        case DeviceFormat::BITMASK:
+            mnBitCount = 1;
+        case DeviceFormat::GRAYSCALE:
+            mnBitCount = 8;
+        default:
+            mnBitCount = pOutDev->GetBitCount();
+            break;
+    }
     mnOutWidth      = nDX;
     mnOutHeight     = nDY;
     mbScreenComp    = true;
-    mnAlphaDepth    = -1;
+    meAlphaFormat   = DeviceFormat::NONE;
 
-    if( mnBitCount < 8 )
+    if (meFormat == DeviceFormat::BITMASK)
         SetAntialiasing( AntialiasingFlags::DisableText );
 
     if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
@@ -206,52 +216,46 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* 
pOutDev,
     pSVData->maGDIData.mpFirstVirDev = this;
 }
 
-VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
+VirtualDevice::VirtualDevice(DeviceFormat eFormat)
 :   mpVirDev( nullptr ),
     meRefDevMode( REFDEV_NONE )
 {
-    SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
-                 "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for 
BitCount, not " << nBitCount );
-    SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" 
);
+    SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << 
static_cast<int>(eFormat) << " )" );
 
-    ImplInitVirDev( Application::GetDefaultDevice(), 0, 0, nBitCount );
+    ImplInitVirDev(Application::GetDefaultDevice(), 0, 0, eFormat);
 }
 
-VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 
nBitCount )
+VirtualDevice::VirtualDevice(const OutputDevice& rCompDev, DeviceFormat 
eFormat)
     : mpVirDev( nullptr ),
     meRefDevMode( REFDEV_NONE )
 {
-    SAL_WARN_IF( nBitCount > 1 && nBitCount != 8 && nBitCount != 
rCompDev.GetBitCount(), "vcl.gdi",
-                 "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for 
BitCount, not " << nBitCount );
-    SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" 
);
+    SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << 
static_cast<int>(eFormat) << " )" );
 
-    ImplInitVirDev( &rCompDev, 0, 0, nBitCount );
+    ImplInitVirDev(&rCompDev, 0, 0, eFormat);
 }
 
-VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 
nBitCount, sal_uInt16 nAlphaBitCount )
-    : mpVirDev( nullptr ),
-    meRefDevMode( REFDEV_NONE )
+VirtualDevice::VirtualDevice(const OutputDevice& rCompDev, DeviceFormat 
eFormat, DeviceFormat eAlphaFormat)
+    : mpVirDev( nullptr )
+    , meRefDevMode( REFDEV_NONE )
 {
-    SAL_WARN_IF( nBitCount > 1 && nBitCount != 8, "vcl.gdi",
-                 "VirtualDevice::VirtualDevice(): Only 0, 1 or 8 allowed for 
BitCount, not " << nBitCount );
     SAL_INFO( "vcl.gdi",
-            "VirtualDevice::VirtualDevice( " << nBitCount << ", " << 
nAlphaBitCount << " )" );
+            "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << 
", " << static_cast<int>(eAlphaFormat) << " )" );
 
-    ImplInitVirDev( &rCompDev, 0, 0, nBitCount );
+    ImplInitVirDev(&rCompDev, 0, 0, eFormat);
 
     // Enable alpha channel
-    mnAlphaDepth = sal::static_int_cast<sal_Int8>(nAlphaBitCount);
+    meAlphaFormat = eAlphaFormat;
 }
 
 VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size 
&rSize,
-                             sal_uInt16 nBitCount)
+                             DeviceFormat eFormat)
 :   mpVirDev( nullptr ),
     meRefDevMode( REFDEV_NONE )
 {
-    SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << nBitCount << " )" 
);
+    SAL_INFO( "vcl.gdi", "VirtualDevice::VirtualDevice( " << 
static_cast<int>(eFormat) << " )" );
 
     ImplInitVirDev(Application::GetDefaultDevice(), rSize.Width(), 
rSize.Height(),
-                   nBitCount, pData);
+                   eFormat, pData);
 }
 
 VirtualDevice::~VirtualDevice()
@@ -337,7 +341,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const 
Size& rNewSize, bool bEra
                 return false;
         }
 
-        pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice( mpGraphics, 
nNewWidth, nNewHeight, mnBitCount );
+        pNewVirDev = pSVData->mpDefInst->CreateVirtualDevice(mpGraphics, 
nNewWidth, nNewHeight, meFormat);
         if ( pNewVirDev )
         {
             SalGraphics* pGraphics = pNewVirDev->AcquireGraphics();
@@ -396,7 +400,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& 
rNewSize, bool bErase,
 {
     if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) )
     {
-        if( mnAlphaDepth != -1 )
+        if (meAlphaFormat != DeviceFormat::NONE)
         {
             // #110958# Setup alpha bitmap
             if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize)
@@ -406,7 +410,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& 
rNewSize, bool bErase,
 
             if( !mpAlphaVDev )
             {
-                mpAlphaVDev = VclPtr<VirtualDevice>::Create( *this, 
mnAlphaDepth );
+                mpAlphaVDev = VclPtr<VirtualDevice>::Create(*this, 
meAlphaFormat);
                 mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase,
                                                          pAlphaBuffer);
             }
@@ -449,7 +453,7 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer(
     const basebmp::RawMemorySharedArray &pBuffer, const 
basebmp::RawMemorySharedArray &pAlphaBuffer )
 {
     if (pAlphaBuffer)
-        mnAlphaDepth = 8;
+        meAlphaFormat = DeviceFormat::GRAYSCALE;
 
     if (pBuffer) {
         MapMode mm = GetMapMode();
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 9a745be..097d21c 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -236,7 +236,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& 
rSalLayout )
 
     // cache virtual device for rotation
     if (!mpOutDevData->mpRotateDev)
-        mpOutDevData->mpRotateDev = VclPtr<VirtualDevice>::Create( *this, 1 );
+        mpOutDevData->mpRotateDev = VclPtr<VirtualDevice>::Create(*this, 
DeviceFormat::BITMASK);
     VirtualDevice* pVDev = mpOutDevData->mpRotateDev;
 
     // size it accordingly
@@ -2508,7 +2508,7 @@ bool OutputDevice::GetTextBoundRect( Rectangle& rRect,
 
     // fall back to bitmap method to get the bounding rectangle,
     // so we need a monochrome virtual device with matching font
-    ScopedVclPtrInstance< VirtualDevice > aVDev(  1  );
+    ScopedVclPtrInstance< VirtualDevice > aVDev(DeviceFormat::BITMASK);
     vcl::Font aFont( GetFont() );
     aFont.SetShadow( false );
     aFont.SetOutline( false );
@@ -2732,7 +2732,7 @@ bool OutputDevice::GetTextOutlines( 
::basegfx::B2DPolyPolygonVector& rVector,
         + mnEmphasisDescent;
     pSalLayout->Release();
 
-    ScopedVclPtrInstance< VirtualDevice > aVDev( 1 );
+    ScopedVclPtrInstance< VirtualDevice > aVDev(DeviceFormat::BITMASK);
 
     vcl::Font aFont(GetFont());
     aFont.SetShadow(false);
diff --git a/vcl/source/outdev/transparent.cxx 
b/vcl/source/outdev/transparent.cxx
index d53303d..4c8a405 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -431,7 +431,7 @@ void OutputDevice::EmulateDrawTransparent ( const 
tools::PolyPolygon& rPolyPoly,
 
         if( !bDrawn )
         {
-            ScopedVclPtrInstance< VirtualDevice > aVDev(  *this, 1  );
+            ScopedVclPtrInstance< VirtualDevice > aVDev(*this, 
DeviceFormat::BITMASK);
             const Size aDstSz( aDstRect.GetSize() );
             const sal_uInt8 cTrans = (sal_uInt8) MinMax( FRound( 
nTransparencePercent * 2.55 ), 0, 255 );
 
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 22f9849..d2b452c 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1436,7 +1436,9 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
     mpWindowImpl->mbReallyVisible = bRVisible;
 
     // paint metafile to VDev
-    VclPtrInstance<VirtualDevice> pMaskedDevice( *i_pTargetOutDev, 0, 0 );
+    VclPtrInstance<VirtualDevice> pMaskedDevice(*i_pTargetOutDev,
+                                                DeviceFormat::FULLCOLOR,
+                                                DeviceFormat::FULLCOLOR);
     pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
     pMaskedDevice->EnableRTL( IsRTLEnabled() );
     aMtf.WindStart();
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx 
b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index 71cba58..a45faa4 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -271,7 +271,7 @@ namespace cairo
         return VclPtr<VirtualDevice>(
             VclPtr<VirtualDevice>::Create(&aSystemGraphicsData,
                               Size(width, height),
-                              std::max(getDepth(), 0)));
+                              getFormat()));
     }
 
     /**
@@ -306,6 +306,26 @@ namespace cairo
 
         return -1;
     }
+
+    /**
+     * Surface::getFormat:  Get the device format of the Canvas surface.
+     *
+     * @return color format
+     **/
+    DeviceFormat X11Surface::getFormat() const
+    {
+        if (!maSysData.pRenderFormat)
+            return DeviceFormat::FULLCOLOR;
+        switch 
(static_cast<XRenderPictFormat*>(maSysData.pRenderFormat)->depth)
+        {
+            case 1:
+                return DeviceFormat::BITMASK;
+            case 8:
+                return DeviceFormat::GRAYSCALE;
+            default:
+                return DeviceFormat::FULLCOLOR;
+        }
+    }
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx 
b/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
index 3193447..0ccf98a 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.hxx
@@ -21,10 +21,9 @@
 #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_XLIB_CAIRO_HXX
 
 #include <sal/config.h>
-
 #include <sal/types.h>
-
 #include <vcl/cairo.hxx>
+#include <vcl/salgtype.hxx>
 
 struct BitmapSystemData;
 struct SystemEnvData;
@@ -92,6 +91,7 @@ namespace cairo {
         virtual void flush() const override;
 
         int getDepth() const;
+        DeviceFormat getFormat() const;
         X11PixmapSharedPtr getPixmap() const { return mpPixmap; }
         void* getRenderFormat() const { return maSysData.pRenderFormat; }
         long getDrawable() const { return mpPixmap ? mpPixmap->mhDrawable : 
maSysData.hDrawable; }
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 8aa87bf..d86677b 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -36,20 +36,20 @@
 #include <opengl/x11/salvd.hxx>
 
 SalVirtualDevice* X11SalInstance::CreateX11VirtualDevice(SalGraphics* 
pGraphics,
-        long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData 
*pData,
+        long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData 
*pData,
         X11SalGraphics* pNewGraphics)
 {
     assert(pNewGraphics);
     if (OpenGLHelper::isVCLOpenGLEnabled())
-        return new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, nBitCount, 
pData, pNewGraphics );
+        return new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, eFormat, 
pData, pNewGraphics );
     else
-        return new X11SalVirtualDevice(pGraphics, nDX, nDY, nBitCount, pData, 
pNewGraphics);
+        return new X11SalVirtualDevice(pGraphics, nDX, nDY, eFormat, pData, 
pNewGraphics);
 }
 
 SalVirtualDevice* X11SalInstance::CreateVirtualDevice(SalGraphics* pGraphics,
-        long &nDX, long &nDY, sal_uInt16 nBitCount, const SystemGraphicsData 
*pData)
+        long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData 
*pData)
 {
-    return CreateX11VirtualDevice(pGraphics, nDX, nDY, nBitCount, pData, new 
X11SalGraphics());
+    return CreateX11VirtualDevice(pGraphics, nDX, nDY, eFormat, pData, new 
X11SalGraphics());
 }
 
 void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* 
pColormap,
@@ -89,7 +89,7 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, 
SalColormap* pColormap,
 }
 
 X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* pGraphics, long &nDX, 
long &nDY,
-                                         sal_uInt16 nBitCount, const 
SystemGraphicsData *pData,
+                                         DeviceFormat eFormat, const 
SystemGraphicsData *pData,
                                          X11SalGraphics* pNewGraphics) :
     pGraphics_(pNewGraphics),
     m_nXScreen(0),
@@ -98,8 +98,20 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics* 
pGraphics, long &nDX, long
     SalColormap* pColormap = nullptr;
     bool bDeleteColormap = false;
 
-    if( !nBitCount && pGraphics )
-        nBitCount = pGraphics->GetBitCount();
+    sal_uInt16 nBitCount;
+    switch (eFormat)
+    {
+        case DeviceFormat::BITMASK:
+            nBitCount = 1;
+            break;
+        case DeviceFormat::GRAYSCALE:
+            nBitCount = 8;
+            break;
+        default:
+            nBitCount = pGraphics->GetBitCount();
+            break;
+
+    }
 
     pDisplay_               = vcl_sal::getSalDisplay(GetGenericData());
     nDepth_                 = nBitCount;
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index 0e7ba5e..ec13855 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -315,19 +315,19 @@ void GtkYieldMutex::ThreadsLeave()
 
 SalVirtualDevice* GtkInstance::CreateVirtualDevice( SalGraphics *pG,
                                                     long &nDX, long &nDY,
-                                                    sal_uInt16 nBitCount,
+                                                    DeviceFormat eFormat,
                                                     const SystemGraphicsData 
*pGd )
 {
     EnsureInit();
 #if GTK_CHECK_VERSION(3,0,0)
     (void)pG; (void) pGd;
-    SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice( nBitCount );
+    SvpSalVirtualDevice* pNew = new SvpSalVirtualDevice(eFormat);
     pNew->SetSize( nDX, nDY );
     return pNew;
 #else
     GtkSalGraphics *pGtkSalGraphics = dynamic_cast<GtkSalGraphics*>(pG);
     assert(pGtkSalGraphics);
-    return CreateX11VirtualDevice(pG, nDX, nDY, nBitCount, pGd,
+    return CreateX11VirtualDevice(pG, nDX, nDY, eFormat, pGd,
             new GtkSalGraphics(pGtkSalGraphics->GetGtkFrame(), 
pGtkSalGraphics->GetGtkWidget()));
 #endif
 }
diff --git a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx 
b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
index ec5e641..25e5a0c 100644
--- a/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
+++ b/vcl/unx/gtk3/cairo_gtk3_cairo.cxx
@@ -109,7 +109,7 @@ namespace cairo
 
     VclPtr<VirtualDevice> Gtk3Surface::createVirtualDevice() const
     {
-        return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), 0);
+        return VclPtrInstance<VirtualDevice>(nullptr, Size(1, 1), 
DeviceFormat::FULLCOLOR);
     }
 
 }
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index 2a492b8..9b2136c 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -68,11 +68,25 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC 
hDC, long nDX, long nDY,
 
 SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
                                                        long &nDX, long &nDY,
-                                                       sal_uInt16 nBitCount,
+                                                       DeviceFormat eFormat,
                                                        const 
SystemGraphicsData* pData )
 {
     WinSalGraphics* pGraphics = static_cast<WinSalGraphics*>(pSGraphics);
 
+    sal_uInt16 nBitCount;
+    switch (eFormat)
+    {
+        case DeviceFormat::BITMASK:
+            nBitCount = 1;
+            break;
+        case DeviceFormat::GRAYSCALE:

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to