[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/opengl vcl/quartz vcl/source vcl/unx vcl/win

Caolán McNamara caolanm at redhat.com
Mon Nov 24 12:41:05 PST 2014


 include/vcl/salgtype.hxx                         |    8 +--
 vcl/inc/unx/salbmp.h                             |    2 
 vcl/opengl/gdiimpl.cxx                           |   24 ++-------
 vcl/opengl/x11/gdiimpl.cxx                       |   10 +--
 vcl/quartz/salbmp.cxx                            |    6 --
 vcl/source/gdi/virdev.cxx                        |   11 ----
 vcl/source/outdev/bitmap.cxx                     |   58 ++++++-----------------
 vcl/source/outdev/mask.cxx                       |   14 +----
 vcl/source/outdev/outdev.cxx                     |   54 +++++++++------------
 vcl/source/window/window.cxx                     |   11 ----
 vcl/unx/generic/gdi/gdiimpl.cxx                  |   15 -----
 vcl/unx/generic/gdi/openglx11cairotextrender.cxx |   31 ++++--------
 vcl/unx/generic/gdi/salbmp.cxx                   |    8 ---
 vcl/unx/generic/gdi/salgdi2.cxx                  |    9 ---
 vcl/unx/generic/window/salframe.cxx              |    9 ---
 vcl/win/source/gdi/salbmp.cxx                    |   20 +------
 16 files changed, 85 insertions(+), 205 deletions(-)

New commits:
commit 8ccf559473f185bdb7640e438e131f17ddc1861c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 24 10:10:11 2014 +0000

    coverity#1255909 Uninitialized scalar field
    
    Change-Id: I162199233c9d3feb03e7ab33b777174b2a03035a
    Reviewed-on: https://gerrit.libreoffice.org/13104
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index 23b8977..de8a555 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -47,10 +47,10 @@ struct SalTwoRect
     long        mnDestWidth;
     long        mnDestHeight;
 
-    SalTwoRect() {}
-
-    SalTwoRect(long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight, long nDestX, long nDestY, long nDestWidth, long nDestHeight)
-        : mnSrcX(nSrcX), mnSrcY(nSrcY), mnSrcWidth(nSrcWidth), mnSrcHeight(nSrcHeight), mnDestX(nDestX), mnDestY(nDestY), mnDestWidth(nDestWidth), mnDestHeight(nDestHeight)
+    SalTwoRect(long nSrcX, long nSrcY, long nSrcWidth, long nSrcHeight,
+               long nDestX, long nDestY, long nDestWidth, long nDestHeight)
+        : mnSrcX(nSrcX), mnSrcY(nSrcY), mnSrcWidth(nSrcWidth), mnSrcHeight(nSrcHeight)
+        , mnDestX(nDestX), mnDestY(nDestY), mnDestWidth(nDestWidth), mnDestHeight(nDestHeight)
     {
     }
 };
diff --git a/vcl/inc/unx/salbmp.h b/vcl/inc/unx/salbmp.h
index 5975f66..df6e8bd 100644
--- a/vcl/inc/unx/salbmp.h
+++ b/vcl/inc/unx/salbmp.h
@@ -161,8 +161,6 @@ private:
     long            mnDepth;
     SalX11Screen    mnXScreen;
 
-                    ImplSalDDB() : mnXScreen(0) {}
-
     static void     ImplDraw(
                         Drawable aSrcDrawable,
                         long nSrcDrawableDepth,
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index d6bf6ab..a794d15 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -389,11 +389,9 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture()
         return true;
     }
 
-    SalTwoRect aPosAry;
-    aPosAry.mnSrcX = aPosAry.mnDestX = 0;
-    aPosAry.mnSrcY = aPosAry.mnDestY = 0;
-    aPosAry.mnSrcWidth = aPosAry.mnDestWidth = GetWidth();
-    aPosAry.mnSrcHeight = aPosAry.mnDestHeight = GetHeight();
+    GLfloat fWidth = GetWidth();
+    GLfloat fHeight = GetHeight();
+    SalTwoRect aPosAry(0, 0, fWidth, fHeight, 0,0, fWidth, fHeight);
 
     // TODO: lfrb: User GL_ARB_copy_image?
     OpenGLTexture aNewTex = OpenGLTexture( GetWidth(), GetHeight() );
@@ -896,7 +894,6 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture(
         0, (float) nTexHeight, 0, 0,
         (float) nTexWidth, 0, (float) nTexWidth, (float) nTexHeight };
     GLfloat aTexCoord[8];
-    SalTwoRect aPosAry;
 
     if( rMask )
     {
@@ -934,9 +931,9 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture(
     rTexture.SetFilter( GL_LINEAR );
     CHECK_GL_ERROR();
 
-    aPosAry.mnSrcX = aPosAry.mnSrcY = 0;
-    aPosAry.mnSrcWidth = rTexture.GetWidth();
-    aPosAry.mnSrcHeight = rTexture.GetHeight();
+    GLfloat fWidth = rTexture.GetWidth();
+    GLfloat fHeight = rTexture.GetHeight();
+    SalTwoRect aPosAry(0, 0, fWidth, fHeight, 0, 0, fWidth, fHeight);
     rTexture.GetCoord( aTexCoord, aPosAry );
     glEnableVertexAttribArray( GL_ATTRIB_TEX );
     glVertexAttribPointer( GL_ATTRIB_TEX, 2, GL_FLOAT, GL_FALSE, 0, aTexCoord );
@@ -1528,14 +1525,7 @@ void OpenGLSalGraphicsImpl::copyArea(
 {
     SAL_INFO( "vcl.opengl", "::copyArea " << nSrcX << "," << nSrcY << " >> " << nDestX << "," << nDestY << " (" << nSrcWidth << "," << nSrcHeight << ")" );
     OpenGLTexture aTexture;
-    SalTwoRect aPosAry;
-
-    aPosAry.mnSrcX = 0;
-    aPosAry.mnSrcY = 0;
-    aPosAry.mnDestX = nDestX;
-    aPosAry.mnDestY = nDestY;
-    aPosAry.mnSrcWidth = aPosAry.mnDestWidth = nSrcWidth;
-    aPosAry.mnSrcHeight = aPosAry.mnDestHeight = nSrcHeight;
+    SalTwoRect aPosAry(0, 0, nSrcWidth, nSrcHeight, nDestX, nDestY, nSrcWidth, nSrcHeight);
 
     PreDraw();
     aTexture = OpenGLTexture( nSrcX, GetHeight() - nSrcY - nSrcHeight, nSrcWidth, nSrcHeight );
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 0818c59..221c1ef 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -159,17 +159,13 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmapToScreen( X11Pixmap* pPixmap, X11Pixm
     GLXFBConfig pFbConfig;
     GLXPixmap pGlxPixmap;
     GLXPixmap pGlxMask;
-    SalTwoRect aPosAry;
     bool bInverted;
 
     SAL_INFO( "vcl.opengl", "RenderPixmapToScreen (" << nX << " " << nY << ")" );
 
-    aPosAry.mnSrcX = 0;
-    aPosAry.mnSrcY = 0;
-    aPosAry.mnDestX = nX;
-    aPosAry.mnDestY = nY;
-    aPosAry.mnSrcWidth = aPosAry.mnDestWidth = pPixmap->GetWidth();
-    aPosAry.mnSrcHeight = aPosAry.mnDestHeight = pPixmap->GetHeight();
+    const long nWidth = pPixmap->GetWidth();
+    const long nHeight = pPixmap->GetHeight();
+    SalTwoRect aPosAry(0, 0, nWidth, nHeight, nX, nY, nWidth, nHeight);
 
     PreDraw();
     //glClear( GL_COLOR_BUFFER_BIT );
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index b75c08f..c3245b6 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -572,11 +572,7 @@ void QuartzSalBitmap::ConvertBitmapData( sal_uInt32 nWidth, sal_uInt32 nHeight,
         aSrcBuf.mnWidth = aDstBuf.mnWidth = nWidth;
         aSrcBuf.mnHeight = aDstBuf.mnHeight = nHeight;
 
-        SalTwoRect aTwoRects;
-        aTwoRects.mnSrcX = aTwoRects.mnDestX = 0;
-        aTwoRects.mnSrcY = aTwoRects.mnDestY = 0;
-        aTwoRects.mnSrcWidth = aTwoRects.mnDestWidth = mnWidth;
-        aTwoRects.mnSrcHeight = aTwoRects.mnDestHeight = mnHeight;
+        SalTwoRect aTwoRects(0, 0, mnWidth, mnHeight, 0, 0, mnWidth, mnHeight);
         bConverted = ::ImplFastBitmapConversion( aDstBuf, aSrcBuf, aTwoRects );
     }
 
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 2036523..d783cd9 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -338,7 +338,6 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
             SalGraphics* pGraphics = pNewVirDev->AcquireGraphics();
             if ( pGraphics )
             {
-                SalTwoRect aPosAry;
                 long nWidth;
                 long nHeight;
                 if ( mnOutWidth < nNewWidth )
@@ -349,15 +348,7 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
                     nHeight = mnOutHeight;
                 else
                     nHeight = nNewHeight;
-                aPosAry.mnSrcX       = 0;
-                aPosAry.mnSrcY       = 0;
-                aPosAry.mnSrcWidth   = nWidth;
-                aPosAry.mnSrcHeight  = nHeight;
-                aPosAry.mnDestX      = 0;
-                aPosAry.mnDestY      = 0;
-                aPosAry.mnDestWidth  = nWidth;
-                aPosAry.mnDestHeight = nHeight;
-
+                SalTwoRect aPosAry(0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight);
                 pGraphics->CopyBits( aPosAry, mpGraphics, this, this );
                 pNewVirDev->ReleaseGraphics( pGraphics );
                 ReleaseGraphics();
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index cb7d594..680f362 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -128,16 +128,10 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const Size& rDestSize,
 
     if( !aBmp.IsEmpty() )
     {
-        SalTwoRect aPosAry;
-
-        aPosAry.mnSrcX = rSrcPtPixel.X();
-        aPosAry.mnSrcY = rSrcPtPixel.Y();
-        aPosAry.mnSrcWidth = rSrcSizePixel.Width();
-        aPosAry.mnSrcHeight = rSrcSizePixel.Height();
-        aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
-        aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
-        aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
-        aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+        SalTwoRect aPosAry(rSrcPtPixel.X(), rSrcPtPixel.Y(), rSrcSizePixel.Width(), rSrcSizePixel.Height(),
+                           ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
+                           ImplLogicWidthToDevicePixel(rDestSize.Width()),
+                           ImplLogicHeightToDevicePixel(rDestSize.Height()));
 
         if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
         {
@@ -422,19 +416,12 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
                 {
                     if ( ((OutputDevice*)&aVDev)->mpGraphics || ((OutputDevice*)&aVDev)->AcquireGraphics() )
                     {
-                        SalTwoRect aPosAry;
-
-                        aPosAry.mnSrcX = nX;
-                        aPosAry.mnSrcY = nY;
-                        aPosAry.mnSrcWidth = nWidth;
-                        aPosAry.mnSrcHeight = nHeight;
-                        aPosAry.mnDestX = ( aRect.Left() < mnOutOffX ) ? ( mnOutOffX - aRect.Left() ) : 0L;
-                        aPosAry.mnDestY = ( aRect.Top() < mnOutOffY ) ? ( mnOutOffY - aRect.Top() ) : 0L;
-                        aPosAry.mnDestWidth = nWidth;
-                        aPosAry.mnDestHeight = nHeight;
-
                         if ( (nWidth > 0) && (nHeight > 0) )
                         {
+                            SalTwoRect aPosAry(nX, nY, nWidth, nHeight,
+                                              (aRect.Left() < mnOutOffX) ? (mnOutOffX - aRect.Left()) : 0L,
+                                              (aRect.Top() < mnOutOffY) ? (mnOutOffY - aRect.Top()) : 0L,
+                                              nWidth, nHeight);
                             (((OutputDevice*)&aVDev)->mpGraphics)->CopyBits( aPosAry, mpGraphics, this, this );
                         }
                         else
@@ -495,16 +482,10 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
     }
     else if (!!rBitmapEx)
     {
-        SalTwoRect aPosAry;
-
-        aPosAry.mnSrcX = rSrcPtPixel.X();
-        aPosAry.mnSrcY = rSrcPtPixel.Y();
-        aPosAry.mnSrcWidth = rSrcSizePixel.Width();
-        aPosAry.mnSrcHeight = rSrcSizePixel.Height();
-        aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
-        aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
-        aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
-        aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+        SalTwoRect aPosAry(rSrcPtPixel.X(), rSrcPtPixel.Y(), rSrcSizePixel.Width(), rSrcSizePixel.Height(),
+                           ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
+                           ImplLogicWidthToDevicePixel(rDestSize.Width()),
+                           ImplLogicHeightToDevicePixel(rDestSize.Height()));
 
         const sal_uLong nMirrFlags = AdjustTwoRect(aPosAry, rBitmapEx.GetSizePixel());
 
@@ -1375,18 +1356,13 @@ Bitmap OutputDevice::BlendBitmap(
         bool bFastBlend = false;
         if( pP && pA && pB )
         {
-            SalTwoRect aTR;
-            aTR.mnSrcX      = aBmpRect.Left();
-            aTR.mnSrcY      = aBmpRect.Top();
-            aTR.mnSrcWidth  = aBmpRect.GetWidth();
-            aTR.mnSrcHeight = aBmpRect.GetHeight();
-            aTR.mnDestX     = nOffX;
-            aTR.mnDestY     = nOffY;
-            aTR.mnDestWidth = aOutSz.Width();
-            aTR.mnDestHeight= aOutSz.Height();
-
             if( !bHMirr && !bVMirr )
+            {
+                SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), aBmpRect.GetHeight(),
+                               nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
+
                 bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR );
+            }
         }
 
         if( pP && pA && pB && !bFastBlend )
diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx
index d1c6b7e..f8ef474 100644
--- a/vcl/source/outdev/mask.cxx
+++ b/vcl/source/outdev/mask.cxx
@@ -102,16 +102,10 @@ void OutputDevice::DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
     const ImpBitmap* pImpBmp = rMask.ImplGetImpBitmap();
     if ( pImpBmp )
     {
-        SalTwoRect aPosAry;
-
-        aPosAry.mnSrcX = rSrcPtPixel.X();
-        aPosAry.mnSrcY = rSrcPtPixel.Y();
-        aPosAry.mnSrcWidth = rSrcSizePixel.Width();
-        aPosAry.mnSrcHeight = rSrcSizePixel.Height();
-        aPosAry.mnDestX = ImplLogicXToDevicePixel( rDestPt.X() );
-        aPosAry.mnDestY = ImplLogicYToDevicePixel( rDestPt.Y() );
-        aPosAry.mnDestWidth = ImplLogicWidthToDevicePixel( rDestSize.Width() );
-        aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+        SalTwoRect aPosAry(rSrcPtPixel.X(), rSrcPtPixel.Y(), rSrcSizePixel.Width(), rSrcSizePixel.Height(),
+                           ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
+                           ImplLogicWidthToDevicePixel(rDestSize.Width()),
+                           ImplLogicHeightToDevicePixel(rDestSize.Height()));
 
         // we don't want to mirror via cooridates
         const sal_uLong nMirrFlags = AdjustTwoRect( aPosAry, pImpBmp->ImplGetSize() );
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index b5a59ad..5f75f41 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -429,18 +429,17 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
     if ( mbOutputClipped )
         return;
 
-    SalTwoRect aPosAry;
-    aPosAry.mnSrcWidth   = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
-    aPosAry.mnSrcHeight  = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
-    aPosAry.mnDestWidth  = ImplLogicWidthToDevicePixel( rDestSize.Width() );
-    aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+    long nSrcWidth   = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
+    long nSrcHeight  = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
+    long nDestWidth  = ImplLogicWidthToDevicePixel( rDestSize.Width() );
+    long nDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
 
-    if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight )
+    if (nSrcWidth && nSrcHeight && nDestWidth && nDestHeight)
     {
-        aPosAry.mnSrcX       = ImplLogicXToDevicePixel( rSrcPt.X() );
-        aPosAry.mnSrcY       = ImplLogicYToDevicePixel( rSrcPt.Y() );
-        aPosAry.mnDestX      = ImplLogicXToDevicePixel( rDestPt.X() );
-        aPosAry.mnDestY      = ImplLogicYToDevicePixel( rDestPt.Y() );
+        SalTwoRect aPosAry(ImplLogicXToDevicePixel(rSrcPt.X()), ImplLogicYToDevicePixel(rSrcPt.Y()),
+                           nSrcWidth, nSrcHeight,
+                           ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
+                           nDestWidth, nDestHeight);
 
         const Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
                                      Size( mnOutWidth, mnOutHeight ) );
@@ -487,15 +486,14 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize,
     if ( mbOutputClipped )
         return;
 
-    SalTwoRect aPosAry;
-    aPosAry.mnSrcX       = rOutDev.ImplLogicXToDevicePixel( rSrcPt.X() );
-    aPosAry.mnSrcY       = rOutDev.ImplLogicYToDevicePixel( rSrcPt.Y() );
-    aPosAry.mnSrcWidth   = rOutDev.ImplLogicWidthToDevicePixel( rSrcSize.Width() );
-    aPosAry.mnSrcHeight  = rOutDev.ImplLogicHeightToDevicePixel( rSrcSize.Height() );
-    aPosAry.mnDestX      = ImplLogicXToDevicePixel( rDestPt.X() );
-    aPosAry.mnDestY      = ImplLogicYToDevicePixel( rDestPt.Y() );
-    aPosAry.mnDestWidth  = ImplLogicWidthToDevicePixel( rDestSize.Width() );
-    aPosAry.mnDestHeight = ImplLogicHeightToDevicePixel( rDestSize.Height() );
+    SalTwoRect aPosAry(rOutDev.ImplLogicXToDevicePixel(rSrcPt.X()),
+                       rOutDev.ImplLogicYToDevicePixel(rSrcPt.Y()),
+                       rOutDev.ImplLogicWidthToDevicePixel(rSrcSize.Width()),
+                       rOutDev.ImplLogicHeightToDevicePixel(rSrcSize.Height()),
+                       ImplLogicXToDevicePixel(rDestPt.X()),
+                       ImplLogicYToDevicePixel(rDestPt.Y()),
+                       ImplLogicWidthToDevicePixel(rDestSize.Width()),
+                       ImplLogicHeightToDevicePixel(rDestSize.Height()));
 
     if( mpAlphaVDev )
     {
@@ -550,18 +548,14 @@ void OutputDevice::CopyArea( const Point& rDestPt,
     if ( mbOutputClipped )
         return;
 
-    SalTwoRect aPosAry;
-    aPosAry.mnSrcWidth   = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
-    aPosAry.mnSrcHeight  = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
-
-    if ( aPosAry.mnSrcWidth && aPosAry.mnSrcHeight )
+    long nSrcWidth   = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
+    long nSrcHeight  = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
+    if (nSrcWidth && nSrcHeight)
     {
-        aPosAry.mnSrcX       = ImplLogicXToDevicePixel( rSrcPt.X() );
-        aPosAry.mnSrcY       = ImplLogicYToDevicePixel( rSrcPt.Y() );
-        aPosAry.mnDestX      = ImplLogicXToDevicePixel( rDestPt.X() );
-        aPosAry.mnDestY      = ImplLogicYToDevicePixel( rDestPt.Y() );
-        aPosAry.mnDestWidth  = aPosAry.mnSrcWidth;
-        aPosAry.mnDestHeight = aPosAry.mnSrcHeight;
+        SalTwoRect aPosAry(ImplLogicXToDevicePixel(rSrcPt.X()), ImplLogicYToDevicePixel(rSrcPt.Y()),
+                           nSrcWidth, nSrcHeight,
+                           ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()),
+                           nSrcWidth, nSrcHeight);
 
         const Rectangle aSrcOutRect( Point( mnOutOffX, mnOutOffY ),
                                      Size( mnOutWidth, mnOutHeight ) );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index cabf455..edb7c2e 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1229,15 +1229,8 @@ void Window::drawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rD
     else
         SelectClipRegion( rRegion );
 
-    SalTwoRect aPosAry;
-    aPosAry.mnSrcX       = rDevPt.X();
-    aPosAry.mnSrcY       = rDevPt.Y();
-    aPosAry.mnSrcWidth   = rDevSize.Width();
-    aPosAry.mnSrcHeight  = rDevSize.Height();
-    aPosAry.mnDestX      = rPt.X();
-    aPosAry.mnDestY      = rPt.Y();
-    aPosAry.mnDestWidth  = rDevSize.Width();
-    aPosAry.mnDestHeight = rDevSize.Height();
+    SalTwoRect aPosAry(rDevPt.X(), rDevPt.Y(), rDevSize.Width(), rDevSize.Height(),
+                       rPt.X(), rPt.Y(), rDevSize.Width(), rDevSize.Height());
     drawOutDevDirect( &rOutDev, aPosAry );
 
     // Ensure that ClipRegion is recalculated and set
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 91c4db7..46865d0 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -667,19 +667,8 @@ void X11SalGraphicsImpl::copyArea ( long nDestX,    long nDestY,
                                 long nSrcWidth, long nSrcHeight,
                                 sal_uInt16 )
 {
-    SalTwoRect aPosAry;
-
-    aPosAry.mnDestX = nDestX;
-    aPosAry.mnDestY = nDestY;
-    aPosAry.mnDestWidth  = nSrcWidth;
-    aPosAry.mnDestHeight = nSrcHeight;
-
-    aPosAry.mnSrcX = nSrcX;
-    aPosAry.mnSrcY = nSrcY;
-    aPosAry.mnSrcWidth  = nSrcWidth;
-    aPosAry.mnSrcHeight = nSrcHeight;
-
-    copyBits ( aPosAry, 0 );
+    SalTwoRect aPosAry(nSrcX, nSrcY, nSrcWidth, nSrcHeight, nDestX, nDestY, nSrcWidth, nSrcHeight);
+    copyBits(aPosAry, 0);
 }
 
 void X11SalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap )
diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
index 38a7213..f16fe96 100644
--- a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
@@ -31,32 +31,23 @@ cairo_surface_t* OpenGLX11CairoTextRender::getCairoSurface()
 
 void OpenGLX11CairoTextRender::drawSurface(cairo_t* cr)
 {
+    // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV
+    OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl());
+    if(!pImpl)
+        return;
+
     cairo_surface_t* pSurface = cairo_get_target(cr);
     int nWidth = cairo_image_surface_get_width( pSurface );
     int nHeight = cairo_image_surface_get_height( pSurface );
     cairo_surface_flush( pSurface );
     unsigned char *pSrc = cairo_image_surface_get_data( pSurface );
 
-    SalTwoRect aRect;
-    aRect.mnSrcX = 0;
-    aRect.mnSrcY = 0;
-    aRect.mnSrcWidth = nWidth;
-    aRect.mnSrcHeight = nHeight;
-    aRect.mnDestX = 0;
-    aRect.mnDestY = 0;
-    aRect.mnDestWidth = nWidth;
-    aRect.mnDestHeight = nHeight;
-
-    // XXX: lfrb: GLES 2.0 doesn't support GL_UNSIGNED_INT_8_8_8_8_REV
-    OpenGLSalGraphicsImpl *pImpl = dynamic_cast< OpenGLSalGraphicsImpl* >(mrParent.GetImpl());
-    if( pImpl )
-    {
-        // Cairo surface data is ARGB with premultiplied alpha and is Y-inverted
-        OpenGLTexture aTexture( nWidth, nHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pSrc );
-        pImpl->PreDraw();
-        pImpl->DrawAlphaTexture( aTexture, aRect, true, true );
-        pImpl->PostDraw();
-    }
+    SalTwoRect aRect(0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight);
+    // Cairo surface data is ARGB with premultiplied alpha and is Y-inverted
+    OpenGLTexture aTexture( nWidth, nHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pSrc );
+    pImpl->PreDraw();
+    pImpl->DrawAlphaTexture( aTexture, aRect, true, true );
+    pImpl->PostDraw();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index a245dc9..5d442f1 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -910,7 +910,8 @@ ImplSalDDB::ImplSalDDB(
     long nY,
     long nWidth,
     long nHeight
-)   : mnDepth( nDrawableDepth )
+)   : maTwoRect(0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight)
+    , mnDepth( nDrawableDepth )
     , mnXScreen( nXScreen )
 {
     SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay();
@@ -934,14 +935,9 @@ ImplSalDDB::ImplSalDDB(
         ImplDraw( aDrawable, nDrawableDepth, maPixmap, mnDepth,
                   nX, nY, nWidth, nHeight, 0, 0, aGC );
         XFreeGC( pXDisp, aGC );
-
-        maTwoRect.mnSrcX = maTwoRect.mnSrcY = maTwoRect.mnDestX = maTwoRect.mnDestY = 0;
-        maTwoRect.mnSrcWidth = maTwoRect.mnDestWidth = nWidth;
-        maTwoRect.mnSrcHeight = maTwoRect.mnDestHeight = nHeight;
     }
     else
     {
-        maTwoRect.mnSrcX = maTwoRect.mnSrcY = maTwoRect.mnDestX = maTwoRect.mnDestY = 0;
         maTwoRect.mnSrcWidth = maTwoRect.mnDestWidth = 0;
         maTwoRect.mnSrcHeight = maTwoRect.mnDestHeight = 0;
     }
diff --git a/vcl/unx/generic/gdi/salgdi2.cxx b/vcl/unx/generic/gdi/salgdi2.cxx
index f1911b6..e88a18a 100644
--- a/vcl/unx/generic/gdi/salgdi2.cxx
+++ b/vcl/unx/generic/gdi/salgdi2.cxx
@@ -73,13 +73,8 @@ void X11SalGraphics::CopyScreenArea( Display* pDisplay,
     {
         X11SalBitmap aBM;
         aBM.ImplCreateFromDrawable( aSrc, nXScreenSrc, nSrcDepth, src_x, src_y, w, h );
-        SalTwoRect aTwoRect;
-        aTwoRect.mnSrcX = aTwoRect.mnSrcY = 0;
-        aTwoRect.mnSrcWidth = aTwoRect.mnDestWidth = w;
-        aTwoRect.mnSrcHeight = aTwoRect.mnDestHeight = h;
-        aTwoRect.mnDestX = dest_x;
-        aTwoRect.mnDestY = dest_y;
-        aBM.ImplDraw( aDest, nXScreenDest, nDestDepth, aTwoRect,aDestGC );
+        SalTwoRect aTwoRect(0, 0, w, h, dest_x, dest_y, w, h);
+        aBM.ImplDraw(aDest, nXScreenDest, nDestDepth, aTwoRect,aDestGC);
     }
 }
 
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index ee94a19..6f8af22 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -270,15 +270,8 @@ static bool lcl_SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nXScreen
     if( aIcon.IsEmpty() )
         return false;
 
-    SalTwoRect aRect;
-    aRect.mnSrcX = 0; aRect.mnSrcY = 0;
-    aRect.mnSrcWidth = iconSize; aRect.mnSrcHeight = iconSize;
-    aRect.mnDestX = 0; aRect.mnDestY = 0;
-    aRect.mnDestWidth = iconSize; aRect.mnDestHeight = iconSize;
-
     X11SalBitmap *pBitmap = dynamic_cast < X11SalBitmap * >
         (aIcon.ImplGetBitmapImpBitmap()->ImplGetSalBitmap());
-
     if (!pBitmap) // FIXME: opengl
         return false;
 
@@ -289,6 +282,8 @@ static bool lcl_SelectAppIconPixmap( SalDisplay *pDisplay, SalX11Screen nXScreen
                                                nXScreen.getXScreen() )
                                  );
 
+    SalTwoRect aRect(0, 0, iconSize, iconSize, 0, 0, iconSize, iconSize);
+
     pBitmap->ImplDraw( icon_pixmap,
                        nXScreen,
                        DefaultDepth( pDisplay->GetDisplay(),
diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx
index d4ae11a..fd02f54 100644
--- a/vcl/win/source/gdi/salbmp.cxx
+++ b/vcl/win/source/gdi/salbmp.cxx
@@ -276,12 +276,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
     if(pRGB && BMP_FORMAT_24BIT_TC_BGR != (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN))
     {
         // convert source bitmap to BMP_FORMAT_24BIT_TC_BGR format if not yet in that format
-        SalTwoRect aSalTwoRect;
-
-        aSalTwoRect.mnSrcX = aSalTwoRect.mnSrcY = aSalTwoRect.mnDestX = aSalTwoRect.mnDestY = 0;
-        aSalTwoRect.mnSrcWidth = aSalTwoRect.mnDestWidth = pRGB->mnWidth;
-        aSalTwoRect.mnSrcHeight = aSalTwoRect.mnDestHeight = pRGB->mnHeight;
-
+        SalTwoRect aSalTwoRect(0, 0, pRGB->mnWidth, pRGB->mnHeight, 0, 0, pRGB->mnWidth, pRGB->mnHeight);
         pExtraRGB = StretchAndConvert(
             *pRGB,
             aSalTwoRect,
@@ -373,12 +368,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
     if(pRGB && BMP_FORMAT_24BIT_TC_BGR != (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN))
     {
         // convert source bitmap to BMP_FORMAT_24BIT_TC_BGR format if not yet in that format
-        SalTwoRect aSalTwoRect;
-
-        aSalTwoRect.mnSrcX = aSalTwoRect.mnSrcY = aSalTwoRect.mnDestX = aSalTwoRect.mnDestY = 0;
-        aSalTwoRect.mnSrcWidth = aSalTwoRect.mnDestWidth = pRGB->mnWidth;
-        aSalTwoRect.mnSrcHeight = aSalTwoRect.mnDestHeight = pRGB->mnHeight;
-
+        SalTwoRect aSalTwoRect(0, 0, pRGB->mnWidth, pRGB->mnHeight, 0, 0, pRGB->mnWidth, pRGB->mnHeight);
         pExtraRGB = StretchAndConvert(
             *pRGB,
             aSalTwoRect,
@@ -406,11 +396,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
     if(pA && BMP_FORMAT_8BIT_PAL != (pA->mnFormat & ~BMP_FORMAT_TOP_DOWN))
     {
         // convert alpha bitmap to BMP_FORMAT_8BIT_PAL format if not yet in that format
-        SalTwoRect aSalTwoRect;
-
-        aSalTwoRect.mnSrcX = aSalTwoRect.mnSrcY = aSalTwoRect.mnDestX = aSalTwoRect.mnDestY = 0;
-        aSalTwoRect.mnSrcWidth = aSalTwoRect.mnDestWidth = pA->mnWidth;
-        aSalTwoRect.mnSrcHeight = aSalTwoRect.mnDestHeight = pA->mnHeight;
+        SalTwoRect aSalTwoRect(0, 0, pA->mnWidth, pA->mnHeight, 0, 0, pA->mnWidth, pA->mnHeight);
         const BitmapPalette& rTargetPalette = Bitmap::GetGreyPalette(256);
 
         pExtraA = StretchAndConvert(


More information about the Libreoffice-commits mailing list