[Libreoffice-commits] core.git: Branch 'feature/nativealpha' - 443 commits - accessibility/source android/source avmedia/source basctl/qa basctl/source basic/source binaryurp/source bin/lo-pack-sources bridges/source canvas/source chart2/inc chart2/qa chart2/source chart2/uiconfig chart2/workbench comphelper/source compilerplugins/clang configure.ac connectivity/source cppuhelper/source cui/qa cui/source cui/uiconfig dbaccess/qa dbaccess/source desktop/inc desktop/qa desktop/scripts desktop/source desktop/uiconfig dictionaries distro-configs/Jenkins download.lst drawinglayer/qa drawinglayer/source dtrans/source editeng/source extensions/source external/graphite extras/source filter/qa filter/source forms/source formula/Module_formula.mk formula/qa formula/source fpicker/Module_fpicker.mk fpicker/qa framework/inc framework/source framework/uiconfig helpcontent2 hwpfilter/source i18npool/inc i18npool/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/galaxy icon-th emes/industrial icon-themes/tango idlc/inc idlc/source idl/inc idl/source include/avmedia include/basic include/canvas include/codemaker include/comphelper include/connectivity include/dbaccess include/drawinglayer include/editeng include/formula include/framework include/jvmaccess include/LibreOfficeKit include/oox include/sfx2 include/sot include/svl include/svtools include/svx include/test include/toolkit include/tools include/ucbhelper include/unoidl include/unotools include/vbahelper include/vcl include/xmloff jurt/Library_jpipe.mk jurt/source jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/Package_selectionhandles.mk linguistic/inc linguistic/source lotuswordpro/source Makefile.in nlpsolver/help offapi/com offapi/UnoApi_offapi.mk officecfg/registry oox/inc oox/source package/inc package/source pyuno/source readlicense_oo/license reportdesign/inc reportdesign/qa reportdesign/source rsc/inc rsc/source sal/osl scaddins/source sc/CppunitTest_sc_bugfix_test.mk sc/Cppuni tTest_sc_filters_test.mk sc/inc sc/qa scripting/source sc/source sc/uiconfig sdext/source sd/inc sd/qa sd/source sd/uiconfig sd/UIConfig_sdraw.mk setup_native/source sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source slideshow/Library_OGLTrans.mk slideshow/source solenv/CompilerTest_compilerplugins_clang.mk solenv/gbuild solenv/Module_solenv.mk solenv/qa sot/qa sot/source starmath/inc starmath/Library_sm.mk starmath/qa starmath/source stoc/source svgio/source svl/qa svl/source svtools/qa svtools/source svx/inc svx/qa svx/sdi svx/source svx/uiconfig sw/inc sw/qa sw/sdi sw/source sw/uiconfig TEMPLATE.SOURCECODE.HEADER test/source toolkit/source ucb/source unotools/source uui/qa uui/source vbahelper/source vcl/backendtest vcl/CppunitTest_vcl_png_test.mk vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Module_vcl.mk vcl/opengl vcl/qa vcl/quartz vcl/source vcl/TODO.nativealpha vcl/unx vcl/win winaccessibility/inc winaccessibility/source wizards/source writerfilter/source writerperfect/CppunitTe st_writerperfect_draw.mk xmloff/inc xmloff/source xmlsecurity/inc xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Nov 16 10:12:41 UTC 2016


Rebased ref, commits from common ancestor:
commit 383ddecb47a29e785dd88c765455696ca72bbe0f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Nov 8 14:45:52 2016 +0100

    backend bitmap test for 32-bit bitmap
    
    Change-Id: I64223910cef1a44d616faa1f0a8982acc4344657

diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx
index ced23d9..fb617f8 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -343,7 +343,7 @@ public:
         Rectangle aRectangle;
         size_t index = 0;
 
-        std::vector<Rectangle> aRegions = setupRegions(2, 2, nWidth, nHeight);
+        std::vector<Rectangle> aRegions = setupRegions(2, 3, nWidth, nHeight);
 
         aRectangle = aRegions[index++];
         {
@@ -363,7 +363,7 @@ public:
         {
             vcl::test::OutputDeviceTestBitmap aOutDevTest;
             Bitmap aBitmap = aOutDevTest.setupDrawBitmapExWithAlpha();
-            assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkBitmapExWithAlpha(aBitmap), aRectangle, rRenderContext);
+            assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkAlphaBitmap(aBitmap), aRectangle, rRenderContext);
             drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
         }
         aRectangle = aRegions[index++];
@@ -373,6 +373,13 @@ public:
             assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkMask(aBitmap), aRectangle, rRenderContext);
             drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
         }
+        aRectangle = aRegions[index++];
+        {
+            vcl::test::OutputDeviceTestBitmap aOutDevTest;
+            Bitmap aBitmap = aOutDevTest.setupDrawNativeBitmapWithAlpha();
+            assertAndSetBackground(vcl::test::OutputDeviceTestBitmap::checkAlphaBitmap(aBitmap), aRectangle, rRenderContext);
+            drawBitmapScaledAndCentered(aRectangle, aBitmap, rRenderContext);
+        }
     }
 
     virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/) override
diff --git a/vcl/backendtest/outputdevice/bitmap.cxx b/vcl/backendtest/outputdevice/bitmap.cxx
index 351dfa2..fc7f022 100644
--- a/vcl/backendtest/outputdevice/bitmap.cxx
+++ b/vcl/backendtest/outputdevice/bitmap.cxx
@@ -111,6 +111,27 @@ Bitmap OutputDeviceTestBitmap::setupDrawMask()
     return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
 }
 
+Bitmap OutputDeviceTestBitmap::setupDrawNativeBitmapWithAlpha()
+{
+    Size aBitmapSize(9, 9);
+    Bitmap aBitmap(aBitmapSize, 32);
+    {
+        Bitmap::ScopedWriteAccess aWriteAccess(aBitmap);
+        aWriteAccess->Erase(COL_TRANSPARENT);
+        aWriteAccess->SetLineColor(Color(0x44, 0xFF, 0xFF, 0x00));
+        aWriteAccess->DrawRect(Rectangle(0, 0, 8, 8));
+        aWriteAccess->DrawRect(Rectangle(3, 3, 5, 5));
+    }
+
+    initialSetup(13, 13, constBackgroundColor);
+
+    Point aPoint(alignToCenter(maVDRectangle, Rectangle(Point(), aBitmapSize)).TopLeft());
+
+    mpVirtualDevice->DrawBitmap(aPoint, aBitmap);
+
+    return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
+}
+
 TestResult OutputDeviceTestBitmap::checkBitmap(Bitmap& rBitmap)
 {
     std::vector<Color> aExpected
@@ -131,7 +152,7 @@ TestResult OutputDeviceTestBitmap::checkTransformedBitmap(Bitmap& rBitmap)
     return checkRectangles(rBitmap, aExpected);
 }
 
-TestResult OutputDeviceTestBitmap::checkBitmapExWithAlpha(Bitmap& rBitmap)
+TestResult OutputDeviceTestBitmap::checkAlphaBitmap(Bitmap& rBitmap)
 {
     const Color aBlendedColor(0xEE, 0xEE, 0x33);
 
diff --git a/vcl/inc/test/outputdevice.hxx b/vcl/inc/test/outputdevice.hxx
index cc90b00..53b17bc 100644
--- a/vcl/inc/test/outputdevice.hxx
+++ b/vcl/inc/test/outputdevice.hxx
@@ -77,11 +77,13 @@ public:
     Bitmap setupDrawBitmap();
     Bitmap setupDrawBitmapExWithAlpha();
     Bitmap setupDrawMask();
+    Bitmap setupDrawNativeBitmapWithAlpha();
 
     static TestResult checkBitmap(Bitmap& rBitmap);
     static TestResult checkTransformedBitmap(Bitmap& rBitmap);
     static TestResult checkBitmapExWithAlpha(Bitmap& rBitmap);
     static TestResult checkMask(Bitmap& rBitmap);
+    static TestResult checkAlphaBitmap(Bitmap& rBitmap);
 };
 
 class VCL_DLLPUBLIC OutputDeviceTestAnotherOutDev : public OutputDeviceTestCommon
commit 1b5a847230ebb96e0936d9a6baa5c3a35148c0d5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Nov 6 23:26:04 2016 +0100

    TODO for native alpha
    
    Change-Id: Iff57d71c296daef7e41055c1a69686a2d4783d30

diff --git a/vcl/TODO.nativealpha b/vcl/TODO.nativealpha
new file mode 100644
index 0000000..76aa880
--- /dev/null
+++ b/vcl/TODO.nativealpha
@@ -0,0 +1,15 @@
+KNOWN GLITCHES
+- Writer - Anchor alpha is not correctly loaded
+- Sidebar - left bar leaves traces
+
+TODO:
+- Check printing, PDF output
+- Metafile
+
+- Windows backend
+- OSX backend
+- X11 backend
+- OpenGL backend
+
+TODO TESTS:
+Erase - check the VirtualDevice is erased to transparent color, input color after
commit a0e083bb012aa4227dd485effdd6061666ad1b42
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jul 24 22:14:27 2016 +0900

    vcl: use same bitdepth when performing super scaling
    
    Change-Id: I379c4aa9aa83470961fa972eec8cdb67261f749c

diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx
index ff01aae..ddb3a85 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -937,7 +937,7 @@ bool BitmapScaleSuper::filter(Bitmap& rBitmap)
 
     Bitmap::ScopedReadAccess pReadAccess(rBitmap);
 
-    Bitmap aOutBmp(Size(nDstW, nDstH), 24);
+    Bitmap aOutBmp(Size(nDstW, nDstH), rBitmap.GetBitCount());
     Bitmap::ScopedWriteAccess pWriteAccess(aOutBmp);
 
     const long nStartY = 0;
commit f83b3a63d8e53f789f341c9969b1f191e09c5667
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Jun 28 16:39:57 2016 +0800

    BitmapProcessor: support 32-bit bitmap in createLightImage
    
    Change-Id: If28c715f9737f34b9d71c1342cae88fcc69231dd

diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 1a89da5..e64fd2a 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -17,7 +17,9 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& rBitmapEx)
     const Size aSize(rBitmapEx.GetSizePixel());
 
     Bitmap aBitmap(rBitmapEx.GetBitmap());
-    Bitmap aDarkBitmap(aSize, 24);
+    int nBitcount = aBitmap.GetBitCount() == 32 ? 32 : 24;
+
+    Bitmap aDarkBitmap(aSize, nBitcount);
 
     BitmapReadAccess* pRead(aBitmap.AcquireReadAccess());
     BitmapWriteAccess* pWrite(aDarkBitmap.AcquireWriteAccess());
commit ee4afce1bd51e78114c44efdeed3f77ff4592e62
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 11:31:07 2016 +0800

    vcl: Test for PngReader - reading of various PNG formats
    
    Change-Id: I2469751806e03c791c1882a32c31c090d7dac39f

diff --git a/vcl/CppunitTest_vcl_png_test.mk b/vcl/CppunitTest_vcl_png_test.mk
new file mode 100644
index 0000000..1f88209
--- /dev/null
+++ b/vcl/CppunitTest_vcl_png_test.mk
@@ -0,0 +1,52 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,vcl_png_test))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_png_test, \
+    vcl/qa/cppunit/png/PngFilterTest \
+))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_png_test,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_png_test, \
+	comphelper \
+	cppu \
+	cppuhelper \
+	sal \
+    svt \
+	test \
+	tl \
+	unotest \
+	vcl \
+	utl \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,vcl_png_test,\
+    udkapi \
+    offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_png_test))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_png_test))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_png_test,\
+    configmgr/source/configmgr \
+    i18npool/util/i18npool \
+    ucb/source/core/ucb1 \
+    unotools/util/utl \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_png_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 97e20f0..3bc4f64 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -109,6 +109,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
 	CppunitTest_vcl_app_test \
 	$(if $(MERGELIBS),,CppunitTest_vcl_wmf_test) \
 	CppunitTest_vcl_jpeg_read_write_test \
+	CppunitTest_vcl_png_test \
 ))
 
 
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx
new file mode 100644
index 0000000..14e32a6
--- /dev/null
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <vcl/filter/PngReader.hxx>
+#include <vcl/bitmapaccess.hxx>
+
+using namespace css;
+
+class PngFilterTest : public test::BootstrapFixture
+{
+    OUString maDataUrl;
+
+    OUString getFullUrl(const OUString& sFileName)
+    {
+        return m_directories.getURLFromSrc(maDataUrl) + sFileName;
+    }
+
+public:
+    PngFilterTest() :
+        BootstrapFixture(true, false),
+        maDataUrl("/vcl/qa/cppunit/png/data/")
+    {}
+
+    void testPng();
+
+    CPPUNIT_TEST_SUITE(PngFilterTest);
+    CPPUNIT_TEST(testPng);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void PngFilterTest::testPng()
+{
+    for (const OUString& aFileName: { OUString("rect-1bit-pal.png") })
+    {
+        SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ);
+
+        Graphic aGraphic;
+        vcl::PngReader aPngReader(aFileStream);
+        aPngReader.Read(aGraphic);
+
+        Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+        {
+            Bitmap::ScopedReadAccess pAccess(aBitmap);
+            CPPUNIT_ASSERT_EQUAL(32, int(pAccess->GetBitCount()));
+            CPPUNIT_ASSERT_EQUAL(4l, pAccess->Width());
+            CPPUNIT_ASSERT_EQUAL(4l, pAccess->Height());
+
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,0)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,3)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,0)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,3)).GetColor());
+
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(1,1)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(1,2)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(2,1)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00000000), Color(pAccess->GetPixel(2,2)).GetColor());
+        }
+    }
+    for (const OUString& aFileName: { OUString("color-rect-8bit-RGB.png"), OUString("color-rect-4bit-pal.png") })
+    {
+        SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ);
+
+        Graphic aGraphic;
+        vcl::PngReader aPngReader(aFileStream);
+        aPngReader.Read(aGraphic);
+
+        Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+        {
+            Bitmap::ScopedReadAccess pAccess(aBitmap);
+            CPPUNIT_ASSERT_EQUAL(32, int(pAccess->GetBitCount()));
+            CPPUNIT_ASSERT_EQUAL(4l, pAccess->Width());
+            CPPUNIT_ASSERT_EQUAL(4l, pAccess->Height());
+
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,0)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,3)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(3,0)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFFFF), Color(pAccess->GetPixel(0,3)).GetColor());
+
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FF0000), Color(pAccess->GetPixel(1,1)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x0000FF00), Color(pAccess->GetPixel(1,2)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x000000FF), Color(pAccess->GetPixel(2,1)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x00FFFF00), Color(pAccess->GetPixel(2,2)).GetColor());
+        }
+    }
+    for (const OUString& aFileName: { OUString("alpha-rect-8bit-RGBA.png") })
+    {
+        SvFileStream aFileStream(getFullUrl(aFileName), StreamMode::READ);
+
+        Graphic aGraphic;
+        vcl::PngReader aPngReader(aFileStream);
+        aPngReader.Read(aGraphic);
+
+        Bitmap aBitmap = aGraphic.GetBitmapEx().GetBitmap();
+        {
+            Bitmap::ScopedReadAccess pAccess(aBitmap);
+            CPPUNIT_ASSERT_EQUAL(32, int(pAccess->GetBitCount()));
+            CPPUNIT_ASSERT_EQUAL(4l, pAccess->Width());
+            CPPUNIT_ASSERT_EQUAL(4l, pAccess->Height());
+
+            printf("%08X\n", Color(pAccess->GetPixel(1,1)).GetColor());
+
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(0,0)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(3,3)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(3,0)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x80FFFFFF), Color(pAccess->GetPixel(0,3)).GetColor());
+
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x40FF0000), Color(pAccess->GetPixel(1,1)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0xC000FF00), Color(pAccess->GetPixel(1,2)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0xC00000FF), Color(pAccess->GetPixel(2,1)).GetColor());
+            CPPUNIT_ASSERT_EQUAL(ColorData(0x40FFFF00), Color(pAccess->GetPixel(2,2)).GetColor());
+        }
+    }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PngFilterTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/png/data/alpha-rect-8bit-RGBA.png b/vcl/qa/cppunit/png/data/alpha-rect-8bit-RGBA.png
new file mode 100644
index 0000000..1e90e1a
Binary files /dev/null and b/vcl/qa/cppunit/png/data/alpha-rect-8bit-RGBA.png differ
diff --git a/vcl/qa/cppunit/png/data/color-rect-4bit-pal.png b/vcl/qa/cppunit/png/data/color-rect-4bit-pal.png
new file mode 100644
index 0000000..740eede
Binary files /dev/null and b/vcl/qa/cppunit/png/data/color-rect-4bit-pal.png differ
diff --git a/vcl/qa/cppunit/png/data/color-rect-8bit-RGB.png b/vcl/qa/cppunit/png/data/color-rect-8bit-RGB.png
new file mode 100644
index 0000000..727859d
Binary files /dev/null and b/vcl/qa/cppunit/png/data/color-rect-8bit-RGB.png differ
diff --git a/vcl/qa/cppunit/png/data/rect-1bit-pal.png b/vcl/qa/cppunit/png/data/rect-1bit-pal.png
new file mode 100644
index 0000000..cf7ac3e
Binary files /dev/null and b/vcl/qa/cppunit/png/data/rect-1bit-pal.png differ
commit 0b6b7bc71d358794146295e255d6d14d4bbb9452
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 11:25:01 2016 +0800

    vcl: Support converting to 32-bit bitmap
    
    Change-Id: Ic1c252fcc23ba6b8581c89f17f7fd62eb501e888

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index daec7b4..15f4731 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1072,6 +1072,11 @@ void Bitmap::ImplAdaptBitCount(Bitmap& rNew) const
                 rNew.Convert(BMP_CONVERSION_24BIT);
                 break;
             }
+            case 32:
+            {
+                rNew.Convert(BMP_CONVERSION_32BIT);
+                break;
+            }
             default:
             {
                 OSL_ENSURE(false, "BitDepth adaption failed (!)");
commit cbbf71ba7e4daa657a94af820986d8a2af3b7960
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 11:21:15 2016 +0800

    svx: add support for 32-bit bitmaps to toolbar color icon
    
    A color icon (like background or font color) has an additional
    rectangle which shows the current selected color as a colored
    rectangle. Because it didn't support 32-bit colors correctly, the
    background of the icon was always white. This fixes this issue.
    
    Change-Id: I045e03f45937ba9394ba2590bc3d2228a4cd9cfe

diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index e452bc1..89665ad 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -86,12 +86,23 @@ namespace svx
         if ((maCurColor != aColor) || (aColor == COL_BLACK) ||
             bSizeChanged || bDisplayModeChanged || bForceUpdate )
         {
+            BitmapEx aSource(aImage.GetBitmapEx());
+            BitmapEx aBmpEx;
+
             // create an empty bitmap, and copy the original bitmap inside
             // (so that it grows in case the original bitmap was smaller)
             sal_uInt8 nAlpha = 255;
-            BitmapEx aBmpEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
 
-            BitmapEx aSource(aImage.GetBitmapEx());
+            if (aSource.GetBitmap().GetBitCount() == 32)
+            {
+                aBmpEx = BitmapEx(Bitmap(aItemSize, 32));
+
+            }
+            else
+            {
+                aBmpEx = BitmapEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
+            }
+
             long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
             long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
 
commit 7112460e35dad6953d8cd152242a116732280a5f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 11:18:50 2016 +0800

    Use the libpng based PngReader for reading "Image" resources
    
    This adds support for reading "Image" resources (maily icons for
    menus, toolbars,..).
    
    Change-Id: I50200b70bb2d73dd23524138ab7c853d4884d18c

diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx
index bd36080..a62da57 100644
--- a/vcl/source/image/ImplImageTree.cxx
+++ b/vcl/source/image/ImplImageTree.cxx
@@ -45,6 +45,8 @@
 #include <vcl/svapp.hxx>
 #include <vcldemo-debug.hxx>
 
+#include <vcl/filter/PngReader.hxx>
+
 #include <vcl/BitmapProcessor.hxx>
 #include <vcl/BitmapTools.hxx>
 #include <vcl/pngwrite.hxx>
@@ -146,9 +148,8 @@ void loadImageFromStream(std::shared_ptr<SvStream> const & xStream, OUString con
 
     if (rPath.endsWith(".png"))
     {
-        vcl::PNGReader aPNGReader(*xStream);
-        aPNGReader.SetIgnoreGammaChunk( true );
-        rBitmap = aPNGReader.Read();
+        vcl::PngReader aPNGReader(*xStream);
+        aPNGReader.Read(rBitmap);
     }
     else if (rPath.endsWith(".svg"))
     {
commit 05b751d5af4a65b5ec7ef23e9a0d6802d5445826
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 11:13:13 2016 +0800

    vcl: PngReader which uses libpng for PNG decoding
    
    We already need libpng for some of the dependencies and in LO
    itself (splash). However in vcl we have our own implementation
    for reading and writing PNG images. This adds a PNG reader that
    uses libpng and always decodes to a 32-bit RGBA bitmap, however
    it doesn't replace the existing PNGReader - yet.
    
    Change-Id: I95663886ea599603bb3d18826b0a640596ce3724

diff --git a/include/vcl/filter/PngReader.hxx b/include/vcl/filter/PngReader.hxx
new file mode 100644
index 0000000..957539c
--- /dev/null
+++ b/include/vcl/filter/PngReader.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <vcl/graph.hxx>
+#include <vcl/dllapi.h>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+#ifndef INCLUDED_VCL_SOURCE_FILTER_PNG_PNGREADER_HXX
+#define INCLUDED_VCL_SOURCE_FILTER_PNG_PNGREADER_HXX
+
+namespace vcl
+{
+
+class VCL_DLLPUBLIC PngReader
+{
+    SvStream& mrStream;
+    css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator;
+
+public:
+    PngReader(SvStream& rStream);
+
+    virtual ~PngReader()
+    {}
+
+    bool Read(BitmapEx& rBitmap);
+    bool Read(Graphic& rGraphic);
+};
+
+} // namespace vcl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 8b158fb..bf958f3 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -122,6 +122,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
 	icuuc \
 	lcms2 \
 	mdds_headers \
+	png \
 ))
 ifeq ($(ENABLE_HEADLESS),)
 $(eval $(call gb_Library_use_externals,vcl,\
@@ -373,6 +374,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/jpeg/JpegReader \
     vcl/source/filter/jpeg/JpegWriter \
     vcl/source/filter/jpeg/JpegTransform \
+    vcl/source/filter/png/PngReader \
     vcl/source/filter/wmf/emfwr \
     vcl/source/filter/wmf/enhwmf \
     vcl/source/filter/wmf/winmtf \
diff --git a/vcl/source/filter/png/PngReader.cxx b/vcl/source/filter/png/PngReader.cxx
new file mode 100644
index 0000000..6470aa1
--- /dev/null
+++ b/vcl/source/filter/png/PngReader.cxx
@@ -0,0 +1,180 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <vcl/filter/PngReader.hxx>
+
+#include <png.h>
+
+#include <vcl/bitmapaccess.hxx>
+
+namespace
+{
+
+void lclReadStream(png_structp pPng, png_bytep pOutBytes, png_size_t nBytesToRead)
+{
+    png_voidp pIO = png_get_io_ptr(pPng);
+
+    if (pIO == nullptr)
+        return;
+
+    SvStream* pStream = reinterpret_cast<SvStream*>(pIO);
+
+    sal_Size nBytesRead = pStream->ReadBytes(pOutBytes, nBytesToRead);
+
+    if (nBytesRead != nBytesToRead)
+        png_error(pPng, "Error reading");
+}
+
+bool reader(SvStream& rStream, Bitmap& rBitmap)
+{
+    enum { PNG_SIGNATURE_SIZE = 8 };
+
+    sal_uInt8 aHeader[PNG_SIGNATURE_SIZE];
+    rStream.ReadBytes(aHeader, PNG_SIGNATURE_SIZE);
+
+    if (png_sig_cmp(aHeader, 0, PNG_SIGNATURE_SIZE))
+        return false;
+
+    png_structp pPng = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
+    if (!pPng)
+        return false;
+
+    png_infop pInfo = png_create_info_struct(pPng);
+    if (!pInfo)
+    {
+        png_destroy_read_struct(&pPng, nullptr, nullptr);
+        return false;
+    }
+
+    if (setjmp(png_jmpbuf(pPng)))
+    {
+        png_destroy_read_struct(&pPng, &pInfo, nullptr);
+        return false;
+    }
+
+    png_set_read_fn(pPng, &rStream, lclReadStream);
+
+    png_set_crc_action(pPng, PNG_CRC_WARN_USE, PNG_CRC_WARN_DISCARD);
+
+    png_set_sig_bytes(pPng, PNG_SIGNATURE_SIZE);
+
+    png_read_info(pPng, pInfo);
+
+    png_uint_32 width = 0;
+    png_uint_32 height = 0;
+    int bitDepth = 0;
+    int colorType = -1;
+    int interlace = -1;
+
+    png_uint_32 returnValue = png_get_IHDR(pPng, pInfo, &width, &height, &bitDepth, &colorType, &interlace, nullptr, nullptr);
+
+    if (returnValue != 1)
+    {
+        png_destroy_read_struct(&pPng, &pInfo, nullptr);
+        return false;
+    }
+
+    Bitmap aBitmap(Size(width, height), 32);
+
+    png_set_bgr(pPng);
+
+    if (colorType == PNG_COLOR_TYPE_PALETTE)
+        png_set_palette_to_rgb(pPng);
+
+    if (colorType == PNG_COLOR_TYPE_GRAY)
+        png_set_expand_gray_1_2_4_to_8(pPng);
+
+    if (png_get_valid(pPng, pInfo, PNG_INFO_tRNS))
+        png_set_tRNS_to_alpha(pPng);
+
+
+    if (bitDepth == 16)
+        png_set_scale_16(pPng);
+
+    if (bitDepth < 8)
+        png_set_packing(pPng);
+
+    if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
+    {
+        png_set_gray_to_rgb(pPng);
+    }
+
+    png_set_filler(pPng, 0xFF, PNG_FILLER_AFTER);
+
+    int nNumberOfPasses = png_set_interlace_handling(pPng);
+
+    png_read_update_info(pPng, pInfo);
+    returnValue = png_get_IHDR(pPng, pInfo, &width, &height, &bitDepth, &colorType, nullptr, nullptr, nullptr);
+
+    if (returnValue != 1)
+    {
+        png_destroy_read_struct(&pPng, &pInfo, nullptr);
+        return false;
+    }
+
+    if (bitDepth != 8 || !(colorType == PNG_COLOR_TYPE_RGB ||
+                           colorType == PNG_COLOR_TYPE_RGB_ALPHA))
+    {
+        png_destroy_read_struct(&pPng, &pInfo, nullptr);
+        return false;
+    }
+
+    {
+        Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+
+        for (int pass = 0; pass < nNumberOfPasses; pass++)
+        {
+            for (png_uint_32 y = 0; y < height; y++)
+            {
+                Scanline pScanline = pWriteAccess->GetScanline(y);
+                png_read_rows(pPng, &pScanline, nullptr, 1);
+            }
+        }
+    }
+
+    png_read_end(pPng, pInfo);
+
+    png_destroy_read_struct(&pPng, &pInfo, nullptr);
+
+    rBitmap = aBitmap;
+
+    return true;
+}
+
+} // anonymous namespace
+
+namespace vcl
+{
+
+PngReader::PngReader(SvStream& rStream)
+    : mrStream(rStream)
+{}
+
+bool PngReader::Read(BitmapEx& rBitmap)
+{
+    Bitmap aBitmap;
+    if (!reader(mrStream, aBitmap))
+        return false;
+    rBitmap = BitmapEx(aBitmap);
+    return true;
+}
+
+bool PngReader::Read(Graphic& rGraphic)
+{
+    Bitmap aBitmap;
+    if (!reader(mrStream, aBitmap))
+        return false;
+    rGraphic = Graphic(aBitmap);
+    return true;
+}
+
+} // namespace vcl
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 411694e6d4f9b7df9859c8f00243878b49389635
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 11:01:58 2016 +0800

    BitmapProcessor: support creating a "disabled" RGBA bitmap
    
    Change-Id: I782514808a767084f159b5956a0bda898f0eb48e

diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index 91b46bc..1a89da5 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -77,7 +77,25 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx)
 
     BitmapEx aReturnBitmap;
 
-    if (rBitmapEx.IsTransparent())
+    if (rBitmapEx.GetBitmap().GetBitCount() == 32)
+    {
+        if (pRead && pGrey && pGreyAlpha)
+        {
+            for (long nY = 0; nY < aSize.Height(); ++nY)
+            {
+                for (long nX = 0; nX < aSize.Width(); ++nX)
+                {
+                    BitmapColor aColor = pRead->GetPixel(nY, nX);
+                    const sal_uInt8 nLum(aColor.GetLuminance());
+                    const sal_uInt8 nAlpha(std::min(aColor.GetAlpha() + 178ul, 255ul));
+                    BitmapColor aGreyValue(nLum, nLum, nLum, nAlpha);
+                    pGrey->SetPixel(nY, nX, aGreyValue);
+                }
+            }
+        }
+        aReturnBitmap = BitmapEx(aGrey);
+    }
+    else if (rBitmapEx.IsTransparent())
     {
         AlphaMask aBitmapAlpha(rBitmapEx.GetAlpha());
         BitmapReadAccess* pReadAlpha(aBitmapAlpha.AcquireReadAccess());
commit 5f08a776721406e045d24eaf8a44ad39623b6e57
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 26 10:53:12 2016 +0800

    use DrawOutDev from dialcontrol, explicitly set background
    
    When drawing the dialcontrol's VirtualDevices we can use the more
    direct DrawOutDev instead of the DrawBitmapEx. This should avoid
    creating a BitmapEx and draw directly.
    
    In addition, explicitly set the initial background even if it will
    be overdrawn or changed later.
    
    Change-Id: I06f05ac18c556fc7918709b5d3e88e30ed4d50d6

diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 4f7a240..afedc4d 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -56,7 +56,7 @@ void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
     SetSize(rSrc.maRect.GetSize());
     mbEnabled = rSrc.mbEnabled;
     Point aPos;
-    DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
+    DrawOutDev(aPos, maRect.GetSize(), aPos, maRect.GetSize(), rSrc);
 }
 
 void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
@@ -144,7 +144,7 @@ const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
 void DialControlBmp::Init()
 {
     SetSettings(mrParent.GetSettings());
-    SetBackground();
+    SetBackground(Wallpaper(COL_WHITE));
 }
 
 void DialControlBmp::SetSize( const Size& rSize )
@@ -276,7 +276,7 @@ void DialControl::Resize()
 void DialControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
 {
     Point aPos;
-    rRenderContext.DrawBitmapEx(aPos, mpImpl->mxBmpBuffered->GetBitmapEx(aPos, mpImpl->maWinSize));
+    rRenderContext.DrawOutDev(aPos, mpImpl->maWinSize, aPos, mpImpl->maWinSize, *mpImpl->mxBmpBuffered.get());
 }
 
 void DialControl::StateChanged( StateChangedType nStateChange )
commit 40a336b4b2334ec9d892668d130959204e95ffca
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 19 10:13:28 2016 +0800

    svp: premultiply the buffer when drawing a 32-bit bitmap
    
    Cairo uses premultiplied alpha for RGBA bitmap buffers. As our
    bitmap buffer doesn't currently do this, we have to do it just
    before we draw a bitmap.
    
    Change-Id: I551ba6d589b7339b2e081452c2720b39e7278b68

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index f2abf30..75183db 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -83,6 +83,16 @@ namespace
         aDamageRect.intersect(getClipBox(cr));
         return aDamageRect;
     }
+
+    static sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a)
+    {
+        return (a > 0) ? (c * 255 + a / 2) / a : 0;
+    }
+
+    static sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a)
+    {
+        return (c * a + 127) / 255;
+    }
 }
 
 bool SvpSalGraphics::blendBitmap( const SalTwoRect&, const SalBitmap& /*rBitmap*/ )
@@ -99,6 +109,28 @@ bool SvpSalGraphics::blendAlphaBitmap( const SalTwoRect&, const SalBitmap&, cons
 
 namespace
 {
+    void premultiplyBuffer(int width, int height, int stride, unsigned char* data)
+    {
+        for (int y = 0; y < height; ++y)
+        {
+            unsigned int* row = reinterpret_cast<unsigned int*>(data + y * stride);
+            for (int x = 0; x < width; ++x)
+            {
+                unsigned int px = row[x];
+                unsigned char a = (px & 0xff000000) >> 24;
+                unsigned char r = (px & 0x00ff0000) >> 16;
+                unsigned char g = (px & 0x0000ff00) >> 8;
+                unsigned char b = (px & 0x000000ff);
+
+                r = premultiply(r, a);
+                g = premultiply(g, a);
+                b = premultiply(b, a);
+
+                row[x] = (a << 24) | (r << 16) | (g << 8) | b;
+            }
+        }
+    }
+
     class SourceHelper
     {
     public:
@@ -123,7 +155,25 @@ namespace
                 source = SvpSalGraphics::createCairoSurface(aTmpBmp.GetBuffer());
             }
             else
-                source = SvpSalGraphics::createCairoSurface(rSrcBmp.GetBuffer());
+            {
+                const BitmapBuffer* pSrc = rSrcBmp.GetBuffer();
+                if (pSrc->mnColorChannelBitCount == 32)
+                {
+                    aTmpBmp.Create(rSrcBmp);
+                    source = SvpSalGraphics::createCairoSurface(aTmpBmp.GetBuffer());
+                    cairo_surface_flush(source);
+                    int w = cairo_image_surface_get_width(source);
+                    int h = cairo_image_surface_get_height(source);
+                    int stride = cairo_image_surface_get_stride(source);
+                    unsigned char* data = cairo_image_surface_get_data(source);
+                    premultiplyBuffer(w, h, stride, data);
+                    cairo_surface_mark_dirty(source);
+                }
+                else
+                {
+                    source = SvpSalGraphics::createCairoSurface(rSrcBmp.GetBuffer());
+                }
+            }
         }
         ~SourceHelper()
         {
@@ -1026,16 +1076,6 @@ void SvpSalGraphics::drawBitmap( const SalTwoRect& rTR,
     drawAlphaBitmap(rTR, rSourceBitmap, rTransparentBitmap);
 }
 
-static sal_uInt8 unpremultiply(sal_uInt8 c, sal_uInt8 a)
-{
-    return (a > 0) ? (c * 255 + a / 2) / a : 0;
-}
-
-static sal_uInt8 premultiply(sal_uInt8 c, sal_uInt8 a)
-{
-    return (c * a + 127) / 255;
-}
-
 void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
                                const SalBitmap& rSalBitmap,
                                SalColor nMaskColor )
commit cf60e28a1295de44f21cbe4490bebbcd529fed94
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 12 16:55:33 2016 +0900

    Support native alpha in outdev / virdev + support in headless
    
    This adds support for native alpha surface (RGBA) to OutputDevice
    and VirtualDevice. Mainly this removes restrictions that set the
    alpha value to opaque (1.0f). All the functions still use a
    separate "alpha" device for now.
    
    As the headless backend already uses a 32-bit surface there was
    not a big change necessary to make it work.
    
    Change-Id: Ic2f2319a006764395d70b64c473749cd6d47f812

diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index b9eb6ae..37b1329 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -33,11 +33,14 @@ enum class DeviceFormat {
                         };
 
 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 MAKE_SALCOLOR(r, g, b) MAKE_SALCOLOR_ALPHA(r, g, b, 0xFF)
+#define MAKE_SALCOLOR_ALPHA(r, g, b, a) ((SalColor)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16)|(((sal_uInt32)((sal_uInt8)(a)))<<24))
+#define SALCOLOR_ALPHA( n )         ((sal_uInt8)((n)>>24))
 #define SALCOLOR_RED( n )           ((sal_uInt8)((n)>>16))
 #define SALCOLOR_GREEN( n )         ((sal_uInt8)(((sal_uInt16)(n)) >> 8))
 #define SALCOLOR_BLUE( n )          ((sal_uInt8)(n))
-#define SALCOLOR_NONE           (~(SalColor)0)
+#define SALCOLOR_NONE           ((SalColor)0)
 
 // must equal to class Point
 struct SalPoint
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 1f861e7..f2abf30 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -886,7 +886,7 @@ void SvpSalGraphics::applyColor(cairo_t *cr, SalColor aColor)
         cairo_set_source_rgba(cr, SALCOLOR_RED(aColor)/255.0,
                                   SALCOLOR_GREEN(aColor)/255.0,
                                   SALCOLOR_BLUE(aColor)/255.0,
-                                  1.0);
+                                  SALCOLOR_ALPHA(aColor)/255.0);
     }
     else
     {
@@ -1101,7 +1101,7 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
 SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, long nWidth, long nHeight )
 {
     SvpSalBitmap* pBitmap = new SvpSalBitmap();
-    pBitmap->Create(Size(nWidth, nHeight), 32, BitmapPalette());
+    pBitmap->Create(Size(nWidth, nHeight), 24, BitmapPalette());
 
     cairo_surface_t* target = SvpSalGraphics::createCairoSurface(pBitmap->GetBuffer());
     cairo_t* cr = cairo_create(target);
@@ -1125,10 +1125,12 @@ SalColor SvpSalGraphics::getPixel( long nX, long nY )
     unsigned char *surface_data = cairo_image_surface_get_data(m_pSurface);
     unsigned char *row = surface_data + (nStride*nY);
     unsigned char *data = row + (nX * 4);
-    sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], data[SVP_CAIRO_ALPHA]);
-    sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], data[SVP_CAIRO_ALPHA]);
-    sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], data[SVP_CAIRO_ALPHA]);
-    return MAKE_SALCOLOR(r, g, b);
+    sal_uInt8 alpha = data[SVP_CAIRO_ALPHA];
+    sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], alpha);
+    sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], alpha);
+    sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], alpha);
+    SalColor aSalColor = MAKE_SALCOLOR_ALPHA(r, g, b, alpha);
+    return aSalColor;
 }
 
 namespace
diff --git a/vcl/inc/outdata.hxx b/vcl/inc/outdata.hxx
index f48f0f9..a92f739 100644
--- a/vcl/inc/outdata.hxx
+++ b/vcl/inc/outdata.hxx
@@ -23,9 +23,25 @@
 #include <tools/color.hxx>
 #include <vcl/salgtype.hxx>
 
+inline Color ImplSalToColor(SalColor aSalColor)
+{
+    Color aColor =  Color(0xFF - SALCOLOR_ALPHA(aSalColor),
+                          SALCOLOR_RED(aSalColor),
+                          SALCOLOR_GREEN(aSalColor),
+                          SALCOLOR_BLUE(aSalColor));
+    return aColor;
+}
+
 inline SalColor ImplColorToSal( Color aColor )
 {
-    return MAKE_SALCOLOR( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() );
+    return MAKE_SALCOLOR(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue());
+}
+
+inline SalColor ImplColorToSalWithAlpha(Color aColor)
+{
+    SalColor aSalColor = MAKE_SALCOLOR_ALPHA(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue(),
+                                             0xFF - aColor.GetTransparency());
+    return aSalColor;
 }
 
 inline bool ImplIsColorTransparent( Color aColor )
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 4a44770..26dc929 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -24,12 +24,36 @@ public:
     VclOutdevTest() : BootstrapFixture(true, false) {}
 
     void testVirtualDevice();
+    void testAlphaVirtualDevice();
 
     CPPUNIT_TEST_SUITE(VclOutdevTest);
     CPPUNIT_TEST(testVirtualDevice);
+    CPPUNIT_TEST(testAlphaVirtualDevice);
     CPPUNIT_TEST_SUITE_END();
 };
 
+void VclOutdevTest::testAlphaVirtualDevice()
+{
+    Size aSize(32,32);
+    ScopedVclPtrInstance< VirtualDevice > pVDev;
+    pVDev->SetOutputSizePixel(aSize);
+    pVDev->DrawPixel(Point(1,1), Color(0x00, 0x11, 0x22, 0x33));
+    pVDev->DrawPixel(Point(2,2), Color(0x10, 0xEE, 0xEE, 0xEE));
+    pVDev->DrawPixel(Point(3,3), Color(0xEE, 0xEE, 0xEE, 0xEE));
+
+    CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xFF, 0x00, 0x00, 0x00), pVDev->GetPixel(Point(0,0)).GetColor());
+    CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x00, 0x11, 0x22, 0x33), pVDev->GetPixel(Point(1,1)).GetColor());
+    CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x10, 0xEE, 0xEE, 0xEE), pVDev->GetPixel(Point(2,2)).GetColor());
+
+    Bitmap aBitmap = pVDev->GetBitmap(Point(), aSize);
+
+    Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+    CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xFF, 0x00, 0x00, 0x00), Color(pReadAccess->GetPixel(0, 0)).GetColor());
+    CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x00, 0x11, 0x22, 0x33), Color(pReadAccess->GetPixel(1, 1)).GetColor());
+    //CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xEE, 0xEE, 0xEE, 0xEE), Color(pReadAccess->GetPixel(3, 3)).GetColor());
+    //CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x10, 0xEE, 0xEE, 0xEE), Color(pReadAccess->GetPixel(2, 2)).GetColor());
+}
+
 void VclOutdevTest::testVirtualDevice()
 {
     ScopedVclPtrInstance< VirtualDevice > pVDev;
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 2e80762..7222ece 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -191,11 +191,11 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
     }
 
     // virtual devices have white background by default
-    SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+    SetBackground( Wallpaper( Color( COL_TRANSPARENT ) ) );
 
     // #i59283# don't erase user-provided surface
     if( !pData && bErase)
-        Erase();
+        //Erase();
 
     // register VirDev in the list
     mpNext = pSVData->maGDIData.mpFirstVirDev;
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index cf2ef0d..9819400 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -367,23 +367,11 @@ void OutputDevice::SetFillColor( const Color& rColor )
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaFillColorAction( aColor, true ) );
 
-    if ( ImplIsColorTransparent( aColor ) )
+    if ( maFillColor != aColor )
     {
-        if ( mbFillColor )
-        {
-            mbInitFillColor = true;
-            mbFillColor = false;
-            maFillColor = Color( COL_TRANSPARENT );
-        }
-    }
-    else
-    {
-        if ( maFillColor != aColor )
-        {
-            mbInitFillColor = true;
-            mbFillColor = true;
-            maFillColor = aColor;
-        }
+        mbInitFillColor = true;
+        mbFillColor = true;
+        maFillColor = aColor;
     }
 
     if( mpAlphaVDev )
@@ -415,23 +403,11 @@ void OutputDevice::SetLineColor( const Color& rColor )
     if( mpMetaFile )
         mpMetaFile->AddAction( new MetaLineColorAction( aColor, true ) );
 
-    if( ImplIsColorTransparent( aColor ) )
+    if( maLineColor != aColor )
     {
-        if ( mbLineColor )
-        {
-            mbInitLineColor = true;
-            mbLineColor = false;
-            maLineColor = Color( COL_TRANSPARENT );
-        }
-    }
-    else
-    {
-        if( maLineColor != aColor )
-        {
-            mbInitLineColor = true;
-            mbLineColor = true;
-            maLineColor = aColor;
-        }
+        mbInitLineColor = true;
+        mbLineColor = true;
+        maLineColor = aColor;
     }
 
     if( mpAlphaVDev )
@@ -583,7 +559,7 @@ void OutputDevice::InitLineColor()
         else if( RasterOp::Invert == meRasterOp )
             mpGraphics->SetROPLineColor( SalROPColor::Invert );
         else
-            mpGraphics->SetLineColor( ImplColorToSal( maLineColor ) );
+            mpGraphics->SetLineColor( ImplColorToSalWithAlpha( maLineColor ) );
     }
     else
         mpGraphics->SetLineColor();
@@ -605,7 +581,7 @@ void OutputDevice::InitFillColor()
         else if( RasterOp::Invert == meRasterOp )
             mpGraphics->SetROPFillColor( SalROPColor::Invert );
         else
-            mpGraphics->SetFillColor( ImplColorToSal( maFillColor ) );
+            mpGraphics->SetFillColor( ImplColorToSalWithAlpha( maFillColor ) );
     }
     else
         mpGraphics->SetFillColor();
diff --git a/vcl/source/outdev/pixel.cxx b/vcl/source/outdev/pixel.cxx
index 478a693..45a7e82 100644
--- a/vcl/source/outdev/pixel.cxx
+++ b/vcl/source/outdev/pixel.cxx
@@ -44,9 +44,7 @@ Color OutputDevice::GetPixel( const Point& rPt ) const
             const long nX = ImplLogicXToDevicePixel( rPt.X() );
             const long nY = ImplLogicYToDevicePixel( rPt.Y() );
             const SalColor aSalCol = mpGraphics->GetPixel( nX, nY, this );
-            aColor.SetRed( SALCOLOR_RED( aSalCol ) );
-            aColor.SetGreen( SALCOLOR_GREEN( aSalCol ) );
-            aColor.SetBlue( SALCOLOR_BLUE( aSalCol ) );
+            aColor = ImplSalToColor(aSalCol);
         }
     }
     return aColor;
@@ -91,7 +89,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
     if ( mpMetaFile )
         mpMetaFile->AddAction( new MetaPixelAction( rPt, aColor ) );
 
-    if ( !IsDeviceOutputNecessary() || ImplIsColorTransparent( aColor ) || ImplIsRecordLayout() )
+    if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
         return;
 
     Point aPt = ImplLogicToDevicePixel( rPt );
@@ -105,7 +103,7 @@ void OutputDevice::DrawPixel( const Point& rPt, const Color& rColor )
     if ( mbOutputClipped )
         return;
 
-    mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSal( aColor ), this );
+    mpGraphics->DrawPixel( aPt.X(), aPt.Y(), ImplColorToSalWithAlpha( aColor ), this );
 
     if( mpAlphaVDev )
         mpAlphaVDev->DrawPixel( rPt );
commit 05f6bb9532b4c780606fd2bf93e8fb49331a62ad
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 12 16:53:17 2016 +0900

    Add testcases for 32-bit bitmap
    
    Change-Id: I531b8ba7cd691a526392a85da9cb8456a1f16177

diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index bc36366..96adffe 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -16,6 +16,7 @@
 
 #include <vcl/bitmap.hxx>
 #include <vcl/bitmapaccess.hxx>
+#include <vcl/alpha.hxx>
 #include <vcl/virdev.hxx>
 
 #include <rtl/strbuf.hxx>
@@ -33,18 +34,57 @@ namespace
 
 class BitmapTest : public CppUnit::TestFixture
 {
+    void testBitmap32();
+    void testErase();
     void testConvert();
     void testScale();
     void testCRC();
-    void testBitmap32();
 
     CPPUNIT_TEST_SUITE(BitmapTest);
+    CPPUNIT_TEST(testBitmap32);
+    CPPUNIT_TEST(testErase);
     CPPUNIT_TEST(testConvert);
     CPPUNIT_TEST(testScale);
     CPPUNIT_TEST(testCRC);
     CPPUNIT_TEST_SUITE_END();
 };
 
+void BitmapTest::testErase()
+{
+    Bitmap aBitmap(Size(3, 3), 24);
+    {
+        Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+        pWriteAccess->Erase(Color(0x11, 0x22, 0x33));
+    }
+    {
+        Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+        Color aColor((Color)pReadAccess->GetPixel(0, 0));
+        CPPUNIT_ASSERT_EQUAL(RGB_COLORDATA(0x11, 0x22, 0x33), aColor.GetColor());
+    }
+}
+
+void BitmapTest::testBitmap32()
+{
+    Bitmap aBitmap(Size(3, 3), 32);
+    {
+        Bitmap::ScopedWriteAccess pWriteAccess(aBitmap);
+        pWriteAccess->Erase(TRGB_COLORDATA(0xFF, 0x11, 0x22, 0x33));
+        pWriteAccess->SetPixel(1, 1, BitmapColor(0x44, 0xFF, 0xBB, 0x00));
+        pWriteAccess->SetPixel(2, 2, BitmapColor(0x88, 0x77, 0x66, 0x55));
+    }
+    {
+        Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+        BitmapColor aColor = pReadAccess->GetPixel(0, 0);
+        CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0xFF, 0x00, 0x00, 0x00), Color(aColor).GetColor());
+
+        aColor = pReadAccess->GetPixel(1, 1);
+        CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x00, 0x44, 0xFF, 0xBB), Color(aColor).GetColor());
+
+        aColor = pReadAccess->GetPixel(2, 2);
+        CPPUNIT_ASSERT_EQUAL(TRGB_COLORDATA(0x55, 0x88, 0x77, 0x66), Color(aColor).GetColor());
+    }
+}
+
 void BitmapTest::testConvert()
 {
     Bitmap aBitmap(Size(10, 10), 8);
commit 6ee50dc2e72d14da812d567b9927b8d272bbcac6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 12 16:50:39 2016 +0900

    general support for 32-bit Bitmaps + support in "gen" backend
    
    Change-Id: Iad57414a21dfa4e84e471d288923a1417a3535a3

diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index 72c569a..a3db5e6 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -169,78 +169,98 @@ void BitmapReadAccess::SetPixelForN24BitTcMask(Scanline pScanline, long nX, cons
 
 BitmapColor BitmapReadAccess::GetPixelForN32BitTcAbgr(ConstScanline pScanline, long nX, const ColorMask&)
 {
-    BitmapColor aBitmapColor;
+    pScanline = pScanline + (nX << 2);
 
-    aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
-    aBitmapColor.SetGreen( *pScanline++ );
-    aBitmapColor.SetRed( *pScanline );
+    sal_uInt8 a = *pScanline++;
+    sal_uInt8 b = *pScanline++;
+    sal_uInt8 g = *pScanline++;
+    sal_uInt8 r = *pScanline;
 
-    return aBitmapColor;
+    return BitmapColor(r, g, b, 0xFF - a);
 }
 
 void BitmapReadAccess::SetPixelForN32BitTcAbgr(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
 {
-    *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
+    pScanline = pScanline + (nX << 2);
+
+    sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+    *pScanline++ = alpha;
     *pScanline++ = rBitmapColor.GetBlue();
     *pScanline++ = rBitmapColor.GetGreen();
-    *pScanline = rBitmapColor.GetRed();
+    *pScanline =   rBitmapColor.GetRed();
 }
 
 BitmapColor BitmapReadAccess::GetPixelForN32BitTcArgb(ConstScanline pScanline, long nX, const ColorMask&)
 {
-    BitmapColor aBitmapColor;
+    pScanline = pScanline + (nX << 2);
 
-    aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) + 1 )++ );
-    aBitmapColor.SetGreen( *pScanline++ );
-    aBitmapColor.SetBlue( *pScanline );
+    sal_uInt8 a = *pScanline++;
+    sal_uInt8 r = *pScanline++;
+    sal_uInt8 g = *pScanline++;
+    sal_uInt8 b = *pScanline;
 
-    return aBitmapColor;
+    return BitmapColor(r, g, b, 0xFF - a);
 }
 
 void BitmapReadAccess::SetPixelForN32BitTcArgb(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
 {
-    *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
+    pScanline = pScanline + (nX << 2);
+
+    sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+    *pScanline++ = alpha;
     *pScanline++ = rBitmapColor.GetRed();
     *pScanline++ = rBitmapColor.GetGreen();
-    *pScanline = rBitmapColor.GetBlue();
+    *pScanline   = rBitmapColor.GetBlue();
 }
 
 BitmapColor BitmapReadAccess::GetPixelForN32BitTcBgra(ConstScanline pScanline, long nX, const ColorMask&)
 {
-    BitmapColor aBitmapColor;
+    pScanline = pScanline + (nX << 2);
 
-    aBitmapColor.SetBlue( *( pScanline = pScanline + ( nX << 2 ) )++ );
-    aBitmapColor.SetGreen( *pScanline++ );
-    aBitmapColor.SetRed( *pScanline );
+    sal_uInt8 b = *pScanline++;
+    sal_uInt8 g = *pScanline++;
+    sal_uInt8 r = *pScanline++;
+    sal_uInt8 a = *pScanline;
 
-    return aBitmapColor;
+    return BitmapColor(r, g, b, 0xFF - a);
 }
 
 void BitmapReadAccess::SetPixelForN32BitTcBgra(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
 {
-    *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue();
+    pScanline = pScanline + (nX << 2);
+
+    sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+    *pScanline++ = rBitmapColor.GetBlue();
     *pScanline++ = rBitmapColor.GetGreen();
     *pScanline++ = rBitmapColor.GetRed();
-    *pScanline = 0xFF;
+    *pScanline   = alpha;
 }
 
 BitmapColor BitmapReadAccess::GetPixelForN32BitTcRgba(ConstScanline pScanline, long nX, const ColorMask&)
 {
-    BitmapColor aBitmapColor;
+    pScanline = pScanline + (nX << 2);
 
-    aBitmapColor.SetRed( *( pScanline = pScanline + ( nX << 2 ) )++ );
-    aBitmapColor.SetGreen( *pScanline++ );
-    aBitmapColor.SetBlue( *pScanline );
+    sal_uInt8 r = *pScanline++;
+    sal_uInt8 g = *pScanline++;
+    sal_uInt8 b = *pScanline++;
+    sal_uInt8 a = *pScanline;
 
-    return aBitmapColor;
+    return BitmapColor(r, g, b, 0xFF - a);
 }
 
 void BitmapReadAccess::SetPixelForN32BitTcRgba(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
 {
-    *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed();
+    pScanline = pScanline + (nX << 2);
+
+    sal_uInt8 alpha = 0xFF - rBitmapColor.GetAlpha();
+
+    *pScanline++ = rBitmapColor.GetRed();
     *pScanline++ = rBitmapColor.GetGreen();
     *pScanline++ = rBitmapColor.GetBlue();
-    *pScanline = 0xFF;
+    *pScanline   = alpha;
 }
 
 BitmapColor BitmapReadAccess::GetPixelForN32BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask)
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index e232b50..2f45fdd 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -80,8 +80,10 @@ sal_uInt16 ImpBitmap::ImplGetBitCount() const
         return 4;
     else if (nBitCount <= 8)
         return 8;
-    else
+    else if (nBitCount <= 24)
         return 24;
+    else
+        return 32;
 }
 
 BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BitmapAccessMode nMode )
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 844c9c7..2037918 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -129,6 +129,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
         || nBitCount ==  8
         || nBitCount == 16
         || nBitCount == 24
+        || nBitCount == 32
         , "Unsupported BitCount!"
     );
 
@@ -183,12 +184,16 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
                     break;
                 }
 #endif
-                default:
-                    nBitCount = 24;
-                    SAL_FALLTHROUGH;
+                case 32:
+                    pDIB->mnFormat |= ScanlineFormat::N32BitTcBgra;
+                    break;
                 case 24:
                     pDIB->mnFormat |= ScanlineFormat::N24BitTcBgr;
-                break;
+                    break;
+                default:
+                    pDIB->mnFormat |= ScanlineFormat::N24BitTcBgr;
+                    nBitCount = 24;
+                    break;
             }
 
             pDIB->mnWidth = rSize.Width();
commit eb268f9c780db47383fcdbc1bd7620da70fe6a23
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 12 16:47:25 2016 +0900

    bitmap: support 32bit conversion
    
    Change-Id: Ia97cb00a7f311088a8ab2c52c069a570f8c269b4

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 95f715d..2fc2350 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -83,9 +83,10 @@ enum BmpConversion
     BMP_CONVERSION_8BIT_GREYS = 5,
     BMP_CONVERSION_8BIT_COLORS = 6,
     BMP_CONVERSION_24BIT = 7,
-    BMP_CONVERSION_4BIT_TRANS = 8,
-    BMP_CONVERSION_8BIT_TRANS = 9,
-    BMP_CONVERSION_GHOSTED = 10
+    BMP_CONVERSION_32BIT = 8,
+    BMP_CONVERSION_4BIT_TRANS = 9,
+    BMP_CONVERSION_8BIT_TRANS = 10,
+    BMP_CONVERSION_GHOSTED = 11
 };
 
 enum BmpCombine
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index acc6c4b..daec7b4 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -332,6 +332,15 @@ bool Bitmap::Convert( BmpConversion eConversion )
         }
         break;
 
+        case BMP_CONVERSION_32BIT:
+        {
+            if( nBitCount < 32 )
+                bRet = ImplConvertUp( 32 );
+            else
+                bRet = true;
+        }
+        break;
+
         case BMP_CONVERSION_GHOSTED:
             bRet = ImplConvertGhosted();
         break;
commit 7b81b2730ce92c7e0aebef534341aa55b5a668d2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 12 16:38:02 2016 +0900

    ColorData - for RGB macro use TRGB with transparency set to 0
    
    Change-Id: Ia363e05768ac76a7cf4b4da6cbb57174b2d64682

diff --git a/include/tools/colordata.hxx b/include/tools/colordata.hxx
index 1d0fb42..2d8dbef 100644
--- a/include/tools/colordata.hxx
+++ b/include/tools/colordata.hxx
@@ -25,9 +25,12 @@
 typedef sal_uInt32 ColorData;
 
 #define TRGB_COLORDATA(TRANSPARENCE,RED,GREEN,BLUE) \
-        ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE))))|(((sal_uInt32)((sal_uInt8)(GREEN)))<<8)|(((sal_uInt32)((sal_uInt8)(RED)))<<16)|(((sal_uInt32)((sal_uInt8)(TRANSPARENCE)))<<24))
+        ((sal_Int32)(((sal_uInt32)((sal_uInt8)(BLUE)))) | \
+                    (((sal_uInt32)((sal_uInt8)(GREEN)))<<8) | \
+                    (((sal_uInt32)((sal_uInt8)(RED)))<<16) | \
+                    (((sal_uInt32)((sal_uInt8)(TRANSPARENCE)))<<24))
 
-#define RGB_COLORDATA( r,g,b )      ((ColorData)(((sal_uInt32)((sal_uInt8)(b))))|(((sal_uInt32)((sal_uInt8)(g)))<<8)|(((sal_uInt32)((sal_uInt8)(r)))<<16))
+#define RGB_COLORDATA( r,g,b )      TRGB_COLORDATA(0, r, g, b)
 
 #define COLORDATA_RED( n )          ((sal_uInt8)((n)>>16))
 #define COLORDATA_GREEN( n )        ((sal_uInt8)(((sal_uInt16)(n)) >> 8))
commit 501e8f74520731462dbf9f27b05f28ae8bf0b7f1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Jun 7 18:33:34 2016 +0900

    vcl: add "color channel bitcount" for an bitmap buffer (Linux)
    
    In addition to "bitcount" on bitmap buffer, which represents the
    number of bits one pixel takes, we also need the bitcount that the
    color channels take of one pixel take.
    
    For example RGB can be contined in 32 bits (because that the
    underlaying buffer supports) In this case GetBitCount returns
    32bit so we can traverse the buffer correctly. However, we also
    need to know the bitcount of the actual color channels - in this
    case this would be 24 bits.
    
    Change-Id: I0a64928336540dc66d60659c46d64f369e786c3a

diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 04baf90..25f4159 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -267,7 +267,18 @@ struct VCL_DLLPUBLIC BitmapBuffer
     long            mnWidth;
     long            mnHeight;
     long            mnScanlineSize;
+
+    /**
+     * Bitcount of one pixel in the buffer.
+     * color + alpha channels with padding (for example in an RGBX format)
+     */
     sal_uInt16      mnBitCount;
+
+    /**
+     * Bitcount color channels of one pixel.
+     * color + alpha channels only (i.e. 8, 16, 24, 32)
+     */
+    sal_uInt16      mnColorChannelBitCount;
     ColorMask       maColorMask;
     BitmapPalette   maPalette;
     sal_uInt8*      mpBits;
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 202d63c..1dc6c19 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -70,6 +70,7 @@ BitmapBuffer* ImplCreateDIB(
         {
             const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
 
+            pDIB->mnColorChannelBitCount = nBitCount;
             switch (nBitCount)
             {
                 case 1:
@@ -229,16 +230,14 @@ Size SvpSalBitmap::GetSize() const
     return aSize;
 }
 
-sal_uInt16 SvpSalBitmap::GetBitCount() const
+sal_uInt16 SvpSalBitmap::GetColorChannelBitCount() const
 {
-    sal_uInt16 nBitCount;
-
-    if (mpDIB)
-        nBitCount = mpDIB->mnBitCount;
-    else
-        nBitCount = 0;
+    return (mpDIB) ? mpDIB->mnColorChannelBitCount : 0;
+}
 
-    return nBitCount;
+sal_uInt16 SvpSalBitmap::GetBitCount() const
+{
+    return (mpDIB) ? mpDIB->mnBitCount : 0;
 }
 
 BitmapBuffer* SvpSalBitmap::AcquireBuffer(BitmapAccessMode)
diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx
index af50ecf..8e90399 100644
--- a/vcl/inc/headless/svpbmp.hxx
+++ b/vcl/inc/headless/svpbmp.hxx
@@ -52,6 +52,7 @@ public:
     virtual void            Destroy() final override;
     virtual Size            GetSize() const override;
     virtual sal_uInt16      GetBitCount() const override;
+    virtual sal_uInt16      GetColorChannelBitCount() const override;
 
     virtual BitmapBuffer*   AcquireBuffer( BitmapAccessMode nMode ) override;
     virtual void            ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index d10129c..4579e34 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -68,6 +68,7 @@ public:
 
     Size            GetSize() const override;
     sal_uInt16      GetBitCount() const override;
+    sal_uInt16      GetColorChannelBitCount() const override;
 
     BitmapBuffer*   AcquireBuffer( BitmapAccessMode nMode ) override;
     void            ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 69d2539..91e4e5c 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -61,6 +61,7 @@ public:
     virtual void            Destroy() = 0;
     virtual Size            GetSize() const = 0;
     virtual sal_uInt16      GetBitCount() const = 0;
+    virtual sal_uInt16      GetColorChannelBitCount() const = 0;
 
     virtual BitmapBuffer*   AcquireBuffer( BitmapAccessMode nMode ) = 0;
     virtual void            ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) = 0;
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 81998ba..a1cc20c 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -139,6 +139,7 @@ public:
 
     virtual Size                GetSize() const override;
     virtual sal_uInt16          GetBitCount() const override;
+    virtual sal_uInt16          GetColorChannelBitCount() const override;
 
     virtual BitmapBuffer*       AcquireBuffer( BitmapAccessMode nMode ) override;
     virtual void                ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 9fb8c47..d2eb8f2 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -627,6 +627,11 @@ sal_uInt16 OpenGLSalBitmap::GetBitCount() const
     return mnBits;
 }
 
+sal_uInt16 OpenGLSalBitmap::GetColorChannelBitCount() const
+{
+    return mnBits;
+}
+
 bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& rChecksum) const
 {
     OUString FragShader("areaHashCRC64TFragmentShader");
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index ab06a71..e232b50 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -73,9 +73,15 @@ Size ImpBitmap::ImplGetSize() const
 
 sal_uInt16 ImpBitmap::ImplGetBitCount() const
 {
-    sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
-    return ( nBitCount <= 4 ) ? ( ( nBitCount <= 1 ) ? 1 : 4 ):
-                                ( ( nBitCount <= 8 ) ? 8 : 24);
+    sal_uInt16 nBitCount = mpSalBitmap->GetColorChannelBitCount();
+    if (nBitCount <= 1)
+        return 1;
+    else if (nBitCount <= 4)
+        return 4;
+    else if (nBitCount <= 8)
+        return 8;
+    else
+        return 24;
 }
 
 BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BitmapAccessMode nMode )
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index 158a2f5..844c9c7 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -148,7 +148,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
         if( pDIB )
         {
             const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
-
+            pDIB->mnColorChannelBitCount = nBitCount;
             pDIB->mnFormat = ScanlineFormat::NONE;
 
             switch( nBitCount )
@@ -259,6 +259,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB(
             aSrcBuf.mnWidth = nWidth;
             aSrcBuf.mnHeight = nHeight;
             aSrcBuf.mnBitCount = pImage->bits_per_pixel;
+            aSrcBuf.mnColorChannelBitCount = aSrcBuf.mnBitCount;
             aSrcBuf.mnScanlineSize = pImage->bytes_per_line;
             aSrcBuf.mpBits = reinterpret_cast<sal_uInt8*>(pImage->data);
 
@@ -847,6 +848,11 @@ sal_uInt16 X11SalBitmap::GetBitCount() const
     return nBitCount;
 }
 
+sal_uInt16 X11SalBitmap::GetColorChannelBitCount() const
+{
+    return GetBitCount();
+}
+
 BitmapBuffer* X11SalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
 {
     if( !mpDIB && mpDDB )
commit 1aa579feaa841efcaee7389447c15c43a3d15b6d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sun Jun 5 18:58:58 2016 +0900

    Alpha channel in BitmapColor - change bIndex to alpha
    
    We what to store the alpha channel in BitmapColor. To achieve this
    we can repurpose bIndex attribute for alpha. Generally we don't
    need bIndex at all as we can infer if we use index colors or not
    from the context.
    
    Change-Id: I18fe748beeca59e2869368a1c3c2ee9d2062b41e

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index b2f673b..5b0baed 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -328,22 +328,6 @@ namespace cairocanvas
         return ::BitmapEx();
     }
 
-    static sal_uInt8 lcl_GetColor(BitmapColor const& rColor)
-    {
-        sal_uInt8 nTemp(0);
-        if (rColor.IsIndex())
-        {
-            nTemp = rColor.GetIndex();
-        }
-        else
-        {
-            nTemp = rColor.GetBlue();
-            // greyscale expected here, or what would non-grey colors mean?
-            assert(rColor.GetRed() == nTemp && rColor.GetGreen() == nTemp);
-        }
-        return nTemp;
-    }
-
     static bool readAlpha( BitmapReadAccess* pAlphaReadAcc, long nY, const long nWidth, unsigned char* data, long nOff )
     {
         bool bIsAlpha = false;
@@ -372,7 +356,7 @@ namespace cairocanvas
                     BitmapColor const& rColor(
                         pAlphaReadAcc->GetPaletteColor(*pReadScan));
                     pReadScan++;
-                    nAlpha = data[ nOff ] = 255 - lcl_GetColor(rColor);
+                    nAlpha = data[ nOff ] = 255 - rColor.GetBlueOrIndex();
                     if( nAlpha != 255 )
                         bIsAlpha = true;
                     nOff += 4;
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 9e3f497..3d227ba 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -73,6 +73,8 @@ public:
     typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess >
         ScopedWriteAccess;
 
+    using Bitmap::IsEmpty;
+
 private:
     friend class BitmapEx;
     friend class ::OutputDevice;
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index a40f24f..04baf90 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -98,20 +98,17 @@ private:
     sal_uInt8               mcBlueOrIndex;
     sal_uInt8               mcGreen;
     sal_uInt8               mcRed;
-    sal_uInt8               mbIndex; // should be bool, but see above warning
-
+    sal_uInt8               mcAlpha;
 public:
 
     inline              BitmapColor();
-    inline              BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue );
+    inline              BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha = 0 );
     inline              BitmapColor( const Color& rColor );
     explicit inline     BitmapColor( sal_uInt8 cIndex );
 
     inline bool         operator==( const BitmapColor& rBitmapColor ) const;
     inline bool         operator!=( const BitmapColor& rBitmapColor ) const;
 
-    inline bool         IsIndex() const;
-
     inline sal_uInt8    GetRed() const;
     inline void         SetRed( sal_uInt8 cRed );
 
@@ -124,6 +121,9 @@ public:
     inline sal_uInt8    GetIndex() const;
     inline void         SetIndex( sal_uInt8 cIndex );
 
+    inline sal_uInt8    GetAlpha() const;
+    inline void         SetAlpha( sal_uInt8 cAlpha );
+
     operator            Color() const;
 
     inline sal_uInt8    GetBlueOrIndex() const;
@@ -288,15 +288,15 @@ inline BitmapColor::BitmapColor() :
             mcBlueOrIndex   ( 0 ),
             mcGreen         ( 0 ),
             mcRed           ( 0 ),
-            mbIndex         ( sal_uInt8(false) )
+            mcAlpha         ( 0 )
 {
 }
 
-inline BitmapColor::BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue ) :
+inline BitmapColor::BitmapColor( sal_uInt8 cRed, sal_uInt8 cGreen, sal_uInt8 cBlue, sal_uInt8 cAlpha ) :
             mcBlueOrIndex   ( cBlue ),
             mcGreen         ( cGreen ),
             mcRed           ( cRed ),
-            mbIndex         ( sal_uInt8(false) )
+            mcAlpha         ( cAlpha )
 {
 }
 
@@ -304,7 +304,7 @@ inline BitmapColor::BitmapColor( const Color& rColor ) :
             mcBlueOrIndex   ( rColor.GetBlue() ),
             mcGreen         ( rColor.GetGreen() ),
             mcRed           ( rColor.GetRed() ),
-            mbIndex         ( sal_uInt8(false) )
+            mcAlpha         ( rColor.GetTransparency() )
 {
 }
 
@@ -312,15 +312,16 @@ inline BitmapColor::BitmapColor( sal_uInt8 cIndex ) :
             mcBlueOrIndex   ( cIndex ),
             mcGreen         ( 0 ),
             mcRed           ( 0 ),
-            mbIndex         ( sal_uInt8(true) )
+            mcAlpha         ( 0 )
 {
 }
 
 inline bool BitmapColor::operator==( const BitmapColor& rBitmapColor ) const
 {
-    return( ( mcBlueOrIndex == rBitmapColor.mcBlueOrIndex ) &&
-            ( mbIndex ? bool(rBitmapColor.mbIndex) :
-            ( mcGreen == rBitmapColor.mcGreen && mcRed == rBitmapColor.mcRed ) ) );
+    return mcBlueOrIndex == rBitmapColor.mcBlueOrIndex &&
+           mcGreen == rBitmapColor.mcGreen &&
+           mcRed == rBitmapColor.mcRed &&
+           mcAlpha == rBitmapColor.mcAlpha;
 }
 
 inline bool BitmapColor::operator!=( const BitmapColor& rBitmapColor ) const
@@ -328,63 +329,59 @@ inline bool BitmapColor::operator!=( const BitmapColor& rBitmapColor ) const
     return !( *this == rBitmapColor );
 }
 
-inline bool BitmapColor::IsIndex() const
-{
-    return mbIndex;
-}
-
 inline sal_uInt8 BitmapColor::GetRed() const
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     return mcRed;
 }
 
 inline void BitmapColor::SetRed( sal_uInt8 cRed )
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     mcRed = cRed;
 }
 
 inline sal_uInt8 BitmapColor::GetGreen() const
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     return mcGreen;
 }
 
 inline void BitmapColor::SetGreen( sal_uInt8 cGreen )
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     mcGreen = cGreen;
 }
 
 inline sal_uInt8 BitmapColor::GetBlue() const
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     return mcBlueOrIndex;
 }
 
 inline void BitmapColor::SetBlue( sal_uInt8 cBlue )
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     mcBlueOrIndex = cBlue;
 }
 
 inline sal_uInt8 BitmapColor::GetIndex() const
 {
-    assert( mbIndex && "Pixel represents color values" );
     return mcBlueOrIndex;
 }
 
 inline void BitmapColor::SetIndex( sal_uInt8 cIndex )
 {
-    assert( mbIndex && "Pixel represents color values" );
     mcBlueOrIndex = cIndex;
 }
 
+inline sal_uInt8 BitmapColor::GetAlpha() const
+{
+    return mcAlpha;
+}
+
+inline void BitmapColor::SetAlpha( sal_uInt8 cAlpha )
+{
+    mcAlpha = cAlpha;
+}
+
 inline BitmapColor::operator Color() const
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
-    return Color( mcRed, mcGreen, mcBlueOrIndex );
+    return Color(mcAlpha, mcRed, mcGreen, mcBlueOrIndex);
 }
 
 inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
@@ -395,7 +392,6 @@ inline sal_uInt8 BitmapColor::GetBlueOrIndex() const
 
 inline BitmapColor& BitmapColor::Invert()
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     mcBlueOrIndex = ~mcBlueOrIndex;
     mcGreen = ~mcGreen;
     mcRed = ~mcRed;
@@ -405,15 +401,12 @@ inline BitmapColor& BitmapColor::Invert()
 
 inline sal_uInt8 BitmapColor::GetLuminance() const
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
     return (static_cast<unsigned long>(mcBlueOrIndex) * 28UL + static_cast<unsigned long>(mcGreen) * 151UL + static_cast<unsigned long>(mcRed) * 77UL) >> 8;
 }
 
 
 inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uInt8 cTransparency )
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
-    assert( !rBitmapColor.mbIndex && "Pixel represents index into colortable" );
     mcBlueOrIndex = COLOR_CHANNEL_MERGE( mcBlueOrIndex, rBitmapColor.mcBlueOrIndex, cTransparency );
     mcGreen = COLOR_CHANNEL_MERGE( mcGreen, rBitmapColor.mcGreen, cTransparency );
     mcRed = COLOR_CHANNEL_MERGE( mcRed, rBitmapColor.mcRed, cTransparency );
@@ -424,8 +417,6 @@ inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uIn
 
 inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const
 {
-    assert( !mbIndex && "Pixel represents index into colortable" );
-    assert( !rBitmapColor.mbIndex && "Pixel represents index into colortable" );
     return static_cast<sal_uInt16>(
         abs( static_cast<int>(mcBlueOrIndex) - static_cast<int>(rBitmapColor.mcBlueOrIndex) ) +
         abs( static_cast<int>(mcGreen) - static_cast<int>(rBitmapColor.mcGreen) ) +
diff --git a/vcl/qa/cppunit/BitmapTest.cxx b/vcl/qa/cppunit/BitmapTest.cxx
index 35b31fd..bc36366 100644
--- a/vcl/qa/cppunit/BitmapTest.cxx
+++ b/vcl/qa/cppunit/BitmapTest.cxx
@@ -36,6 +36,7 @@ class BitmapTest : public CppUnit::TestFixture
     void testConvert();
     void testScale();
     void testCRC();
+    void testBitmap32();
 
     CPPUNIT_TEST_SUITE(BitmapTest);
     CPPUNIT_TEST(testConvert);
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index 8501f00..72c569a 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -79,11 +79,7 @@ BitmapColor BitmapReadAccess::GetPixelForN8BitPal(ConstScanline pScanline, long
 
 void BitmapReadAccess::SetPixelForN8BitPal(Scanline pScanline, long nX, const BitmapColor& rBitmapColor, const ColorMask&)
 {
-    if (rBitmapColor.IsIndex())
-        pScanline[ nX ] = rBitmapColor.GetIndex();
-    else
-        // Let's hope that the RGB color values equal, so it doesn't matter what do we pick
-        pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
+    pScanline[ nX ] = rBitmapColor.GetBlueOrIndex();
 }
 
 BitmapColor BitmapReadAccess::GetPixelForN8BitTcMask(ConstScanline pScanline, long nX, const ColorMask& rMask)
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 0a7c849..f08b058 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -77,8 +77,8 @@ private:
     Scanline            mpScanAccess;
     sal_PtrDiff         mnScanOffset;
 
-    sal_uInt32          ColorOf (BitmapColor& rColor) const;
-    sal_uInt8           GrayOf  (BitmapColor& rColor) const;
+    sal_uInt32          ColorOf (BitmapColor& rColor, bool bIndex) const;
+    sal_uInt8           GrayOf  (BitmapColor& rColor, bool bIndex) const;
 
     public:
 
@@ -189,10 +189,10 @@ SalPrinterBmp::GetDepth () const
 }
 
 sal_uInt32
-SalPrinterBmp::ColorOf (BitmapColor& rColor) const
+SalPrinterBmp::ColorOf(BitmapColor& rColor, bool bIndex) const
 {
-    if (rColor.IsIndex())
-        return ColorOf (mpBmpBuffer->maPalette[rColor.GetIndex()]);
+    if (bIndex)
+        return ColorOf(mpBmpBuffer->maPalette[rColor.GetIndex()], false);
     else
         return    ((rColor.GetBlue())        & 0x000000ff)
                 | ((rColor.GetGreen() <<  8) & 0x0000ff00)
@@ -200,10 +200,10 @@ SalPrinterBmp::ColorOf (BitmapColor& rColor) const
 }
 
 sal_uInt8
-SalPrinterBmp::GrayOf (BitmapColor& rColor) const
+SalPrinterBmp::GrayOf(BitmapColor& rColor, bool bIndex) const
 {
-    if (rColor.IsIndex())
-        return GrayOf (mpBmpBuffer->maPalette[rColor.GetIndex()]);
+    if (bIndex)
+        return GrayOf(mpBmpBuffer->maPalette[rColor.GetIndex()], false);
     else
         return (  rColor.GetBlue()  *  28UL
                 + rColor.GetGreen() * 151UL
@@ -213,13 +213,13 @@ SalPrinterBmp::GrayOf (BitmapColor& rColor) const
 sal_uInt32
 SalPrinterBmp::GetPaletteEntryCount () const
 {
-    return mpBmpBuffer->maPalette.GetEntryCount ();
+    return mpBmpBuffer->maPalette.GetEntryCount();
 }
 
 sal_uInt32
 SalPrinterBmp::GetPaletteColor (sal_uInt32 nIdx) const
 {
-    return ColorOf (mpBmpBuffer->maPalette[nIdx]);
+    return ColorOf(mpBmpBuffer->maPalette[nIdx], false);
 }
 
 sal_uInt32
@@ -228,7 +228,7 @@ SalPrinterBmp::GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const
     Scanline pScan = mpScanAccess + nRow * mnScanOffset;
     BitmapColor aColor = mpFncGetPixel (pScan, nColumn, mpBmpBuffer->maColorMask);
 
-    return ColorOf (aColor);
+    return ColorOf(aColor, !!mpBmpBuffer->maPalette);
 }
 
 sal_uInt8
@@ -237,7 +237,7 @@ SalPrinterBmp::GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const
     Scanline pScan = mpScanAccess + nRow * mnScanOffset;
     BitmapColor aColor = mpFncGetPixel (pScan, nColumn, mpBmpBuffer->maColorMask);
 
-    return GrayOf (aColor);
+    return GrayOf(aColor, !!mpBmpBuffer->maPalette);
 }
 
 sal_uInt8
@@ -246,7 +246,7 @@ SalPrinterBmp::GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const
     Scanline pScan = mpScanAccess + nRow * mnScanOffset;
     BitmapColor aColor = mpFncGetPixel (pScan, nColumn, mpBmpBuffer->maColorMask);
 
-    if (aColor.IsIndex())
+    if (!!mpBmpBuffer->maPalette)
         return aColor.GetIndex();
     else
         return 0;
commit 2a83720fd1184868e84dbe2aedb65dbf0e27a6de
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Nov 15 21:06:53 2016 +0100

    screenshotannotation: Fix bookmark snippets
    
    Change-Id: I245000b48775955dcf72f362829df7594e8b637b
    Reviewed-on: https://gerrit.libreoffice.org/30880
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index c45913b..1412160 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -90,7 +90,7 @@ namespace
     OUString lcl_Bookmark( const OUString& rWidgetId )
     {
         OUString aTempl = "<!-- Bookmark for widget %1 -->" SAL_NEWLINE_STRING
-                          "<bookmark xml-lang=en-US branch=hid/%2 %3 localize=false </bookmark>" SAL_NEWLINE_STRING;
+                          "<bookmark xml-lang=en-US branch=hid/%2 id=%3 localize=\"false\"/>" SAL_NEWLINE_STRING;
         aTempl = aTempl.replaceFirst( "%1", rWidgetId );
         aTempl = aTempl.replaceFirst( "%2", rWidgetId );
         aTempl = aTempl.replaceFirst( "%3", lcl_genRandom("bm_id") );
@@ -222,7 +222,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
     // set screenshot image at FixedImage, resize, set event listener
     if (mpPicture)
     {
-        // colelct all children. Choose start pos to be negative
+        // collect all children. Choose start pos to be negative
         // of target dialog's position to get all positions relative to (0,0)
         const Point aParentPos(mrParentDialog.GetPosPixel());
         const basegfx::B2IPoint aTopLeft(-aParentPos.X(), -aParentPos.Y());
commit 72ffa98e892ad1b64ff3a00b1e26a995cba3076f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Nov 16 08:59:00 2016 +0200

    make the element names in dumpAsXml match the class names
    
    Change-Id: I955facfe3e901fcb76798dab342f96a67d5ac63f
    Reviewed-on: https://gerrit.libreoffice.org/30894
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx
index dbd428b..33dd25b 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -71,7 +71,7 @@ void EditCharAttrib::SetFont( SvxFont&, OutputDevice* )
 
 void EditCharAttrib::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("editCharAttrib"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("EditCharAttrib"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nStart"), "%d", nStart);
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nEnd"), "%d", nEnd);
     pItem->dumpAsXml(pWriter);
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index cdc06a8..a7a73ce 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1859,7 +1859,7 @@ void ContentNode::DestroyWrongList()
 
 void ContentNode::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("contentNode"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("ContentNode"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("maString"), BAD_CAST(maString.toUtf8().getStr()));
     aContentAttribs.dumpAsXml(pWriter);
     aCharAttribList.dumpAsXml(pWriter);
@@ -1943,7 +1943,7 @@ bool ContentAttribs::HasItem( sal_uInt16 nWhich ) const
 
 void ContentAttribs::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("contentAttribs"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("ContentAttribs"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("style"), "%s", pStyle->GetName().toUtf8().getStr());
     aAttribSet.dumpAsXml(pWriter);
     xmlTextWriterEndElement(pWriter);
@@ -2749,7 +2749,7 @@ void EditDoc::dumpAsXml(struct _xmlTextWriter* pWriter) const
         bOwns = true;
     }
 
-    xmlTextWriterStartElement(pWriter, BAD_CAST("editDoc"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("EditDoc"));
     for (auto const & i : maContents)
     {
         i->dumpAsXml(pWriter);
@@ -3065,7 +3065,7 @@ void CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs)
 
 void CharAttribList::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("charAttribList"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("CharAttribList"));
     for (auto const & i : aAttribs) {
         i->dumpAsXml(pWriter);
     }
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 33939f5f6..06e20d9 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -166,7 +166,7 @@ void ContentInfo::SetText( const OUString& rStr )
 
 void ContentInfo::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("contentInfo"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("ContentInfo"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("style"), BAD_CAST(aStyle.toUtf8().getStr()));
     xmlTextWriterStartElement(pWriter, BAD_CAST("text"));
     xmlTextWriterWriteString(pWriter, BAD_CAST(GetText().toUtf8().getStr()));
@@ -458,7 +458,7 @@ void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const
         bOwns = true;
     }
 
-    xmlTextWriterStartElement(pWriter, BAD_CAST("editTextObject"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("EditTextObject"));
     sal_Int32 nCount = GetParagraphCount();
     for (sal_Int32 i = 0; i < nCount; ++i)
     {
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 20b8511..dc659e9 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -823,7 +823,7 @@ bool SvxLRSpaceItem::HasMetrics() const
 
 void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxLRSpaceItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxLRSpaceItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nFirstLineOfst"), BAD_CAST(OString::number(nFirstLineOfst).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nTxtLeft"), BAD_CAST(OString::number(nTxtLeft).getStr()));
@@ -1088,7 +1088,7 @@ bool SvxULSpaceItem::HasMetrics() const
 
 void SvxULSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxULSpaceItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxULSpaceItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nUpper"), BAD_CAST(OString::number(nUpper).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLower"), BAD_CAST(OString::number(nLower).getStr()));
@@ -1280,7 +1280,7 @@ SfxPoolItem* SvxProtectItem::Create( SvStream& rStrm, sal_uInt16 ) const
 
 void SvxProtectItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxProtectItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxProtectItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("content"), BAD_CAST(OString::boolean(bCntnt).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("size"), BAD_CAST(OString::boolean(bSize).getStr()));
@@ -1570,7 +1570,7 @@ void SvxShadowItem::SetEnumValue( sal_uInt16 nVal )
 
 void SvxShadowItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxShadowItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxShadowItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aShadowColor"), BAD_CAST(aShadowColor.AsRGBHexString().toUtf8().getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidth"), BAD_CAST(OString::number(nWidth).getStr()));
@@ -4033,7 +4033,7 @@ void SvxBrushItem::ApplyGraphicTransparency_Impl()
 
 void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxBrushItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBrushItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("color"), BAD_CAST(aColor.AsRGBHexString().toUtf8().getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("shadingValue"), BAD_CAST(OString::number(nShadingValue).getStr()));
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index ad62a5c..3d7a3b4 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -686,7 +686,7 @@ void SvxNumRule::Store( SvStream &rStream )
 
 void SvxNumRule::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxNumRule"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxNumRule"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("levelCount"), BAD_CAST(OUString::number(nLevelCount).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("continuousNumbering"), BAD_CAST(OUString::boolean(bContinuousNumbering).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("numberingType"), BAD_CAST(OUString::number((int)eNumberingType).getStr()));
@@ -981,7 +981,7 @@ bool SvxNumBulletItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberI
 
 void SvxNumBulletItem::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxNumBulletItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxNumBulletItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     pNumRule->dumpAsXml(pWriter);
     xmlTextWriterEndElement(pWriter);
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index f05529d..ffe4848 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -439,7 +439,7 @@ void SvxFontItem::EnableStoreUnicodeNames( bool bEnable )
 
 void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFontItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("familyName"), BAD_CAST(aFamilyName.toUtf8().getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("styleName"), BAD_CAST(aStyleName.toUtf8().getStr()));
@@ -575,7 +575,7 @@ void SvxPostureItem::SetBoolValue( bool bVal )
 
 void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxPostureItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxPostureItem"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%d", GetValue());
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr()));
@@ -698,7 +698,7 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 
 void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxWeightItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxWeightItem"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%d", GetValue());
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(GetValueTextByPos(GetValue()).toUtf8().getStr()));
@@ -1087,7 +1087,7 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
 
 void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontHeightItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFontHeightItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(nHeight).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("prop"), BAD_CAST(OString::number(nProp).getStr()));
@@ -2986,7 +2986,7 @@ bool SvxCharRotateItem::operator==( const SfxPoolItem& rItem ) const
 
 void SvxCharRotateItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxCharRotateItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxCharRotateItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("fitToLine"), BAD_CAST(OString::boolean(IsFitToLine()).getStr()));
@@ -3438,7 +3438,7 @@ SfxPoolItem* SvxRsidItem::Create(SvStream& rIn, sal_uInt16 ) const
 
 void SvxRsidItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("svxRsidItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SvxRsidItem"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("whichId"), "%d", Which());
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%" SAL_PRIuUINT32, GetValue());
     xmlTextWriterEndElement(pWriter);
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index ccd8b9a..a77e881 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2184,7 +2184,7 @@ void Outliner::dumpAsXml(struct _xmlTextWriter* pWriter) const
         bOwns = true;
     }
 
-    xmlTextWriterStartElement(pWriter, BAD_CAST("outliner"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("Outliner"));
     pParaList->dumpAsXml(pWriter);
     xmlTextWriterEndElement(pWriter);
 
diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx
index 209d6d0..3eba88e 100644
--- a/editeng/source/outliner/outlobj.cxx
+++ b/editeng/source/outliner/outlobj.cxx
@@ -225,7 +225,7 @@ void OutlinerParaObject::SetStyleSheets(sal_uInt16 nLevel, const OUString& rNewN
 
 void OutlinerParaObject::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("outlinerParaObject"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("OutlinerParaObject"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
     mpImpl->mpEditTextObject->dumpAsXml(pWriter);
     for (Paragraph const & p : mpImpl->maParagraphDataVector)
diff --git a/editeng/source/outliner/paralist.cxx b/editeng/source/outliner/paralist.cxx
index 544da1e..6125192 100644
--- a/editeng/source/outliner/paralist.cxx
+++ b/editeng/source/outliner/paralist.cxx
@@ -99,7 +99,7 @@ void Paragraph::SetParaIsNumberingRestart( bool bParaIsNumberingRestart )
 
 void Paragraph::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("paragraph"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("Paragraph"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nDepth"), "%" SAL_PRIdINT32, (sal_Int32)nDepth);
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mnNumberingStartValue"), "%" SAL_PRIdINT32, (sal_Int32)mnNumberingStartValue);
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mbParaIsNumberingRestart"), "%" SAL_PRIdINT32, (sal_Int32)mbParaIsNumberingRestart);
@@ -266,7 +266,7 @@ sal_Int32 ParagraphList::GetAbsPos( Paragraph* pParent ) const
 
 void ParagraphList::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("paragraphList"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("ParagraphList"));
     for (const Paragraph* pParagraph : maEntries)
         pParagraph->dumpAsXml(pWriter);
     xmlTextWriterEndElement(pWriter);
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 31f7b8c..fe42b62 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -1093,7 +1093,7 @@ void ScCondFormatItem::SetCondFormatData( const std::vector<sal_uInt32>& rIndex
 
 void ScCondFormatItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("condFormatItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("ScCondFormatItem"));
     for (const auto& nItem : maIndex)
     {
         std::string aStrVal = std::to_string(nItem);
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index e3e48f7..2d2cc99 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -837,9 +837,9 @@ void SdTiledRenderingTest::testResizeTableColumn()
 
     // Remember the original cell widths.
     xmlDocPtr pXmlDoc = parseXmlDump();
-    OString aPrefix = "/sdDrawDocument/sdrModel/sdPage/sdrObjList/sdrTableObj/sdrTableObjImpl/tableLayouter/columns/";
-    sal_Int32 nExpectedColumn1 = getXPath(pXmlDoc, aPrefix + "layout[1]", "size").toInt32();
-    sal_Int32 nExpectedColumn2 = getXPath(pXmlDoc, aPrefix + "layout[2]", "size").toInt32();
+    OString aPrefix = "/SdDrawDocument/SdrModel/SdPage/SdrObjList/SdrTableObj/SdrTableObjImpl/TableLayouter/columns/";
+    sal_Int32 nExpectedColumn1 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[1]", "size").toInt32();
+    sal_Int32 nExpectedColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32();
     xmlFreeDoc(pXmlDoc);
     pXmlDoc = nullptr;
 
@@ -850,9 +850,9 @@ void SdTiledRenderingTest::testResizeTableColumn()
 
     // Remember the resized column widths.
     pXmlDoc = parseXmlDump();
-    sal_Int32 nResizedColumn1 = getXPath(pXmlDoc, aPrefix + "layout[1]", "size").toInt32();
+    sal_Int32 nResizedColumn1 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[1]", "size").toInt32();
     CPPUNIT_ASSERT(nResizedColumn1 < nExpectedColumn1);
-    sal_Int32 nResizedColumn2 = getXPath(pXmlDoc, aPrefix + "layout[2]", "size").toInt32();
+    sal_Int32 nResizedColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32();
     CPPUNIT_ASSERT(nResizedColumn2 > nExpectedColumn2);
     xmlFreeDoc(pXmlDoc);
     pXmlDoc = nullptr;
@@ -862,10 +862,10 @@ void SdTiledRenderingTest::testResizeTableColumn()
 
     // Check the undo result.
     pXmlDoc = parseXmlDump();
-    sal_Int32 nActualColumn1 = getXPath(pXmlDoc, aPrefix + "layout[1]", "size").toInt32();
+    sal_Int32 nActualColumn1 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[1]", "size").toInt32();
     // Expected was 7049, actual was 6048, i.e. the first column width after undo was 1cm smaller than expected.
     CPPUNIT_ASSERT_EQUAL(nExpectedColumn1, nActualColumn1);
-    sal_Int32 nActualColumn2 = getXPath(pXmlDoc, aPrefix + "layout[2]", "size").toInt32();
+    sal_Int32 nActualColumn2 = getXPath(pXmlDoc, aPrefix + "TableLayouter_Layout[2]", "size").toInt32();
     CPPUNIT_ASSERT_EQUAL(nExpectedColumn2, nActualColumn2);
     xmlFreeDoc(pXmlDoc);
     pXmlDoc = nullptr;
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 39a463e..eda9ce8 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -1101,7 +1101,7 @@ void SdDrawDocument::dumpAsXml(xmlTextWriterPtr pWriter) const
         xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
         bOwns = true;
     }
-    xmlTextWriterStartElement(pWriter, BAD_CAST("sdDrawDocument"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SdDrawDocument"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
 
     if (mpOutliner)
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 9291581..5644999 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -631,7 +631,7 @@ void SdPage::removeAnnotation( const Reference< XAnnotation >& xAnnotation )
 
 void SdPage::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("sdPage"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SdPage"));
 
     const char* pPageKind = nullptr;
     switch (mePageKind)
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 135f2ff..ad6d6cc 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1526,7 +1526,7 @@ void SfxViewShell::NotifyOtherView(OutlinerViewShell* pOther, int nType, const O
 
 void SfxViewShell::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("sfxViewShell"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SfxViewShell"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(GetViewShellId()).getStr()));
     xmlTextWriterEndElement(pWriter);
diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx
index 8603d2b..e31ce2c 100644
--- a/svl/source/items/cenumitm.cxx
+++ b/svl/source/items/cenumitm.cxx
@@ -177,7 +177,7 @@ bool SfxBoolItem::GetPresentation(SfxItemPresentation,
 
 void SfxBoolItem::dumpAsXml(struct _xmlTextWriter* pWriter) const
 {
-    xmlTextWriterStartElement(pWriter, BAD_CAST("sfxBoolItem"));
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SfxBoolItem"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(GetValueTextByVal(m_bValue).toUtf8().getStr()));
     xmlTextWriterEndElement(pWriter);
diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx
index 2b63937..99ef393 100644
--- a/svl/source/items/intitem.cxx
+++ b/svl/source/items/intitem.cxx
@@ -123,7 +123,7 @@ SfxPoolItem* SfxUInt16Item::CreateDefault()
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list