[Libreoffice-commits] core.git: 2 commits - include/vcl vcl/Library_vcl.mk vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Mon Apr 21 10:41:20 PDT 2014


 include/vcl/outdev.hxx        |    8 +-
 vcl/Library_vcl.mk            |    1 
 vcl/source/outdev/bitmap.cxx  |    4 -
 vcl/source/outdev/mask.cxx    |    2 
 vcl/source/outdev/outdev.cxx  |    6 -
 vcl/source/outdev/rect.cxx    |   96 +++++++++++++++++++++++++++++
 vcl/source/outdev/tworect.cxx |  137 ------------------------------------------
 7 files changed, 107 insertions(+), 147 deletions(-)

New commits:
commit 2fed8934575662d20d72facb0cccc429b830fb44
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue Apr 22 03:36:06 2014 +1000

    Make OutputDevice::DrawTransformedBitmapEx a public function
    
    Change-Id: I978ae6c5d1ece54828cab8624c20c7b6b6630c21

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 188ee97..57c32f2 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -874,7 +874,6 @@ public:
                                     long nMaxBmpDPIX,
                                     long nMaxBmpDPIY );
 
-protected:
 
     /** Draw BitmapEx transformed
 
@@ -890,6 +889,9 @@ protected:
                                     const basegfx::B2DHomMatrix& rTransformation,
                                     const BitmapEx& rBitmapEx);
 
+
+protected:
+
     /** Transform and draw a bitmap directly
 
      @param     aFullTransform      The B2DHomMatrix used for the transformation
commit 55f736a2bfda37a36ca747b1cab1333f909f6d55
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue Apr 22 03:33:26 2014 +1000

    Merge tworect.cxx with rect.cxx and rename functions
    
    Change-Id: Iad6109a353181759fa64e48a82a003f785d0e58c

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index eec9428..188ee97 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -278,8 +278,8 @@ typedef ::std::vector< VCLXGraphics* > VCLXGraphicsList_impl;
 
 const char* ImplDbgCheckOutputDevice( const void* pObj );
 
-sal_uLong ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix );
-void ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect );
+sal_uLong AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix );
+void AdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect );
 
 void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY,
                     int nOrientation );
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 8ecfb69..4d40694 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -236,7 +236,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/gdi/oldprintadaptor \
     vcl/source/outdev/outdev \
     vcl/source/outdev/clipping \
-    vcl/source/outdev/tworect \
     vcl/source/outdev/polygon \
     vcl/source/outdev/transparent \
     vcl/source/outdev/mask \
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 5ec8c7e..019fe99 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -138,7 +138,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
 
         if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
         {
-            const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, aBmp.GetSizePixel() );
+            const sal_uLong nMirrFlags = AdjustTwoRect( aPosAry, aBmp.GetSizePixel() );
 
             if ( nMirrFlags )
                 aBmp.Mirror( nMirrFlags );
@@ -660,7 +660,7 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
         aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
         aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
 
-        const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, rBmpEx.GetSizePixel() );
+        const sal_uLong nMirrFlags = AdjustTwoRect( aPosAry, rBmpEx.GetSizePixel() );
 
         if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
         {
diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx
index 20f97d3..4888c03 100644
--- a/vcl/source/outdev/mask.cxx
+++ b/vcl/source/outdev/mask.cxx
@@ -119,7 +119,7 @@ void OutputDevice::ApplyMask( const Bitmap& rMask, const Color& rMaskColor,
         aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
 
         // we don't want to mirror via cooridates
-        const sal_uLong nMirrFlags = ImplAdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() );
+        const sal_uLong nMirrFlags = AdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() );
 
         // check if output is necessary
         if( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 1658b7e..4cfbad8 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -529,7 +529,7 @@ void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect
     const Rectangle aSrcOutRect( Point( pSrcDev->mnOutOffX, pSrcDev->mnOutOffY ),
                                  Size( pSrcDev->mnOutWidth, pSrcDev->mnOutHeight ) );
 
-    ImplAdjustTwoRect( rPosAry, aSrcOutRect );
+    AdjustTwoRect( rPosAry, aSrcOutRect );
 
     if ( rPosAry.mnSrcWidth && rPosAry.mnSrcHeight && rPosAry.mnDestWidth && rPosAry.mnDestHeight )
     {
@@ -584,7 +584,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
         const Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
                                      Size( mnOutWidth, mnOutHeight ) );
 
-        ImplAdjustTwoRect( aPosAry, aSrcOutRect );
+        AdjustTwoRect( aPosAry, aSrcOutRect );
 
         if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
             mpGraphics->CopyBits( aPosAry, NULL, this, NULL );
@@ -683,7 +683,7 @@ void OutputDevice::CopyArea( const Point& rDestPt,
         const Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
                                      Size( mnOutWidth, mnOutHeight ) );
 
-        ImplAdjustTwoRect( aPosAry, aSrcOutRect );
+        AdjustTwoRect( aPosAry, aSrcOutRect );
 
         CopyAreaFinal ( aPosAry, nFlags );
     }
diff --git a/vcl/source/outdev/rect.cxx b/vcl/source/outdev/rect.cxx
index 6e26585..6977b79 100644
--- a/vcl/source/outdev/rect.cxx
+++ b/vcl/source/outdev/rect.cxx
@@ -116,3 +116,99 @@ void OutputDevice::DrawRect( const Rectangle& rRect,
     if( mpAlphaVDev )
         mpAlphaVDev->DrawRect( rRect, nHorzRound, nVertRound );
 }
+
+sal_uLong AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix )
+{
+    sal_uLong nMirrFlags = 0;
+
+    if ( rTwoRect.mnDestWidth < 0 )
+    {
+        rTwoRect.mnSrcX = rSizePix.Width() - rTwoRect.mnSrcX - rTwoRect.mnSrcWidth;
+        rTwoRect.mnDestWidth = -rTwoRect.mnDestWidth;
+        rTwoRect.mnDestX -= rTwoRect.mnDestWidth-1;
+        nMirrFlags |= BMP_MIRROR_HORZ;
+    }
+
+    if ( rTwoRect.mnDestHeight < 0 )
+    {
+        rTwoRect.mnSrcY = rSizePix.Height() - rTwoRect.mnSrcY - rTwoRect.mnSrcHeight;
+        rTwoRect.mnDestHeight = -rTwoRect.mnDestHeight;
+        rTwoRect.mnDestY -= rTwoRect.mnDestHeight-1;
+        nMirrFlags |= BMP_MIRROR_VERT;
+    }
+
+    if( ( rTwoRect.mnSrcX < 0 ) || ( rTwoRect.mnSrcX >= rSizePix.Width() ) ||
+        ( rTwoRect.mnSrcY < 0 ) || ( rTwoRect.mnSrcY >= rSizePix.Height() ) ||
+        ( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) > rSizePix.Width() ) ||
+        ( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) > rSizePix.Height() ) )
+    {
+        const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
+                                     Size( rTwoRect.mnSrcWidth, rTwoRect.mnSrcHeight ) );
+        Rectangle       aCropRect( aSourceRect );
+
+        aCropRect.Intersection( Rectangle( Point(), rSizePix ) );
+
+        if( aCropRect.IsEmpty() )
+            rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth = rTwoRect.mnDestHeight = 0;
+        else
+        {
+            const double    fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? (double) ( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
+            const double    fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? (double) ( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
+
+            const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
+            const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
+            const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
+            const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
+
+            rTwoRect.mnSrcX = aCropRect.Left();
+            rTwoRect.mnSrcY = aCropRect.Top();
+            rTwoRect.mnSrcWidth = aCropRect.GetWidth();
+            rTwoRect.mnSrcHeight = aCropRect.GetHeight();
+            rTwoRect.mnDestX = nDstX1;
+            rTwoRect.mnDestY = nDstY1;
+            rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
+            rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
+        }
+    }
+
+    return nMirrFlags;
+}
+
+void AdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect )
+{
+    if( ( rTwoRect.mnSrcX < rValidSrcRect.Left() ) || ( rTwoRect.mnSrcX >= rValidSrcRect.Right() ) ||
+        ( rTwoRect.mnSrcY < rValidSrcRect.Top() ) || ( rTwoRect.mnSrcY >= rValidSrcRect.Bottom() ) ||
+        ( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) > rValidSrcRect.Right() ) ||
+        ( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) > rValidSrcRect.Bottom() ) )
+    {
+        const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
+                                     Size( rTwoRect.mnSrcWidth, rTwoRect.mnSrcHeight ) );
+        Rectangle       aCropRect( aSourceRect );
+
+        aCropRect.Intersection( rValidSrcRect );
+
+        if( aCropRect.IsEmpty() )
+            rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth = rTwoRect.mnDestHeight = 0;
+        else
+        {
+            const double    fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? (double) ( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
+            const double    fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? (double) ( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
+
+            const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
+            const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
+            const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
+            const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
+
+            rTwoRect.mnSrcX = aCropRect.Left();
+            rTwoRect.mnSrcY = aCropRect.Top();
+            rTwoRect.mnSrcWidth = aCropRect.GetWidth();
+            rTwoRect.mnSrcHeight = aCropRect.GetHeight();
+            rTwoRect.mnDestX = nDstX1;
+            rTwoRect.mnDestY = nDstY1;
+            rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
+            rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
+        }
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/tworect.cxx b/vcl/source/outdev/tworect.cxx
deleted file mode 100644
index aa753c1..0000000
--- a/vcl/source/outdev/tworect.cxx
+++ /dev/null
@@ -1,137 +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 <tools/debug.hxx>
-#include <vcl/bitmap.hxx>
-#include <vcl/bitmapex.hxx>
-#include <vcl/window.hxx>
-#include <vcl/metaact.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/bmpacc.hxx>
-#include <vcl/outdev.hxx>
-#include <vcl/image.hxx>
-#include <bmpfast.hxx>
-#include <salbmp.hxx>
-#include <salgdi.hxx>
-#include <impbmp.hxx>
-#include <sallayout.hxx>
-#include <image.h>
-#include <outdev.h>
-#include <window.h>
-#include <outdata.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/matrix/b2dhommatrixtools.hxx>
-#include <boost/scoped_array.hpp>
-
-sal_uLong ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix )
-{
-    sal_uLong nMirrFlags = 0;
-
-    if ( rTwoRect.mnDestWidth < 0 )
-    {
-        rTwoRect.mnSrcX = rSizePix.Width() - rTwoRect.mnSrcX - rTwoRect.mnSrcWidth;
-        rTwoRect.mnDestWidth = -rTwoRect.mnDestWidth;
-        rTwoRect.mnDestX -= rTwoRect.mnDestWidth-1;
-        nMirrFlags |= BMP_MIRROR_HORZ;
-    }
-
-    if ( rTwoRect.mnDestHeight < 0 )
-    {
-        rTwoRect.mnSrcY = rSizePix.Height() - rTwoRect.mnSrcY - rTwoRect.mnSrcHeight;
-        rTwoRect.mnDestHeight = -rTwoRect.mnDestHeight;
-        rTwoRect.mnDestY -= rTwoRect.mnDestHeight-1;
-        nMirrFlags |= BMP_MIRROR_VERT;
-    }
-
-    if( ( rTwoRect.mnSrcX < 0 ) || ( rTwoRect.mnSrcX >= rSizePix.Width() ) ||
-        ( rTwoRect.mnSrcY < 0 ) || ( rTwoRect.mnSrcY >= rSizePix.Height() ) ||
-        ( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) > rSizePix.Width() ) ||
-        ( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) > rSizePix.Height() ) )
-    {
-        const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
-                                     Size( rTwoRect.mnSrcWidth, rTwoRect.mnSrcHeight ) );
-        Rectangle       aCropRect( aSourceRect );
-
-        aCropRect.Intersection( Rectangle( Point(), rSizePix ) );
-
-        if( aCropRect.IsEmpty() )
-            rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth = rTwoRect.mnDestHeight = 0;
-        else
-        {
-            const double    fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? (double) ( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
-            const double    fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? (double) ( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
-
-            const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
-            const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
-            const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
-            const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
-
-            rTwoRect.mnSrcX = aCropRect.Left();
-            rTwoRect.mnSrcY = aCropRect.Top();
-            rTwoRect.mnSrcWidth = aCropRect.GetWidth();
-            rTwoRect.mnSrcHeight = aCropRect.GetHeight();
-            rTwoRect.mnDestX = nDstX1;
-            rTwoRect.mnDestY = nDstY1;
-            rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
-            rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
-        }
-    }
-
-    return nMirrFlags;
-}
-
-void ImplAdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect )
-{
-    if( ( rTwoRect.mnSrcX < rValidSrcRect.Left() ) || ( rTwoRect.mnSrcX >= rValidSrcRect.Right() ) ||
-        ( rTwoRect.mnSrcY < rValidSrcRect.Top() ) || ( rTwoRect.mnSrcY >= rValidSrcRect.Bottom() ) ||
-        ( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth ) > rValidSrcRect.Right() ) ||
-        ( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight ) > rValidSrcRect.Bottom() ) )
-    {
-        const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
-                                     Size( rTwoRect.mnSrcWidth, rTwoRect.mnSrcHeight ) );
-        Rectangle       aCropRect( aSourceRect );
-
-        aCropRect.Intersection( rValidSrcRect );
-
-        if( aCropRect.IsEmpty() )
-            rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth = rTwoRect.mnDestHeight = 0;
-        else
-        {
-            const double    fFactorX = ( rTwoRect.mnSrcWidth > 1 ) ? (double) ( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
-            const double    fFactorY = ( rTwoRect.mnSrcHeight > 1 ) ? (double) ( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
-
-            const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Left() - rTwoRect.mnSrcX ) );
-            const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Top() - rTwoRect.mnSrcY ) );
-            const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( aCropRect.Right() - rTwoRect.mnSrcX ) );
-            const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( aCropRect.Bottom() - rTwoRect.mnSrcY ) );
-
-            rTwoRect.mnSrcX = aCropRect.Left();
-            rTwoRect.mnSrcY = aCropRect.Top();
-            rTwoRect.mnSrcWidth = aCropRect.GetWidth();
-            rTwoRect.mnSrcHeight = aCropRect.GetHeight();
-            rTwoRect.mnDestX = nDstX1;
-            rTwoRect.mnDestY = nDstY1;
-            rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
-            rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
-        }
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list