[Libreoffice-commits] core.git: Branch 'feature/gtkbmptiledviewer2' - 5 commits - desktop/Executable_gtktiledviewer.mk desktop/qa include/LibreOfficeKit include/vcl libreofficekit/Library_libreofficekitgtk.mk libreofficekit/Module_libreofficekit.mk libreofficekit/source Repository.mk vcl/headless vcl/source

Andrzej Hunt andrzej.hunt at collabora.com
Thu Jun 12 09:39:14 PDT 2014


 Repository.mk                                |    1 
 desktop/Executable_gtktiledviewer.mk         |    4 
 desktop/qa/gtktiledviewer/gtktiledviewer.cxx |   92 +-------------------
 include/LibreOfficeKit/LibreOfficeKitGtk.h   |   60 +++++++++++++
 include/vcl/salbtype.hxx                     |   29 ++++--
 libreofficekit/Library_libreofficekitgtk.mk  |   31 ++++++
 libreofficekit/Module_libreofficekit.mk      |    1 
 libreofficekit/source/gtk/lokdocview.c       |  120 +++++++++++++++++++++++++++
 vcl/headless/svpbmp.cxx                      |   16 +--
 vcl/source/gdi/bmpacc2.cxx                   |    8 -
 10 files changed, 255 insertions(+), 107 deletions(-)

New commits:
commit ca273ddc09ff634ab9cbfe176b9876a3745a2a0e
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jun 12 17:38:27 2014 +0100

    Upgrade gtktiledviewer to use the LOK viewer widget.
    
    Change-Id: Ied397f617d1cad1f3bd095e8af1ffa741916ecca

diff --git a/desktop/Executable_gtktiledviewer.mk b/desktop/Executable_gtktiledviewer.mk
index 6295f5e..a0bf8ea 100644
--- a/desktop/Executable_gtktiledviewer.mk
+++ b/desktop/Executable_gtktiledviewer.mk
@@ -18,6 +18,10 @@ $(eval $(call gb_Executable_use_externals,gtktiledviewer,\
     gtk \
 ))
 
+$(eval $(call gb_Executable_use_libraries,gtktiledviewer,\
+    libreofficekitgtk \
+))
+
 $(eval $(call gb_Executable_use_static_libraries,gtktiledviewer,\
     libreofficekit \
 ))
diff --git a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
index d8781b2..c0a9b9f 100644
--- a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -13,10 +13,7 @@
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
-#define LOK_USE_UNSTABLE_API
-#include <LibreOfficeKit/LibreOfficeKit.hxx>
-
-using namespace ::lok;
+#include <LibreOfficeKit/LibreOfficeKitGtk.h>
 
 static int help()
 {
@@ -24,56 +21,6 @@ static int help()
     return 1;
 }
 
-static GtkWidget* ourCanvas;
-static GdkPixbuf* ourPixBuf = 0;
-
-bool drawCallback(GtkWidget* /* The eventbox */, void* /* cairo_t* cr */, gpointer pData)
-{
-    fprintf(stderr, "attempting to draw tile");
-
-    Document* pDocument = static_cast< Document* >( pData );
-
-    long nWidth, nHeight;
-    pDocument->getDocumentSize( &nWidth, &nHeight );
-
-    // Draw the whole document at once (for now)
-    int nRenderWidth = nWidth / 10;
-    int nRenderHeight = nHeight / 10;
-    int nRowStride;
-
-    if ( ourPixBuf &&
-            (gdk_pixbuf_get_width( ourPixBuf ) != nRenderWidth ||
-             gdk_pixbuf_get_height( ourPixBuf ) != nRenderHeight ) )
-    {
-        g_object_unref( G_OBJECT( ourPixBuf ) );
-        ourPixBuf = 0;
-
-    }
-    if (!ourPixBuf)
-    {
-        ourPixBuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB,
-                                    true, 8,
-                                    nRenderWidth, nRenderHeight);
-    }
-
-    unsigned char* pBuffer = gdk_pixbuf_get_pixels( ourPixBuf );
-
-    pDocument->paintTile( pBuffer,
-                          nRenderWidth, nRenderHeight,
-                          &nRowStride,
-                          0, 0, // origin
-                          nWidth, nHeight );
-    // TODO: double check that the rowstride really matches what we expected,
-    // although presumably we'd already be crashing by now if things were
-    // wrong.
-    (void) nRowStride;
-
-    gtk_image_set_from_pixbuf( GTK_IMAGE( ourCanvas ), ourPixBuf );
-
-    return true;
-
-}
-
 int main( int argc, char* argv[] )
 {
     if( argc < 2 ||
@@ -86,7 +33,7 @@ int main( int argc, char* argv[] )
         return 1;
     }
 
-    ::lok::Office *pOffice = ::lok::lok_cpp_init( argv[1] );
+    LibreOfficeKit* pOffice = lok_init( argv[1] );
     if( !pOffice )
     {
         fprintf( stderr, "Failed to initialize\n" );
@@ -94,14 +41,12 @@ int main( int argc, char* argv[] )
     }
 
     // "This separate init is lame I think."
-    if( !pOffice->initialize( argv[1] ) )
+    if( !pOffice->initialize( pOffice, argv[1] ) )
     {
         fprintf( stderr, "failed to initialize\n" );
         return -1;
     }
 
-    ::lok::Document* pDocument = pOffice->documentLoad( argv[2] );
-
     gtk_init( &argc, &argv );
 
     GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
@@ -110,25 +55,14 @@ int main( int argc, char* argv[] )
     g_signal_connect( pWindow, "destroy", G_CALLBACK(gtk_main_quit), NULL );
 
 
-    GtkWidget* pScroller = gtk_scrolled_window_new( 0, 0 );
-    gtk_container_add( GTK_CONTAINER(pWindow), pScroller );
-
-    GtkWidget* pEventBox = gtk_event_box_new();
-    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pScroller), pEventBox );
+    GtkWidget* pDocView = lok_docview_new( pOffice );
+    gtk_container_add( GTK_CONTAINER(pWindow), pDocView );
 
-    GtkWidget* pCanvas = gtk_image_new();
-    ourCanvas = pCanvas;
-    gtk_container_add( GTK_CONTAINER( pEventBox ), pCanvas );
+    lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] );
 
-    g_signal_connect( G_OBJECT(pEventBox), "button-press-event", G_CALLBACK(drawCallback), pDocument);
-
-    gtk_widget_show( pCanvas );
-    gtk_widget_show( pEventBox );
-    gtk_widget_show( pScroller );
+    gtk_widget_show( pDocView );
     gtk_widget_show( pWindow );
 
-    drawCallback( pCanvas, 0, pDocument );
-
     gtk_main();
 
     return 0;
commit 360205f82056187e0a9acc261318f58e257c95a1
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jun 12 17:38:10 2014 +0100

    Implement LibreOfficeKit gtk+ viewer widget.
    
    Very basic, but works.
    
    Change-Id: I0c521e833b53e13065e0be48e6fa767e44b29787

diff --git a/Repository.mk b/Repository.mk
index de81657..74e9fcc 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -531,6 +531,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_OOO,ooo, \
 	i18nlangtag \
 	i18nutil \
 	index_data \
+	$(if $(and $(ENABLE_GTK), $(filter LINUX,$(OS))), libreofficekitgtk) \
 	localedata_en \
 	localedata_es \
 	localedata_euro \
diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
new file mode 100644
index 0000000..2435fc2
--- /dev/null
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -0,0 +1,60 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_DESKTOP_INC_LIBREOFFICEKITGTK_H
+#define INCLUDED_DESKTOP_INC_LIBREOFFICEKITGTK_H
+
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKit.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define LOK_DOCVIEW(obj)          GTK_CHECK_CAST (obj, lok_docview_get_type(), LOKDocView)
+#define LOK_DOCVIEW_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, lok_docview_get_type(), LOKDocViewClass)
+#define IS_LOK_DOCVIEW(obj)       GTK_CHECK_TYPE (obj, lok_docview_get_type())
+
+
+typedef struct _LOKDocView       LOKDocView;
+typedef struct _LOKDocViewClass  LOKDocViewClass;
+
+struct _LOKDocView
+{
+    GtkScrolledWindow scrollWindow;
+
+    GtkWidget* pEventBox;
+    GtkWidget* pCanvas;
+    GdkPixbuf* pPixBuf;
+
+    LibreOfficeKit* pOffice;
+    LibreOfficeKitDocument* pDocument;
+};
+
+struct _LOKDocViewClass
+{
+  GtkScrolledWindowClass parent_class;
+
+  void (*lok_docview) (LOKDocView* pDocView);
+};
+
+guint           lok_docview_get_type        (void);
+GtkWidget*      lok_docview_new             ( LibreOfficeKit* pOffice );
+gboolean        lok_docview_open_document   (LOKDocView* pDocView,
+                                             char* pPath);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk
new file mode 100644
index 0000000..be485cd
--- /dev/null
+++ b/libreofficekit/Library_libreofficekitgtk.mk
@@ -0,0 +1,31 @@
+# -*- 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_Library_Library,libreofficekitgtk))
+
+
+$(eval $(call gb_Library_use_externals,libreofficekitgtk,\
+    gtk \
+))
+
+$(eval $(call gb_Library_use_static_libraries,libreofficekitgtk,\
+    libreofficekit \
+))
+
+$(eval $(call gb_Library_add_cobjects,libreofficekitgtk,\
+    libreofficekit/source/gtk/lokdocview \
+))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_libs,libreofficekitgtk,\
+    -ldl \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk
index d78a9c3..d19c74a 100644
--- a/libreofficekit/Module_libreofficekit.mk
+++ b/libreofficekit/Module_libreofficekit.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_Module_Module,libreofficekit))
 ifeq ($(OS),LINUX)
 $(eval $(call gb_Module_add_targets,libreofficekit,\
     Library_libreofficekit \
+    Library_libreofficekitgtk \
 ))
 endif
 
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
new file mode 100644
index 0000000..47967fc
--- /dev/null
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -0,0 +1,120 @@
+/* -*- 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 <sal/types.h>
+
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKit.h>
+
+#include <LibreOfficeKit/LibreOfficeKitGtk.h>
+
+static void lok_docview_class_init( LOKDocViewClass* pClass );
+static void lok_docview_init( LOKDocView* pDocView );
+
+SAL_DLLPUBLIC_EXPORT guint lok_docview_get_type()
+{
+    static guint lok_docview_type = 0;
+
+    if (!lok_docview_type)
+    {
+        GtkTypeInfo lok_docview_info =
+        {
+            "LokDocView",
+            sizeof( LOKDocView ),
+            sizeof( LOKDocViewClass ),
+            (GtkClassInitFunc) lok_docview_class_init,
+            (GtkObjectInitFunc) lok_docview_init,
+            NULL,
+            NULL,
+            (GtkClassInitFunc) NULL
+        };
+
+        lok_docview_type = gtk_type_unique( gtk_scrolled_window_get_type(), &lok_docview_info );
+    }
+    return lok_docview_type;
+}
+
+static void lok_docview_class_init( LOKDocViewClass* pClass )
+{
+    pClass->lok_docview = NULL;
+}
+
+static void lok_docview_init( LOKDocView* pDocView )
+{
+    pDocView->pEventBox = gtk_event_box_new();
+    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(pDocView),
+                                           pDocView->pEventBox );
+
+    pDocView->pCanvas = gtk_image_new();
+    gtk_container_add( GTK_CONTAINER( pDocView->pEventBox ), pDocView->pCanvas );
+
+    gtk_widget_show( pDocView->pCanvas );
+    gtk_widget_show( pDocView->pEventBox );
+
+    pDocView->pPixBuf = 0;
+
+    // TODO: figure out a clever view of getting paths set up.
+    pDocView->pOffice = 0;
+    pDocView->pDocument = 0;
+}
+
+SAL_DLLPUBLIC_EXPORT GtkWidget* lok_docview_new( LibreOfficeKit* pOffice )
+{
+    LOKDocView* pDocView = gtk_type_new( lok_docview_get_type() );
+    pDocView->pOffice = pOffice;
+    return GTK_WIDGET( pDocView );
+}
+
+SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, char* pPath )
+{
+    if ( pDocView->pDocument )
+    {
+        pDocView->pDocument->destroy( pDocView->pDocument );
+        pDocView->pDocument = 0;
+    }
+
+    pDocView->pDocument = pDocView->pOffice->documentLoad( pDocView->pOffice,
+                                                           pPath );
+    if ( pDocView->pPixBuf )
+    {
+        g_object_unref( G_OBJECT( pDocView->pPixBuf ) );
+    }
+
+    long nWidth, nHeight;
+    pDocView->pDocument->getDocumentSize( pDocView->pDocument, &nWidth, &nHeight );
+
+    // Draw the whole document at once (for now)
+    int nRenderWidth = nWidth / 10;
+    int nRenderHeight = nHeight / 10;
+
+    pDocView->pPixBuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB,
+                                        TRUE, 8,
+                                        nRenderWidth, nRenderHeight);
+
+
+    // TODO: move the rendering into it's own function etc.
+    unsigned char* pBuffer = gdk_pixbuf_get_pixels( pDocView->pPixBuf );
+    int nRowStride;
+    pDocView->pDocument->paintTile( pDocView->pDocument,
+                                    pBuffer,
+                                    nRenderWidth, nRenderHeight,
+                                    &nRowStride,
+                                    0, 0, // origin
+                                    nWidth, nHeight );
+    // TODO: double check that the rowstride really matches what we expected,
+    // although presumably we'd already be crashing by now if things were
+    // wrong.
+    (void) nRowStride;
+
+    gtk_image_set_from_pixbuf( GTK_IMAGE( pDocView->pCanvas ), pDocView->pPixBuf );
+
+    return FALSE;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 35587174148876f01b01e8eebc96ca9cdf24a22c
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jun 12 15:14:58 2014 +0100

    Remove outdated includes.
    
    These were needed for the X11 "context" rendering which is no longer used.
    
    Change-Id: Ib60c8fff9dad06b1f8f489eed66c3b3c3597e1ee

diff --git a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
index cff237c..d8781b2 100644
--- a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -11,15 +11,8 @@
 #include <string.h>
 
 #include <gdk/gdk.h>
-#include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 
-#include <X11/extensions/Xrender.h>
-
-// Only for the SystemGraphicsData struct, and hopefully we can find some better
-// replacement for that at some point.
-#include <vcl/sysdata.hxx>
-
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKit.hxx>
 
commit b0af1c532cbafb490883ed0e3fdbae9359fb10a1
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jun 11 13:54:49 2014 +0100

    Kill gtktiledviewer's alpha channel hack.
    
    basebmp and vcl now set the alpha channel appropriately, so no need
    to do so in the viewer now.
    
    However it would perhaps make more sense to just use RGB instead
    of RGBA, seeing as the alpha channel is permanently set to be opaque.
    
    Change-Id: I86ad758c6a8bee21b265730727a76605e5850c0c

diff --git a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
index 18506a7..cff237c 100644
--- a/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/desktop/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -75,11 +75,6 @@ bool drawCallback(GtkWidget* /* The eventbox */, void* /* cairo_t* cr */, gpoint
     // wrong.
     (void) nRowStride;
 
-    for (int i = 3; i < nRowStride*nRenderHeight; i += 4)
-    {
-        pBuffer[i] = 0xFF;
-    }
-
     gtk_image_set_from_pixbuf( GTK_IMAGE( ourCanvas ), ourPixBuf );
 
     return true;
commit c1c2fc8f2a8636935a7c346ccd6789044057d6a7
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jun 11 13:39:56 2014 +0100

    Fill the alpha channel by default for vcl 32-bit bitmaps too.
    
    Otherwise the alpha channel for bitmaps created directly is empty,
    indicating a transparent bitmap (although we don't actually handle
    transparency). This complements hardcoding of the alpha channel
    in basebmp. VCL bitmaps can be copied bit-for-bit directly into
    a basebmp bitmap, hence it's important to make sure we fill the
    alpha channel in vcl too.
    
    Conflicts:
    	include/vcl/salbtype.hxx
    
    Change-Id: Icb2fa417db6625a6ffa6bd82eb5773ff75be5a3c

diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index ccdbfbe..92258c5 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -84,13 +84,14 @@ d_Col = BitmapColor( (sal_uInt8) ( _def_cR | ( ( _def_cR & mnROr ) >> mnROrShift
 
 
 
-#define COLOR_TO_MASK( d_rCol, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS ) \
+#define COLOR_TO_MASK( d_rCol, d_RM, d_GM, d_BM, d_RS, d_GS, d_BS, d_ALPHA ) \
 ( ( ( ( d_RS < 0L ) ? ( (sal_uInt32) (d_rCol).GetRed() >> -d_RS ) :     \
     ( (sal_uInt32) (d_rCol).GetRed() << d_RS ) ) & d_RM ) |             \
   ( ( ( d_GS < 0L ) ? ( (sal_uInt32) (d_rCol).GetGreen() >> -d_GS ) :   \
     ( (sal_uInt32) (d_rCol).GetGreen() << d_GS ) ) & d_GM ) |           \
   ( ( ( d_BS < 0L ) ? ( (sal_uInt32) (d_rCol).GetBlue() >> -d_BS ) :    \
-    ( (sal_uInt32) (d_rCol).GetBlue() << d_BS ) ) & d_BM ) )
+    ( (sal_uInt32) (d_rCol).GetBlue() << d_BS ) ) & d_BM ) | \
+    d_ALPHA )
 
 
 // - BitmapColor -
@@ -215,12 +216,16 @@ class VCL_DLLPUBLIC ColorMask
     sal_uLong               mnROr;
     sal_uLong               mnGOr;
     sal_uLong               mnBOr;
+    sal_uLong               mnAlphaChannel;
 
     SAL_DLLPRIVATE inline long ImplCalcMaskShift( sal_uLong nMask, sal_uLong& rOr, sal_uLong& rOrShift ) const;
 
 public:
 
-    inline              ColorMask( sal_uLong nRedMask = 0UL, sal_uLong nGreenMask = 0UL, sal_uLong nBlueMask = 0UL );
+    inline              ColorMask( sal_uLong nRedMask = 0UL,
+                                   sal_uLong nGreenMask = 0UL,
+                                   sal_uLong nBlueMask = 0UL,
+                                   sal_uLong nAlphaChannel = 0UL );
     inline              ~ColorMask() {}
 
     inline sal_uLong        GetRedMask() const;
@@ -698,7 +703,10 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
 
 
 
-inline ColorMask::ColorMask( sal_uLong nRedMask, sal_uLong nGreenMask, sal_uLong nBlueMask ) :
+inline ColorMask::ColorMask( sal_uLong nRedMask,
+                             sal_uLong nGreenMask,
+                             sal_uLong nBlueMask,
+                             sal_uLong nAlphaChannel ) :
             mnRMask( nRedMask ),
             mnGMask( nGreenMask ),
             mnBMask( nBlueMask ),
@@ -707,7 +715,8 @@ inline ColorMask::ColorMask( sal_uLong nRedMask, sal_uLong nGreenMask, sal_uLong
             mnBOrShift( 0L ),
             mnROr( 0L ),
             mnGOr( 0L ),
-            mnBOr( 0L )
+            mnBOr( 0L ),
+            mnAlphaChannel( nAlphaChannel )
 {
     mnRShift = ( mnRMask ? ImplCalcMaskShift( mnRMask, mnROr, mnROrShift ) : 0L );
     mnGShift = ( mnGMask ? ImplCalcMaskShift( mnGMask, mnGOr, mnGOrShift ) : 0L );
@@ -774,7 +783,7 @@ inline void ColorMask::GetColorFor8Bit( BitmapColor& rColor, ConstHPBYTE pPixel
 
 inline void ColorMask::SetColorFor8Bit( const BitmapColor& rColor, HPBYTE pPixel ) const
 {
-    *pPixel = (sal_uInt8) COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift );
+    *pPixel = (sal_uInt8) COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
 }
 
 
@@ -790,7 +799,7 @@ inline void ColorMask::GetColorFor16BitMSB( BitmapColor& rColor, ConstHPBYTE pPi
 
 inline void ColorMask::SetColorFor16BitMSB( const BitmapColor& rColor, HPBYTE pPixel ) const
 {
-    const sal_uInt16 nVal = (sal_uInt16)COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift );
+    const sal_uInt16 nVal = (sal_uInt16)COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
 
     pPixel[ 0 ] = (sal_uInt8)(nVal >> 8U);
     pPixel[ 1 ] = (sal_uInt8) nVal;
@@ -809,7 +818,7 @@ inline void ColorMask::GetColorFor16BitLSB( BitmapColor& rColor, ConstHPBYTE pPi
 
 inline void ColorMask::SetColorFor16BitLSB( const BitmapColor& rColor, HPBYTE pPixel ) const
 {
-    const sal_uInt16 nVal = (sal_uInt16)COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift );
+    const sal_uInt16 nVal = (sal_uInt16)COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
 
     pPixel[ 0 ] = (sal_uInt8) nVal;
     pPixel[ 1 ] = (sal_uInt8)(nVal >> 8U);
@@ -828,7 +837,7 @@ inline void ColorMask::GetColorFor24Bit( BitmapColor& rColor, ConstHPBYTE pPixel
 
 inline void ColorMask::SetColorFor24Bit( const BitmapColor& rColor, HPBYTE pPixel ) const
 {
-    const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift );
+    const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
     pPixel[ 0 ] = (sal_uInt8) nVal; pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL ); pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
 }
 
@@ -857,7 +866,7 @@ inline void ColorMask::GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8&
 
 inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, HPBYTE pPixel ) const
 {
-    const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift );
+    const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
     pPixel[ 0 ] = (sal_uInt8) nVal; pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
     pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL ); pPixel[ 3 ] = (sal_uInt8) ( nVal >> 24UL );
 }
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index 0a81fdc..3920aea 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -188,36 +188,36 @@ BitmapBuffer* SvpSalBitmap::AcquireBuffer( bool )
                 nBitCount = 32;
                 pBuf->mnFormat = BMP_FORMAT_32BIT_TC_MASK;
 #ifdef OSL_BIGENDIAN
-                pBuf->maColorMask = ColorMask( 0x0000ff00, 0x00ff0000, 0xff000000 );
+                pBuf->maColorMask = ColorMask( 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff );
 #else
-                pBuf->maColorMask = ColorMask( 0x00ff0000, 0x0000ff00, 0x000000ff );
+                pBuf->maColorMask = ColorMask( 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 );
 #endif
                 break;
             case FORMAT_THIRTYTWO_BIT_TC_MASK_ARGB:
                 nBitCount = 32;
                 pBuf->mnFormat = BMP_FORMAT_32BIT_TC_MASK;
 #ifdef OSL_BIGENDIAN
-                pBuf->maColorMask = ColorMask( 0x00ff0000, 0x0000ff00, 0x000000ff );
+                pBuf->maColorMask = ColorMask( 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 );
 #else
-                pBuf->maColorMask = ColorMask( 0x0000ff00, 0x00ff0000, 0xff000000 );
+                pBuf->maColorMask = ColorMask( 0x0000ff00, 0x00ff0000, 0xff000000, 0x000000ff );
 #endif
                 break;
             case FORMAT_THIRTYTWO_BIT_TC_MASK_ABGR:
                 nBitCount = 32;
                 pBuf->mnFormat = BMP_FORMAT_32BIT_TC_MASK;
 #ifdef OSL_BIGENDIAN
-                pBuf->maColorMask = ColorMask( 0x000000ff, 0x0000ff00, 0x00ff0000 );
+                pBuf->maColorMask = ColorMask( 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 );
 #else
-                pBuf->maColorMask = ColorMask( 0xff000000, 0x00ff0000, 0x0000ff00 );
+                pBuf->maColorMask = ColorMask( 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff );
 #endif
                 break;
             case FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA:
                 nBitCount = 32;
                 pBuf->mnFormat = BMP_FORMAT_32BIT_TC_MASK;
 #ifdef OSL_BIGENDIAN
-                pBuf->maColorMask = ColorMask( 0xff000000, 0x00ff0000, 0x0000ff00 );
+                pBuf->maColorMask = ColorMask( 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff );
 #else
-                pBuf->maColorMask = ColorMask( 0x000000ff, 0x0000ff00, 0x00ff0000 );
+                pBuf->maColorMask = ColorMask( 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 );
 #endif
                 break;
 
diff --git a/vcl/source/gdi/bmpacc2.cxx b/vcl/source/gdi/bmpacc2.cxx
index bf1d540..12b0c1d 100644
--- a/vcl/source/gdi/bmpacc2.cxx
+++ b/vcl/source/gdi/bmpacc2.cxx
@@ -179,7 +179,7 @@ IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_ABGR )
 
 IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_ABGR )
 {
-    *( pScanline = pScanline + ( nX << 2 ) )++ = 0;
+    *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
     *pScanline++ = rBitmapColor.GetBlue();
     *pScanline++ = rBitmapColor.GetGreen();
     *pScanline = rBitmapColor.GetRed();
@@ -198,7 +198,7 @@ IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_ARGB )
 
 IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_ARGB )
 {
-    *( pScanline = pScanline + ( nX << 2 ) )++ = 0;
+    *( pScanline = pScanline + ( nX << 2 ) )++ = 0xFF;
     *pScanline++ = rBitmapColor.GetRed();
     *pScanline++ = rBitmapColor.GetGreen();
     *pScanline = rBitmapColor.GetBlue();
@@ -220,7 +220,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_BGRA )
     *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetBlue();
     *pScanline++ = rBitmapColor.GetGreen();
     *pScanline++ = rBitmapColor.GetRed();
-    *pScanline = 0;
+    *pScanline = 0xFF;
 }
 
 IMPL_FORMAT_GETPIXEL_NOMASK( _32BIT_TC_RGBA )
@@ -239,7 +239,7 @@ IMPL_FORMAT_SETPIXEL_NOMASK( _32BIT_TC_RGBA )
     *( pScanline = pScanline + ( nX << 2 ) )++ = rBitmapColor.GetRed();
     *pScanline++ = rBitmapColor.GetGreen();
     *pScanline++ = rBitmapColor.GetBlue();
-    *pScanline = 0;
+    *pScanline = 0xFF;
 }
 
 IMPL_FORMAT_GETPIXEL( _32BIT_TC_MASK )


More information about the Libreoffice-commits mailing list