[Libreoffice-commits] core.git: canvas/source compilerplugins/clang cppcanvas/Library_cppcanvas.mk cppcanvas/source include/canvas include/vcl include/xmloff solenv/clang-format vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Mar 14 12:22:15 UTC 2018


 canvas/source/tools/canvastools.cxx               |   10 
 compilerplugins/clang/unusedmethods.py            |    3 
 cppcanvas/Library_cppcanvas.mk                    |    1 
 cppcanvas/source/inc/canvasgraphichelper.hxx      |    1 
 cppcanvas/source/wrapper/implcanvas.cxx           |    1 
 cppcanvas/source/wrapper/implfont.cxx             |   62 -----
 cppcanvas/source/wrapper/implfont.hxx             |   58 -----
 include/canvas/base/bufferedgraphicdevicebase.hxx |    5 
 include/canvas/base/canvascustomspritehelper.hxx  |   55 ----
 include/canvas/canvastools.hxx                    |    3 
 include/canvas/spriteredrawmanager.hxx            |    8 
 include/vcl/BitmapTools.hxx                       |    7 
 include/xmloff/xmlimp.hxx                         |    4 
 solenv/clang-format/blacklist                     |    1 
 vcl/source/bitmap/BitmapTools.cxx                 |  245 ----------------------
 15 files changed, 464 deletions(-)

New commits:
commit 1b61d0417bf46896ef1f1bd1e1a8209588fc157a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Mar 14 08:54:55 2018 +0200

    loplugin:unusedmethods
    
    Change-Id: I7c780be3e2740fd9b03c39ebe16935d61caf4f7e
    Reviewed-on: https://gerrit.libreoffice.org/51257
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index 10d109f5a52c..d7a4ca991517 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -888,16 +888,6 @@ namespace canvas
             return aLayout;
         }
 
-        ::Color stdIntSequenceToColor( const uno::Sequence<sal_Int8>& rColor )
-        {
-#ifdef OSL_BIGENDIAN
-            const sal_Int8* pCols( rColor.getConstArray() );
-            return ::Color( pCols[3], pCols[0], pCols[1], pCols[2] );
-#else
-            return ::Color( *reinterpret_cast< const ::sal_uInt32* >(rColor.getConstArray()) );
-#endif
-        }
-
         uno::Sequence<sal_Int8> colorToStdIntSequence( const ::Color& rColor )
         {
             uno::Sequence<sal_Int8> aRet(4);
diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py
index 1c080b64dd45..68f2fba6bed8 100755
--- a/compilerplugins/clang/unusedmethods.py
+++ b/compilerplugins/clang/unusedmethods.py
@@ -133,9 +133,6 @@ for d in definitionSet:
     # alone if the other one is in use.
     if d[1] == "begin() const" or d[1] == "begin()" or d[1] == "end()" or d[1] == "end() const":
         continue
-    # There is lots of macro magic going on in SRCDIR/include/sax/fshelper.hxx that should be using C++11 varargs templates
-    if d[1].startswith("sax_fastparser::FastSerializerHelper::"):
-       continue
     # used by Windows build
     if any(x in d[1] for x in ["DdeTopic::", "DdeData::", "DdeService::", "DdeTransaction::", "DdeConnection::", "DdeLink::", "DdeItem::", "DdeGetPutItem::"]):
        continue
diff --git a/cppcanvas/Library_cppcanvas.mk b/cppcanvas/Library_cppcanvas.mk
index d60c75606fb3..f0b72ca4ce15 100644
--- a/cppcanvas/Library_cppcanvas.mk
+++ b/cppcanvas/Library_cppcanvas.mk
@@ -72,7 +72,6 @@ $(eval $(call gb_Library_add_exception_objects,cppcanvas,\
 	cppcanvas/source/wrapper/implbitmapcanvas \
 	cppcanvas/source/wrapper/implcanvas \
 	cppcanvas/source/wrapper/implcustomsprite \
-	cppcanvas/source/wrapper/implfont \
 	cppcanvas/source/wrapper/implpolypolygon \
 	cppcanvas/source/wrapper/implsprite \
 	cppcanvas/source/wrapper/implspritecanvas \
diff --git a/cppcanvas/source/inc/canvasgraphichelper.hxx b/cppcanvas/source/inc/canvasgraphichelper.hxx
index 6a091d78895a..96daa1a74b9f 100644
--- a/cppcanvas/source/inc/canvasgraphichelper.hxx
+++ b/cppcanvas/source/inc/canvasgraphichelper.hxx
@@ -56,7 +56,6 @@ namespace cppcanvas
             // for our clients
             // ===============
             const CanvasSharedPtr&                                               getCanvas() const {  return mpCanvas; }
-            const css::uno::Reference< css::rendering::XGraphicDevice >&         getGraphicDevice() const {  return mxGraphicDevice; }
             const css::rendering::RenderState&                                   getRenderState() const;
 
         private:
diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx
index 68a4cb28750c..d5adeb5a0257 100644
--- a/cppcanvas/source/wrapper/implcanvas.cxx
+++ b/cppcanvas/source/wrapper/implcanvas.cxx
@@ -28,7 +28,6 @@
 #include <canvas/canvastools.hxx>
 #include <cppcanvas/polypolygon.hxx>
 
-#include "implfont.hxx"
 #include "implcanvas.hxx"
 
 
diff --git a/cppcanvas/source/wrapper/implfont.cxx b/cppcanvas/source/wrapper/implfont.cxx
deleted file mode 100644
index 9cb52095129a..000000000000
--- a/cppcanvas/source/wrapper/implfont.cxx
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- 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 "implfont.hxx"
-#include <canvas/canvastools.hxx>
-
-
-using namespace ::com::sun::star;
-
-/* Definition of Font class */
-
-namespace cppcanvas
-{
-    namespace internal
-    {
-
-        ImplFont::ImplFont( const uno::Reference< rendering::XCanvas >& rCanvas,
-                            const OUString& rFontName,
-                            const double& rCellSize ) :
-            mxCanvas( rCanvas ),
-            mxFont( nullptr )
-        {
-            OSL_ENSURE( mxCanvas.is(), "ImplFont::ImplFont(): Invalid Canvas" );
-
-            rendering::FontRequest aFontRequest;
-            aFontRequest.FontDescription.FamilyName = rFontName;
-            aFontRequest.CellSize = rCellSize;
-
-            geometry::Matrix2D aFontMatrix;
-            ::canvas::tools::setIdentityMatrix2D( aFontMatrix );
-
-            mxFont = mxCanvas->createFont( aFontRequest,
-                                           uno::Sequence< beans::PropertyValue >(),
-                                           aFontMatrix );
-        }
-
-
-        ImplFont::~ImplFont()
-        {
-        }
-
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppcanvas/source/wrapper/implfont.hxx b/cppcanvas/source/wrapper/implfont.hxx
deleted file mode 100644
index fb4ccca64077..000000000000
--- a/cppcanvas/source/wrapper/implfont.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- 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 .
- */
-
-#ifndef INCLUDED_CPPCANVAS_SOURCE_WRAPPER_IMPLFONT_HXX
-#define INCLUDED_CPPCANVAS_SOURCE_WRAPPER_IMPLFONT_HXX
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/rendering/XCanvas.hpp>
-#include <cppcanvas/font.hxx>
-
-namespace com { namespace sun { namespace star { namespace rendering
-{
-    class  XCanvasFont;
-} } } }
-
-/* Definition of Font class */
-
-namespace cppcanvas
-{
-
-    namespace internal
-    {
-
-        class ImplFont : public Font
-        {
-        public:
-            ImplFont( const css::uno::Reference< css::rendering::XCanvas >& rCanvas,
-                      const OUString& rFontName,
-                      const double& rCellSize );
-
-            virtual ~ImplFont() override;
-
-        private:
-            css::uno::Reference< css::rendering::XCanvas >        mxCanvas;
-            css::uno::Reference< css::rendering::XCanvasFont >    mxFont;
-        };
-    }
-}
-
-#endif // INCLUDED_CPPCANVAS_SOURCE_WRAPPER_IMPLFONT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/bufferedgraphicdevicebase.hxx b/include/canvas/base/bufferedgraphicdevicebase.hxx
index 3bd94f7862a8..235091f76798 100644
--- a/include/canvas/base/bufferedgraphicdevicebase.hxx
+++ b/include/canvas/base/bufferedgraphicdevicebase.hxx
@@ -155,11 +155,6 @@ namespace canvas
             }
         }
 
-        const css::uno::Reference< css::awt::XWindow2 >& getWindow() const
-        {
-            return mxWindow;
-        }
-
         css::uno::Any getXWindow() const
         {
             return css::uno::makeAny(mxWindow);
diff --git a/include/canvas/base/canvascustomspritehelper.hxx b/include/canvas/base/canvascustomspritehelper.hxx
index f44f5213b1e7..3f55ef672d7c 100644
--- a/include/canvas/base/canvascustomspritehelper.hxx
+++ b/include/canvas/base/canvascustomspritehelper.hxx
@@ -115,23 +115,8 @@ namespace canvas
         bool isContentFullyOpaque() const { return mbIsContentFullyOpaque; }
 
         /// Returns true, if transformation has changed since last transformUpdated() call
-        bool hasAlphaChanged() const { return mbAlphaDirty; }
-
-        /// Returns true, if transformation has changed since last transformUpdated() call
-        bool hasPositionChanged() const { return mbPositionDirty; }
-
-        /// Returns true, if transformation has changed since last transformUpdated() call
         bool hasTransformChanged() const { return mbTransformDirty; }
 
-        /// Returns true, if transformation has changed since last transformUpdated() call
-        bool hasClipChanged() const { return mbClipDirty; }
-
-        /// Returns true, if transformation has changed since last transformUpdated() call
-        bool hasPrioChanged() const { return mbPrioDirty; }
-
-        /// Returns true, if transformation has changed since last transformUpdated() call
-        bool hasVisibilityChanged() const { return mbVisibilityDirty; }
-
         /// Retrieve current alpha value
         double getAlpha() const { return mfAlpha; }
 
@@ -145,22 +130,6 @@ namespace canvas
         bool isActive() const { return mbActive; }
 
     protected:
-        /** Notifies that caller is again in sync with current alpha
-
-            const, but modifies state visible to derived
-            classes. beware of passing this information to the
-            outside!
-         */
-        void alphaUpdated() const { mbAlphaDirty=false; }
-
-        /** Notifies that caller is again in sync with current position
-
-            const, but modifies state visible to derived
-            classes. beware of passing this information to the
-            outside!
-         */
-        void positionUpdated() const { mbPositionDirty=false; }
-
         /** Notifies that caller is again in sync with current transformation
 
             const, but modifies state visible to derived
@@ -169,30 +138,6 @@ namespace canvas
          */
         void transformUpdated() const { mbTransformDirty=false; }
 
-        /** Notifies that caller is again in sync with current clip
-
-            const, but modifies state visible to derived
-            classes. beware of passing this information to the
-            outside!
-         */
-        void clipUpdated() const { mbClipDirty=false; }
-
-        /** Notifies that caller is again in sync with current priority
-
-            const, but modifies state visible to derived
-            classes. beware of passing this information to the
-            outside!
-         */
-        void prioUpdated() const { mbPrioDirty=false; }
-
-        /** Notifies that caller is again in sync with current visibility
-
-            const, but modifies state visible to derived
-            classes. beware of passing this information to the
-            outside!
-         */
-        void visibilityUpdated() const { mbVisibilityDirty=false; }
-
     private:
         CanvasCustomSpriteHelper( const CanvasCustomSpriteHelper& ) = delete;
         CanvasCustomSpriteHelper& operator=( const CanvasCustomSpriteHelper& ) = delete;
diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx
index c21465d13496..9de0ac6ebd7a 100644
--- a/include/canvas/canvastools.hxx
+++ b/include/canvas/canvastools.hxx
@@ -348,9 +348,6 @@ namespace canvas
             const css::geometry::IntegerSize2D& rBitmapSize );
 
         /// Convert standard 8888 RGBA color to vcl color
-        CANVASTOOLS_DLLPUBLIC ::Color stdIntSequenceToColor( const css::uno::Sequence<sal_Int8>& rColor );
-
-        /// Convert standard 8888 RGBA color to vcl color
         CANVASTOOLS_DLLPUBLIC css::uno::Sequence<sal_Int8> colorToStdIntSequence( const ::Color& rColor );
 
         // Modelled closely after boost::numeric_cast, only that we
diff --git a/include/canvas/spriteredrawmanager.hxx b/include/canvas/spriteredrawmanager.hxx
index 4e0d2ba872e2..edb10e9abfc7 100644
--- a/include/canvas/spriteredrawmanager.hxx
+++ b/include/canvas/spriteredrawmanager.hxx
@@ -144,14 +144,6 @@ namespace canvas
         {
             enum class ChangeType { none=0, move, update };
 
-            SpriteChangeRecord() :
-                meChangeType( ChangeType::none ),
-                mpAffectedSprite(),
-                maOldPos(),
-                maUpdateArea()
-            {
-            }
-
             SpriteChangeRecord( const Sprite::Reference&    rSprite,
                                 const ::basegfx::B2DPoint&  rOldPos,
                                 const ::basegfx::B2DPoint&  rNewPos,
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index 1263157b932c..d7525869320f 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -87,13 +87,6 @@ BitmapEx VCL_DLLPUBLIC CreateFromData( RawBitmap && data );
 VCL_DLLPUBLIC BitmapEx* CreateFromCairoSurface(Size size, cairo_surface_t* pSurface);
 #endif
 
-VCL_DLLPUBLIC BitmapEx CanvasBitmapHelperSetPixel( const css::uno::Sequence< sal_Int8 >& color,
-                                                   const css::geometry::IntegerPoint2D&  pos,
-                                                   BitmapEx & rBitmapEx );
-VCL_DLLPUBLIC BitmapEx CanvasBitmapHelperSetData( const css::uno::Sequence< sal_Int8 >&      data,
-                                                  const css::geometry::IntegerRectangle2D&   rect,
-                                                  BitmapEx & rBitmapEx);
-
 VCL_DLLPUBLIC BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap,
                                   const ::basegfx::B2DHomMatrix&  rTransform,
                                   ::basegfx::B2DRectangle const & rDestRect,
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 926a44d08f59..364411681aa8 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -402,10 +402,6 @@ public:
     css::uno::Reference<css::graphic::XGraphic> loadGraphicByURL(OUString const & rURL);
     css::uno::Reference<css::graphic::XGraphic> loadGraphicFromBase64(css::uno::Reference<css::io::XOutputStream> const & rxOutputStream);
 
-    // Convert a local package URL into either a graphic manager or a
-    // internal package URL. The later one happens only if bLoadURL is true
-    OUString ResolveGraphicObjectURL( const OUString& rURL, bool bLoadOnDemand );
-
     css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64();
 
     bool IsPackageURL( const OUString& rURL ) const;
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 2dfa7aec31eb..0242ab5a9866 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -2678,7 +2678,6 @@ cppcanvas/source/wrapper/implcanvas.hxx
 cppcanvas/source/wrapper/implcustomsprite.cxx
 cppcanvas/source/wrapper/implcustomsprite.hxx
 cppcanvas/source/wrapper/implfont.cxx
-cppcanvas/source/wrapper/implfont.hxx
 cppcanvas/source/wrapper/implpolypolygon.cxx
 cppcanvas/source/wrapper/implpolypolygon.hxx
 cppcanvas/source/wrapper/implsprite.cxx
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index b9e0b77fd641..6e1ed624a049 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -300,251 +300,6 @@ BitmapEx* CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface)
 }
 #endif
 
-BitmapEx CanvasBitmapHelperSetPixel( const uno::Sequence< sal_Int8 >&      color,
-                                     const geometry::IntegerPoint2D&       pos,
-                                     BitmapEx & rBitmapEx )
-{
-    // retrieve local copies from the BitmapEx, which are later
-    // stored back. Unfortunately, the BitmapEx does not permit
-    // in-place modifications, as they are necessary here.
-    Bitmap aBitmap( rBitmapEx.GetBitmap() );
-    Bitmap aAlpha( rBitmapEx.GetAlpha().GetBitmap() );
-
-    {
-        Bitmap::ScopedWriteAccess pWriteAccess( aBitmap );
-        Bitmap::ScopedWriteAccess pAlphaWriteAccess( aAlpha.IsEmpty() ?
-                                                   nullptr : aAlpha.AcquireWriteAccess(),
-                                                   aAlpha );
-
-        ENSURE_OR_THROW( pWriteAccess.get() != nullptr,
-                         "Could not acquire write access to bitmap" );
-
-        pWriteAccess->SetPixel( pos.Y, pos.X, BitmapColor( color[ 0 ],
-                                                           color[ 1 ],
-                                                           color[ 2 ] ) );
-
-        if( pAlphaWriteAccess.get() != nullptr )
-            pAlphaWriteAccess->SetPixel( pos.Y, pos.X, BitmapColor( 255 - color[ 3 ] ) );
-    }
-
-    if( aAlpha.IsEmpty() )
-        return BitmapEx( aBitmap );
-    else
-        return BitmapEx( aBitmap, AlphaMask( aAlpha ) );
-}
-
-BitmapEx CanvasBitmapHelperSetData( const uno::Sequence< sal_Int8 >&      data,
-                                    const geometry::IntegerRectangle2D&   rect,
-                                    BitmapEx & rBitmapEx)
-{
-    Bitmap aBitmap( rBitmapEx.GetBitmap() );
-    Bitmap aAlpha( rBitmapEx.GetAlpha().GetBitmap() );
-
-    {
-        Bitmap::ScopedWriteAccess pWriteAccess( aBitmap );
-        Bitmap::ScopedWriteAccess pAlphaWriteAccess( aAlpha.IsEmpty() ?
-                                                   nullptr : aAlpha.AcquireWriteAccess(),
-                                                   aAlpha );
-
-        if( pAlphaWriteAccess.get() )
-        {
-            DBG_ASSERT( pAlphaWriteAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal ||
-                        pAlphaWriteAccess->GetScanlineFormat() == ScanlineFormat::N8BitTcMask,
-                        "non-8bit alpha not supported!" );
-        }
-
-        ENSURE_OR_THROW( pWriteAccess.get() != nullptr,
-                         "Could not acquire write access to bitmap" );
-
-        // TODO(F1): Support more formats.
-        const Size aBmpSize( aBitmap.GetSizePixel() );
-
-        // for the time being, always read as BGRA
-        int nCurrPos(0);
-        for( long y=rect.Y1;
-             y<aBmpSize.Height() && y<rect.Y2;
-             ++y )
-        {
-            if( pAlphaWriteAccess.get() != nullptr )
-            {
-                switch( pWriteAccess->GetScanlineFormat() )
-                {
-                    case ScanlineFormat::N8BitPal:
-                    {
-                        Scanline pScan  = pWriteAccess->GetScanline( y );
-                        Scanline pAScan = pAlphaWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            *pScan++ = static_cast<sal_uInt8>(pWriteAccess->GetBestPaletteIndex(
-                                BitmapColor( data[ nCurrPos   ],
-                                             data[ nCurrPos+1 ],
-                                             data[ nCurrPos+2 ] ) ));
-
-                            nCurrPos += 3;
-
-                            // cast to unsigned byte, for correct subtraction result
-                            *pAScan++ = static_cast<sal_uInt8>(255 -
-                                                          static_cast<sal_uInt8>(data[ nCurrPos++ ]));
-                        }
-                    }
-                    break;
-
-                    case ScanlineFormat::N24BitTcBgr:
-                    {
-                        Scanline pScan  = pWriteAccess->GetScanline( y );
-                        Scanline pAScan = pAlphaWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            *pScan++ = data[ nCurrPos+2 ];
-                            *pScan++ = data[ nCurrPos+1 ];
-                            *pScan++ = data[ nCurrPos   ];
-
-                            nCurrPos += 3;
-
-                            // cast to unsigned byte, for correct subtraction result
-                            *pAScan++ = static_cast<sal_uInt8>(255 -
-                                                          static_cast<sal_uInt8>(data[ nCurrPos++ ]));
-                        }
-                    }
-                    break;
-
-                    case ScanlineFormat::N24BitTcRgb:
-                    {
-                        Scanline pScan  = pWriteAccess->GetScanline( y );
-                        Scanline pAScan = pAlphaWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            *pScan++ = data[ nCurrPos   ];
-                            *pScan++ = data[ nCurrPos+1 ];
-                            *pScan++ = data[ nCurrPos+2 ];
-
-                            nCurrPos += 3;
-
-                            // cast to unsigned byte, for correct subtraction result
-                            *pAScan++ = static_cast<sal_uInt8>(255 -
-                                                          static_cast<sal_uInt8>(data[ nCurrPos++ ]));
-                        }
-                    }
-                    break;
-
-                    default:
-                    {
-                        Scanline pScan  = pWriteAccess->GetScanline( y );
-                        Scanline pAScan = pAlphaWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            pWriteAccess->SetPixelOnData( pScan, x, BitmapColor( data[ nCurrPos   ],
-                                                                       data[ nCurrPos+1 ],
-                                                                       data[ nCurrPos+2 ] ) );
-                            nCurrPos += 3;
-
-                            // cast to unsigned byte, for correct subtraction result
-                            pAlphaWriteAccess->SetPixelOnData( pAScan, x,
-                                                         BitmapColor(
-                                                             static_cast<sal_uInt8>(255 -
-                                                                               static_cast<sal_uInt8>(data[ nCurrPos++ ])) ) );
-                        }
-                    }
-                    break;
-                }
-            }
-            else
-            {
-                // TODO(Q3): This is copy'n'pasted from
-                // canvashelper.cxx, unify!
-                switch( pWriteAccess->GetScanlineFormat() )
-                {
-                    case ScanlineFormat::N8BitPal:
-                    {
-                        Scanline pScan = pWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            *pScan++ = static_cast<sal_uInt8>(pWriteAccess->GetBestPaletteIndex(
-                                BitmapColor( data[ nCurrPos   ],
-                                             data[ nCurrPos+1 ],
-                                             data[ nCurrPos+2 ] ) ));
-
-                            nCurrPos += 4; // skip three colors, _plus_ alpha
-                        }
-                    }
-                    break;
-
-                    case ScanlineFormat::N24BitTcBgr:
-                    {
-                        Scanline pScan = pWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            *pScan++ = data[ nCurrPos+2 ];
-                            *pScan++ = data[ nCurrPos+1 ];
-                            *pScan++ = data[ nCurrPos   ];
-
-                            nCurrPos += 4; // skip three colors, _plus_ alpha
-                        }
-                    }
-                    break;
-
-                    case ScanlineFormat::N24BitTcRgb:
-                    {
-                        Scanline pScan = pWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            *pScan++ = data[ nCurrPos   ];
-                            *pScan++ = data[ nCurrPos+1 ];
-                            *pScan++ = data[ nCurrPos+2 ];
-
-                            nCurrPos += 4; // skip three colors, _plus_ alpha
-                        }
-                    }
-                    break;
-
-                    default:
-                    {
-                        Scanline pScan = pWriteAccess->GetScanline( y );
-
-                        for( long x=rect.X1;
-                             x<aBmpSize.Width() && x<rect.X2;
-                             ++x )
-                        {
-                            pWriteAccess->SetPixelOnData( pScan, x, BitmapColor( data[ nCurrPos   ],
-                                                                       data[ nCurrPos+1 ],
-                                                                       data[ nCurrPos+2 ] ) );
-                            nCurrPos += 4; // skip three colors, _plus_ alpha
-                        }
-                    }
-                    break;
-                }
-            }
-        }
-    }
-
-    if( aAlpha.IsEmpty() )
-        return BitmapEx( aBitmap );
-    else
-        return BitmapEx( aBitmap, AlphaMask( aAlpha ) );
-}
-
-
 BitmapEx CanvasTransformBitmap( const BitmapEx&                 rBitmap,
                                 const ::basegfx::B2DHomMatrix&  rTransform,
                                 ::basegfx::B2DRectangle const & rDestRect,


More information about the Libreoffice-commits mailing list