You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ja...@apache.org on 2013/02/03 14:24:38 UTC

svn commit: r1441909 [43/45] - in /openoffice/branches/l10n: ./ ext_libraries/apr-util/ ext_libraries/apr/ ext_libraries/hunspell/ ext_sources/ extras/l10n/source/ast/ extras/l10n/source/da/ extras/l10n/source/eu/ extras/l10n/source/gd/ extras/l10n/sou...

Modified: openoffice/branches/l10n/main/vcl/unx/headless/svpgdi.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/unx/headless/svpgdi.hxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/unx/headless/svpgdi.hxx (original)
+++ openoffice/branches/l10n/main/vcl/unx/headless/svpgdi.hxx Sun Feb  3 13:23:59 2013
@@ -50,6 +50,12 @@ class SvpSalGraphics : public SalGraphic
 
 protected:
     virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap );
+    virtual bool drawTransformedBitmap(
+        const basegfx::B2DPoint& rNull,
+        const basegfx::B2DPoint& rX,
+        const basegfx::B2DPoint& rY,
+        const SalBitmap& rSourceBitmap,
+        const SalBitmap* pAlphaBitmap);
     virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
 
 public:
@@ -144,17 +150,17 @@ public:
                                       long nSrcWidth,
                                       long nSrcHeight,
                                       sal_uInt16 nFlags );
-    virtual void			copyBits( const SalTwoRect* pPosAry,
+    virtual void			copyBits( const SalTwoRect& rPosAry,
                                       SalGraphics* pSrcGraphics );
-    virtual void			drawBitmap( const SalTwoRect* pPosAry,
+    virtual void			drawBitmap( const SalTwoRect& rPosAry,
                                         const SalBitmap& rSalBitmap );
-    virtual void			drawBitmap( const SalTwoRect* pPosAry,
+    virtual void			drawBitmap( const SalTwoRect& rPosAry,
                                         const SalBitmap& rSalBitmap,
                                         SalColor nTransparentColor );
-    virtual void			drawBitmap( const SalTwoRect* pPosAry,
+    virtual void			drawBitmap( const SalTwoRect& rPosAry,
                                         const SalBitmap& rSalBitmap,
                                         const SalBitmap& rTransparentBitmap );
-    virtual void			drawMask( const SalTwoRect* pPosAry,
+    virtual void			drawMask( const SalTwoRect& rPosAry,
                                       const SalBitmap& rSalBitmap,
                                       SalColor nMaskColor );
     virtual SalBitmap*		getBitmap( long nX, long nY, long nWidth, long nHeight );

Modified: openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.cxx (original)
+++ openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.cxx Sun Feb  3 13:23:59 2013
@@ -175,6 +175,18 @@ bool PspGraphics::drawAlphaBitmap( const
 	return false;
 }
 
+bool PspGraphics::drawTransformedBitmap(
+    const basegfx::B2DPoint& rNull,
+    const basegfx::B2DPoint& rX,
+    const basegfx::B2DPoint& rY,
+    const SalBitmap& rSourceBitmap,
+    const SalBitmap* pAlphaBitmap)
+{
+    // here direct support for transformed bitmaps can be impemented
+    (void)rNull; (void)rX; (void)rY; (void)rSourceBitmap; (void)pAlphaBitmap;
+    return false;
+}
+
 bool PspGraphics::drawAlphaRect( long /*nX*/, long /*nY*/, long /*nWidth*/, long /*nHeight*/, sal_uInt8 /*nTransparency*/ )
 {
 	return false;
@@ -391,7 +403,7 @@ sal_Bool PspGraphics::drawEPS( long nX, 
     return m_pPrinterGfx->DrawEPS( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ), pPtr, nSize );
 }
 
-void PspGraphics::copyBits( const SalTwoRect* /*pPosAry*/,
+void PspGraphics::copyBits( const SalTwoRect& /*rPosAry*/,
                             SalGraphics* /*pSSrcGraphics*/ )
 {
     DBG_ERROR( "Error: PrinterGfx::CopyBits() not implemented" );
@@ -405,12 +417,12 @@ void PspGraphics::copyArea ( long /*nDes
     DBG_ERROR( "Error: PrinterGfx::CopyArea() not implemented" );
 }
 
-void PspGraphics::drawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap )
+void PspGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap )
 {
-    Rectangle aSrc (Point(pPosAry->mnSrcX, pPosAry->mnSrcY),
-                    Size(pPosAry->mnSrcWidth, pPosAry->mnSrcHeight));
-    Rectangle aDst (Point(pPosAry->mnDestX, pPosAry->mnDestY),
-                    Size(pPosAry->mnDestWidth, pPosAry->mnDestHeight));
+    Rectangle aSrc (Point(rPosAry.mnSrcX, rPosAry.mnSrcY),
+                    Size(rPosAry.mnSrcWidth, rPosAry.mnSrcHeight));
+    Rectangle aDst (Point(rPosAry.mnDestX, rPosAry.mnDestY),
+                    Size(rPosAry.mnDestWidth, rPosAry.mnDestHeight));
 
     const SvpSalBitmap* pBmp = dynamic_cast<const SvpSalBitmap*>(&rSalBitmap);
     if( pBmp )
@@ -420,21 +432,21 @@ void PspGraphics::drawBitmap( const SalT
     }
 }
 
-void PspGraphics::drawBitmap( const SalTwoRect* /*pPosAry*/,
+void PspGraphics::drawBitmap( const SalTwoRect& /*pPosAry*/,
                               const SalBitmap& /*rSalBitmap*/,
                               const SalBitmap& /*rTransBitmap*/ )
 {
     DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent bitmap");
 }
 
-void PspGraphics::drawBitmap( const SalTwoRect* /*pPosAry*/,
+void PspGraphics::drawBitmap( const SalTwoRect& /*pPosAry*/,
                               const SalBitmap& /*rSalBitmap*/,
                               SalColor /*nTransparentColor*/ )
 {
     DBG_ERROR("Error: no PrinterGfx::DrawBitmap() for transparent color");
 }
 
-void PspGraphics::drawMask( const SalTwoRect* /*pPosAry*/,
+void PspGraphics::drawMask( const SalTwoRect& /*rPosAry*/,
                             const SalBitmap& /*rSalBitmap*/,
                             SalColor /*nMaskColor*/ )
 {

Modified: openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.hxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.hxx (original)
+++ openoffice/branches/l10n/main/vcl/unx/headless/svppspgraphics.hxx Sun Feb  3 13:23:59 2013
@@ -51,6 +51,12 @@ class PspGraphics : public SalGraphics
 
 protected:
     virtual bool drawAlphaBitmap( const SalTwoRect&, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap );
+    virtual bool drawTransformedBitmap(
+        const basegfx::B2DPoint& rNull,
+        const basegfx::B2DPoint& rX,
+        const basegfx::B2DPoint& rY,
+        const SalBitmap& rSourceBitmap,
+        const SalBitmap* pAlphaBitmap);
     virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency );
 
 public:
@@ -163,17 +169,17 @@ public:
                                       long nSrcWidth,
                                       long nSrcHeight,
                                       sal_uInt16 nFlags );
-    virtual void			copyBits( const SalTwoRect* pPosAry,
+    virtual void			copyBits( const SalTwoRect& rPosAry,
                                       SalGraphics* pSrcGraphics );
-    virtual void			drawBitmap( const SalTwoRect* pPosAry,
+    virtual void			drawBitmap( const SalTwoRect& rPosAry,
                                         const SalBitmap& rSalBitmap );
-    virtual void			drawBitmap( const SalTwoRect* pPosAry,
+    virtual void			drawBitmap( const SalTwoRect& rPosAry,
                                         const SalBitmap& rSalBitmap,
                                         SalColor nTransparentColor );
-    virtual void			drawBitmap( const SalTwoRect* pPosAry,
+    virtual void			drawBitmap( const SalTwoRect& rPosAry,
                                         const SalBitmap& rSalBitmap,
                                         const SalBitmap& rTransparentBitmap );
-    virtual void			drawMask( const SalTwoRect* pPosAry,
+    virtual void			drawMask( const SalTwoRect& rPosAry,
                                       const SalBitmap& rSalBitmap,
                                       SalColor nMaskColor );
     virtual SalBitmap*		getBitmap( long nX, long nY, long nWidth, long nHeight );

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salbmp.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salbmp.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salbmp.cxx Sun Feb  3 13:23:59 2013
@@ -19,26 +19,32 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
 #include <tools/svwin.h>
-
 #include <vcl/bitmap.hxx> // for BitmapSystemData
 #include <vcl/salbtype.hxx>
-
 #include <win/wincomp.hxx>
 #include <win/salgdi.h>
 #include <win/saldata.hxx>
 #include <win/salbmp.h>
-
 #include <string.h>
+#include <vcl/timer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <map>
+
+#ifndef min
+#define min(a,b)	(((a) < (b)) ? (a) : (b))
+#endif
+#ifndef max
+#define max(a,b)	(((a) > (b)) ? (a) : (b))
+#endif
 
-// -----------
+#include <GdiPlus.h>
+
+// ------------------------------------------------------------------
 // - Inlines -
-// -----------
 
 inline void ImplSetPixel4( const HPBYTE pScanline, long nX, const BYTE cIndex )
 {
@@ -48,14 +54,139 @@ inline void ImplSetPixel4( const HPBYTE 
 				 ( rByte &= 0x0f, rByte |= ( cIndex << 4 ) );
 }
 
-// ----------------
+// ------------------------------------------------------------------
+// Helper class to manage Gdiplus::Bitmap instances inside of
+// WinSalBitmap
+
+struct Comparator
+{
+    bool operator()(WinSalBitmap* pA, WinSalBitmap* pB) const
+    {
+        return pA < pB;
+    }
+};
+
+typedef ::std::map< WinSalBitmap*, sal_uInt32, Comparator > EntryMap;
+static const sal_uInt32 nDefaultCycles(60);
+
+class GdiPlusBuffer : protected comphelper::OBaseMutex, public Timer
+{
+private:
+    EntryMap        maEntries;
+
+public:
+    GdiPlusBuffer() 
+    :   Timer(),
+        maEntries()
+    {
+        SetTimeout(1000);
+        Stop();
+    }
+
+    ~GdiPlusBuffer()
+    {
+        Stop();
+    }
+
+    void addEntry(WinSalBitmap& rEntry)
+    {
+        ::osl::MutexGuard aGuard(m_aMutex);
+        EntryMap::iterator aFound = maEntries.find(&rEntry);
+
+        if(aFound == maEntries.end())
+        {
+            if(maEntries.empty())
+            {
+                Start();
+            }
+
+            maEntries[&rEntry] = nDefaultCycles;
+        }
+    }
+
+    void remEntry(WinSalBitmap& rEntry)
+    {
+        ::osl::MutexGuard aGuard(m_aMutex);
+        EntryMap::iterator aFound = maEntries.find(&rEntry);
+
+        if(aFound != maEntries.end())
+        {
+            maEntries.erase(aFound);
+
+            if(maEntries.empty())
+            {
+                Stop();
+            }
+        }
+    }
+
+    void touchEntry(WinSalBitmap& rEntry)
+    {
+        ::osl::MutexGuard aGuard(m_aMutex);
+        EntryMap::iterator aFound = maEntries.find(&rEntry);
+
+        if(aFound != maEntries.end())
+        {
+            aFound->second = nDefaultCycles;
+        }
+    }
+
+    // from parent Timer
+    virtual void Timeout()
+    {
+        ::osl::MutexGuard aGuard(m_aMutex);
+        EntryMap::iterator aIter(maEntries.begin());
+
+        while(aIter != maEntries.end())
+        {
+            if(aIter->second)
+            {
+                aIter->second--;
+                aIter++;
+            }
+            else
+            {
+                EntryMap::iterator aDelete(aIter);
+                WinSalBitmap* pSource = aDelete->first;
+                aIter++;
+                maEntries.erase(aDelete);
+
+                if(maEntries.empty())
+                {
+                    Stop();
+                }
+
+                // delete at WinSalBitmap after entry is removed; this
+                // way it would not hurt to call remEntry from there, too
+                if(pSource->maGdiPlusBitmap.get())
+                {
+                    pSource->maGdiPlusBitmap.reset();
+                }
+            }
+        }
+
+        if(!maEntries.empty())
+        {
+            Start();
+        }
+    }
+};
+
+// ------------------------------------------------------------------
+// Global instance of GdiPlusBuffer which manages Gdiplus::Bitmap
+// instances
+
+static GdiPlusBuffer aGdiPlusBuffer;
+
+// ------------------------------------------------------------------
 // - WinSalBitmap -
-// ----------------
 
-WinSalBitmap::WinSalBitmap() :
-		mhDIB		( 0 ),
-		mhDDB		( 0 ),
-		mnBitCount	( 0 )
+WinSalBitmap::WinSalBitmap() 
+:   maSize(),
+    mhDIB(0),
+    mhDDB(0),
+    maGdiPlusBitmap(),
+    mnBitCount(0)
 {
 }
 
@@ -68,6 +199,292 @@ WinSalBitmap::~WinSalBitmap()
 
 // ------------------------------------------------------------------
 
+void WinSalBitmap::Destroy()
+{
+    if(maGdiPlusBitmap.get())
+    {
+        aGdiPlusBuffer.remEntry(*this);
+    }
+
+    if( mhDIB )
+		GlobalFree( mhDIB );
+	else if( mhDDB )
+		DeleteObject( mhDDB );
+
+	maSize = Size();
+	mnBitCount = 0;
+}
+
+// ------------------------------------------------------------------
+
+GdiPlusBmpPtr WinSalBitmap::ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource) const 
+{ 
+    if(maGdiPlusBitmap.get())
+    {
+        aGdiPlusBuffer.touchEntry(const_cast< WinSalBitmap& >(*this));
+    }
+    else
+    {
+        if(maSize.Width() > 0 && maSize.Height() > 0)
+        {
+            WinSalBitmap* pThat = const_cast< WinSalBitmap* >(this);
+
+            if(pAlphaSource)
+            {
+                pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap(*pAlphaSource));
+            }
+            else
+            {
+                pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap());
+            }
+
+            if(maGdiPlusBitmap.get())
+            {
+                aGdiPlusBuffer.addEntry(*pThat);
+            }
+        }
+    }
+
+    return maGdiPlusBitmap; 
+}
+
+// ------------------------------------------------------------------
+
+Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
+{
+    Gdiplus::Bitmap* pRetval(0);
+    WinSalBitmap* pSalRGB = const_cast< WinSalBitmap* >(this);
+    WinSalBitmap* pExtraWinSalRGB = 0;
+
+    if(!pSalRGB->ImplGethDIB())
+    {
+        // we need DIB for success with AcquireBuffer, create a replacement WinSalBitmap
+        pExtraWinSalRGB = new WinSalBitmap();
+        pExtraWinSalRGB->Create(*pSalRGB, pSalRGB->GetBitCount());
+        pSalRGB = pExtraWinSalRGB;
+    }
+
+    BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(true);
+    BitmapBuffer* pExtraRGB = 0;
+
+    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;
+
+        pExtraRGB = StretchAndConvert( 
+            *pRGB,
+            aSalTwoRect,
+            BMP_FORMAT_24BIT_TC_BGR,
+            0);
+
+        pSalRGB->ReleaseBuffer(pRGB, true);
+        pRGB = pExtraRGB;
+    }
+
+    if(pRGB 
+        && pRGB->mnWidth > 0
+        && pRGB->mnHeight > 0
+        && BMP_FORMAT_24BIT_TC_BGR == (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN))
+    {
+        const sal_uInt32 nW(pRGB->mnWidth);
+        const sal_uInt32 nH(pRGB->mnHeight);
+
+        pRetval = new Gdiplus::Bitmap(nW, nH, PixelFormat24bppRGB);
+
+        if(pRetval)
+        {
+            sal_uInt8* pSrcRGB(pRGB->mpBits);
+            const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
+            const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+
+            for(sal_uInt32 y(0); y < nH; y++)
+            {
+                const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+
+                for(sal_uInt32 x(0); x < nW; x++)
+                {
+                    const sal_uInt8 nB(*pSrcRGB++);
+                    const sal_uInt8 nG(*pSrcRGB++);
+                    const sal_uInt8 nR(*pSrcRGB++);
+
+                    pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nR, nG, nB));
+                }
+
+                pSrcRGB += nExtraRGB;
+            }
+        }
+    }
+
+    if(pExtraRGB)
+    {
+        delete pExtraRGB;
+    }
+    else
+    {
+        pSalRGB->ReleaseBuffer(pRGB, true);
+    }
+
+    if(pExtraWinSalRGB)
+    {
+        delete pExtraWinSalRGB;
+    }
+
+    return pRetval;
+}
+
+// ------------------------------------------------------------------
+
+Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource)
+{
+    Gdiplus::Bitmap* pRetval(0);
+    WinSalBitmap* pSalRGB = const_cast< WinSalBitmap* >(this);
+    WinSalBitmap* pExtraWinSalRGB = 0;
+
+    if(!pSalRGB->ImplGethDIB())
+    {
+        // we need DIB for success with AcquireBuffer, create a replacement WinSalBitmap
+        pExtraWinSalRGB = new WinSalBitmap();
+        pExtraWinSalRGB->Create(*pSalRGB, pSalRGB->GetBitCount());
+        pSalRGB = pExtraWinSalRGB;
+    }
+
+    BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(true);
+    BitmapBuffer* pExtraRGB = 0;
+
+    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;
+
+        pExtraRGB = StretchAndConvert( 
+            *pRGB,
+            aSalTwoRect,
+            BMP_FORMAT_24BIT_TC_BGR,
+            0);
+
+        pSalRGB->ReleaseBuffer(pRGB, true);
+        pRGB = pExtraRGB;
+    }
+
+    WinSalBitmap* pSalA = const_cast< WinSalBitmap* >(&rAlphaSource);
+    WinSalBitmap* pExtraWinSalA = 0;
+
+    if(!pSalA->ImplGethDIB())
+    {
+        // we need DIB for success with AcquireBuffer, create a replacement WinSalBitmap
+        pExtraWinSalA = new WinSalBitmap();
+        pExtraWinSalA->Create(*pSalA, pSalA->GetBitCount());
+        pSalA = pExtraWinSalA;
+    }
+
+    BitmapBuffer* pA = pSalA->AcquireBuffer(true);
+    BitmapBuffer* pExtraA = 0;
+
+    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;
+        const BitmapPalette& rTargetPalette = Bitmap::GetGreyPalette(256);
+
+        pExtraA = StretchAndConvert( 
+            *pA,
+            aSalTwoRect,
+            BMP_FORMAT_8BIT_PAL,
+            &rTargetPalette);
+
+        pSalA->ReleaseBuffer(pA, true);
+        pA = pExtraA;
+    }
+
+    if(pRGB 
+        && pA 
+        && pRGB->mnWidth > 0
+        && pRGB->mnHeight > 0
+        && pRGB->mnWidth == pA->mnWidth 
+        && pRGB->mnHeight == pA->mnHeight 
+        && BMP_FORMAT_24BIT_TC_BGR == (pRGB->mnFormat & ~BMP_FORMAT_TOP_DOWN)
+        && BMP_FORMAT_8BIT_PAL == (pA->mnFormat & ~BMP_FORMAT_TOP_DOWN))
+    {
+        // we have alpha and bitmap in known formats, create GdiPlus Bitmap as 32bit ARGB
+        const sal_uInt32 nW(pRGB->mnWidth);
+        const sal_uInt32 nH(pRGB->mnHeight);
+
+        pRetval = new Gdiplus::Bitmap(nW, nH, PixelFormat32bppARGB);
+
+        if(pRetval)
+        {
+            sal_uInt8* pSrcRGB(pRGB->mpBits);
+            sal_uInt8* pSrcA(pA->mpBits);
+            const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
+            const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
+            const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+
+            for(sal_uInt32 y(0); y < nH; y++)
+            {
+                const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+
+                for(sal_uInt32 x(0); x < nW; x++)
+                {
+                    const sal_uInt8 nB(*pSrcRGB++);
+                    const sal_uInt8 nG(*pSrcRGB++);
+                    const sal_uInt8 nR(*pSrcRGB++);
+                    const sal_uInt8 nA(0xff - *pSrcA++);
+
+                    pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nA, nR, nG, nB));
+                }
+
+                pSrcRGB += nExtraRGB;
+                pSrcA += nExtraA;
+            }
+        }
+    }
+
+    if(pExtraA)
+    {
+        delete pExtraA;
+    }
+    else
+    {
+        pSalA->ReleaseBuffer(pA, true);
+    }
+
+    if(pExtraWinSalA)
+    {
+        delete pExtraWinSalA;
+    }
+
+    if(pExtraRGB)
+    {
+        delete pExtraRGB;
+    }
+    else
+    {
+        pSalRGB->ReleaseBuffer(pRGB, true);
+    }
+
+    if(pExtraWinSalRGB)
+    {
+        delete pExtraWinSalRGB;
+    }
+
+    return pRetval;
+}
+
+// ------------------------------------------------------------------
+
 bool WinSalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle )
 {
 	bool bRet = TRUE;
@@ -177,7 +594,7 @@ bool WinSalBitmap::Create( const SalBitm
 	{
 		PBITMAPINFO 		pBI = (PBITMAPINFO) GlobalLock( rSalBmp.mhDIB );
 		PBITMAPINFOHEADER	pBIH = (PBITMAPINFOHEADER) pBI;
-		HDC 				hDC  = pGraphics->mhDC;
+		HDC 				hDC  = pGraphics->getHDC();
 		HBITMAP 			hNewDDB;
 		BITMAP				aDDBInfo;
 		PBYTE				pBits = (PBYTE) pBI + *(DWORD*) pBI +
@@ -264,19 +681,6 @@ bool WinSalBitmap::Create( const SalBitm
 
 // ------------------------------------------------------------------
 
-void WinSalBitmap::Destroy()
-{
-	if( mhDIB )
-		GlobalFree( mhDIB );
-	else if( mhDDB )
-		DeleteObject( mhDDB );
-
-	maSize = Size();
-	mnBitCount = 0;
-}
-
-// ------------------------------------------------------------------
-
 sal_uInt16 WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB )
 {
 	sal_uInt16 nColors = 0;

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi.cxx Sun Feb  3 13:23:59 2013
@@ -524,16 +524,16 @@ void ImplSalInitGraphics( WinSalGraphics
 	// Beim Printer berechnen wir die minimale Linienstaerke
 	if ( pData->mbPrinter )
 	{
-		int nDPIX = GetDeviceCaps( pData->mhDC, LOGPIXELSX );
+		int nDPIX = GetDeviceCaps( pData->getHDC(), LOGPIXELSX );
 		if ( nDPIX <= 300 )
 			pData->mnPenWidth = 0;
 		else
 			pData->mnPenWidth = nDPIX/300;
 	}
 
-	::SetTextAlign( pData->mhDC, TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
-	::SetBkMode( pData->mhDC, TRANSPARENT );
-	::SetROP2( pData->mhDC, R2_COPYPEN );
+	::SetTextAlign( pData->getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
+	::SetBkMode( pData->getHDC(), TRANSPARENT );
+	::SetROP2( pData->getHDC(), R2_COPYPEN );
 }
 
 // -----------------------------------------------------------------------
@@ -541,14 +541,14 @@ void ImplSalInitGraphics( WinSalGraphics
 void ImplSalDeInitGraphics( WinSalGraphics* pData )
 {
     // clear clip region
-	SelectClipRgn( pData->mhDC, 0 );
+	SelectClipRgn( pData->getHDC(), 0 );
 	// select default objects
 	if ( pData->mhDefPen )
-		SelectPen( pData->mhDC, pData->mhDefPen );
+		SelectPen( pData->getHDC(), pData->mhDefPen );
 	if ( pData->mhDefBrush )
-		SelectBrush( pData->mhDC, pData->mhDefBrush );
+		SelectBrush( pData->getHDC(), pData->mhDefBrush );
 	if ( pData->mhDefFont )
-		SelectFont( pData->mhDC, pData->mhDefFont );
+		SelectFont( pData->getHDC(), pData->mhDefFont );
 }
 
 // =======================================================================
@@ -733,7 +733,7 @@ WinSalGraphics::WinSalGraphics()
 
     mfFontScale = 1.0;
 
-	mhDC 				= 0;
+	mhLocalDC			= 0;
 	mhPen				= 0;
 	mhBrush				= 0;
 	mhRegion 			= 0;
@@ -795,8 +795,8 @@ WinSalGraphics::~WinSalGraphics()
 
 void WinSalGraphics::GetResolution( long& rDPIX, long& rDPIY )
 {
-	rDPIX = GetDeviceCaps( mhDC, LOGPIXELSX );
-	rDPIY = GetDeviceCaps( mhDC, LOGPIXELSY );
+	rDPIX = GetDeviceCaps( getHDC(), LOGPIXELSX );
+	rDPIY = GetDeviceCaps( getHDC(), LOGPIXELSY );
 
     // #111139# this fixes the symptom of div by zero on startup
     // however, printing will fail most likely as communication with
@@ -809,7 +809,7 @@ void WinSalGraphics::GetResolution( long
 
 sal_uInt16 WinSalGraphics::GetBitCount()
 {
-	return (sal_uInt16)GetDeviceCaps( mhDC, BITSPIXEL );
+	return (sal_uInt16)GetDeviceCaps( getHDC(), BITSPIXEL );
 }
 
 // -----------------------------------------------------------------------
@@ -846,7 +846,7 @@ void WinSalGraphics::ResetClipRegion()
 		mhRegion = 0;
 	}
 
-	SelectClipRgn( mhDC, 0 );
+	SelectClipRgn( getHDC(), 0 );
 }
 
 // -----------------------------------------------------------------------
@@ -1054,7 +1054,7 @@ bool WinSalGraphics::setClipRegion( cons
 	}
 
 	if( mhRegion )
-	    SelectClipRgn( mhDC, mhRegion );
+	    SelectClipRgn( getHDC(), mhRegion );
 	return mhRegion != 0;
 }
 
@@ -1064,7 +1064,7 @@ void WinSalGraphics::SetLineColor()
 {
 	// create and select new pen
 	HPEN hNewPen = GetStockPen( NULL_PEN );
-	HPEN hOldPen = SelectPen( mhDC, hNewPen );
+	HPEN hOldPen = SelectPen( getHDC(), hNewPen );
 
 	// destory or save old pen
 	if ( mhPen )
@@ -1122,7 +1122,7 @@ void WinSalGraphics::SetLineColor( SalCo
 	}
 
 	// select new pen
-	HPEN hOldPen = SelectPen( mhDC, hNewPen );
+	HPEN hOldPen = SelectPen( getHDC(), hNewPen );
 
 	// destory or save old pen
 	if ( mhPen )
@@ -1146,7 +1146,7 @@ void WinSalGraphics::SetFillColor()
 {
 	// create and select new brush
 	HBRUSH hNewBrush = GetStockBrush( NULL_BRUSH );
-	HBRUSH hOldBrush = SelectBrush( mhDC, hNewBrush );
+	HBRUSH hOldBrush = SelectBrush( getHDC(), hNewBrush );
 
 	// destory or save old brush
 	if ( mhBrush )
@@ -1250,7 +1250,7 @@ void WinSalGraphics::SetFillColor( SalCo
 	}
 
 	// select new brush
-	HBRUSH hOldBrush = SelectBrush( mhDC, hNewBrush );
+	HBRUSH hOldBrush = SelectBrush( getHDC(), hNewBrush );
 
 	// destory or save old brush
 	if ( mhBrush )
@@ -1273,7 +1273,7 @@ void WinSalGraphics::SetFillColor( SalCo
 void WinSalGraphics::SetXORMode( bool bSet, bool )
 {
 	mbXORMode = bSet;
-	::SetROP2( mhDC, bSet ? R2_XORPEN : R2_COPYPEN );
+	::SetROP2( getHDC(), bSet ? R2_XORPEN : R2_COPYPEN );
 }
 
 // -----------------------------------------------------------------------
@@ -1297,13 +1297,13 @@ void WinSalGraphics::drawPixel( long nX,
 	if ( mbXORMode )
 	{
 		HBRUSH	hBrush = CreateSolidBrush( mnPenColor );
-		HBRUSH	hOldBrush = SelectBrush( mhDC, hBrush );
-		PatBlt( mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
-		SelectBrush( mhDC, hOldBrush );
+		HBRUSH	hOldBrush = SelectBrush( getHDC(), hBrush );
+		PatBlt( getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
+		SelectBrush( getHDC(), hOldBrush );
 		DeleteBrush( hBrush );
 	}
 	else
-		SetPixel( mhDC, (int)nX, (int)nY, mnPenColor );
+		SetPixel( getHDC(), (int)nX, (int)nY, mnPenColor );
 }
 
 // -----------------------------------------------------------------------
@@ -1322,20 +1322,20 @@ void WinSalGraphics::drawPixel( long nX,
 	if ( mbXORMode )
 	{
 		HBRUSH	hBrush = CreateSolidBrush( nCol );
-		HBRUSH	hOldBrush = SelectBrush( mhDC, hBrush );
-		PatBlt( mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
-		SelectBrush( mhDC, hOldBrush );
+		HBRUSH	hOldBrush = SelectBrush( getHDC(), hBrush );
+		PatBlt( getHDC(), (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
+		SelectBrush( getHDC(), hOldBrush );
 		DeleteBrush( hBrush );
 	}
 	else
-		::SetPixel( mhDC, (int)nX, (int)nY, nCol );
+		::SetPixel( getHDC(), (int)nX, (int)nY, nCol );
 }
 
 // -----------------------------------------------------------------------
 
 void WinSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
 {
-	MoveToEx( mhDC, (int)nX1, (int)nY1, NULL );
+	MoveToEx( getHDC(), (int)nX1, (int)nY1, NULL );
 
 	// we must paint the endpoint
 	int bPaintEnd = TRUE;
@@ -1356,20 +1356,20 @@ void WinSalGraphics::drawLine( long nX1,
 			nX2--;
 	}
 
-	LineTo( mhDC, (int)nX2, (int)nY2 );
+	LineTo( getHDC(), (int)nX2, (int)nY2 );
 
 	if ( bPaintEnd && !mbPrinter )
 	{
 		if ( mbXORMode )
 		{
 			HBRUSH	hBrush = CreateSolidBrush( mnPenColor );
-			HBRUSH	hOldBrush = SelectBrush( mhDC, hBrush );
-			PatBlt( mhDC, (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT );
-			SelectBrush( mhDC, hOldBrush );
+			HBRUSH	hOldBrush = SelectBrush( getHDC(), hBrush );
+			PatBlt( getHDC(), (int)nX2, (int)nY2, (int)1, (int)1, PATINVERT );
+			SelectBrush( getHDC(), hOldBrush );
 			DeleteBrush( hBrush );
 		}
 		else
-			SetPixel( mhDC, (int)nX2, (int)nY2, mnPenColor );
+			SetPixel( getHDC(), (int)nX2, (int)nY2, mnPenColor );
 	}
 }
 
@@ -1381,7 +1381,7 @@ void WinSalGraphics::drawRect( long nX, 
 	{
 		if ( !mbPrinter )
 		{
-			PatBlt( mhDC, (int)nX, (int)nY, (int)nWidth, (int)nHeight,
+			PatBlt( getHDC(), (int)nX, (int)nY, (int)nWidth, (int)nHeight,
 					mbXORMode ? PATINVERT : PATCOPY );
 		}
 		else
@@ -1391,11 +1391,11 @@ void WinSalGraphics::drawRect( long nX, 
 			aWinRect.top	= nY;
 			aWinRect.right	= nX+nWidth;
 			aWinRect.bottom = nY+nHeight;
-			::FillRect( mhDC, &aWinRect, mhBrush );
+			::FillRect( getHDC(), &aWinRect, mhBrush );
 		}
 	}
 	else
-		WIN_Rectangle( mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
+		WIN_Rectangle( getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
 }
 
 // -----------------------------------------------------------------------
@@ -1409,8 +1409,8 @@ void WinSalGraphics::drawPolyLine( sal_u
 	POINT* pWinPtAry = (POINT*)pPtAry;
 	// Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
 	// von Punkten
-	if ( !Polyline( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
-		Polyline( mhDC, pWinPtAry, MAX_64KSALPOINTS );
+	if ( !Polyline( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+		Polyline( getHDC(), pWinPtAry, MAX_64KSALPOINTS );
 }
 
 // -----------------------------------------------------------------------
@@ -1424,8 +1424,8 @@ void WinSalGraphics::drawPolygon( sal_uL
 	POINT* pWinPtAry = (POINT*)pPtAry;
 	// Wegen Windows 95 und der Beschraenkung auf eine maximale Anzahl
 	// von Punkten
-	if ( !WIN_Polygon( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
-		WIN_Polygon( mhDC, pWinPtAry, MAX_64KSALPOINTS );
+	if ( !WIN_Polygon( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+		WIN_Polygon( getHDC(), pWinPtAry, MAX_64KSALPOINTS );
 }
 
 // -----------------------------------------------------------------------
@@ -1471,7 +1471,7 @@ void WinSalGraphics::drawPolyPolygon( sa
 		n += nPoints;
 	}
 
-	if ( !WIN_PolyPolygon( mhDC, pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) &&
+	if ( !WIN_PolyPolygon( getHDC(), pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) &&
 		 (nPolyPolyPoints > MAX_64KSALPOINTS) )
 	{
 		nPolyPolyPoints  = 0;
@@ -1486,9 +1486,9 @@ void WinSalGraphics::drawPolyPolygon( sa
 		if ( pWinPointAry[(UINT)nPoly] > MAX_64KSALPOINTS )
 			pWinPointAry[(UINT)nPoly] = MAX_64KSALPOINTS;
 		if ( nPoly == 1 )
-			WIN_Polygon( mhDC, pWinPointAryAry, *pWinPointAry );
+			WIN_Polygon( getHDC(), pWinPointAryAry, *pWinPointAry );
 		else
-			WIN_PolyPolygon( mhDC, pWinPointAryAry, (int*)pWinPointAry, nPoly );
+			WIN_PolyPolygon( getHDC(), pWinPointAryAry, (int*)pWinPointAry, nPoly );
 	}
 
 	if ( pWinPointAry != aWinPointAry )
@@ -1510,7 +1510,7 @@ sal_Bool WinSalGraphics::drawPolyLineBez
 	DBG_ASSERT( sizeof( POINT ) == sizeof( SalPoint ),
 				"WinSalGraphics::DrawPolyLineBezier(): POINT != SalPoint" );
 
-    ImplRenderPath( mhDC, nPoints, pPtAry, pFlgAry );
+    ImplRenderPath( getHDC(), nPoints, pPtAry, pFlgAry );
 
     return sal_True;
 #else
@@ -1546,13 +1546,13 @@ sal_Bool WinSalGraphics::drawPolygonBezi
 
     sal_Bool bRet( sal_False );
 
-    if( BeginPath( mhDC ) )
+    if( BeginPath( getHDC() ) )
     {
-        PolyDraw(mhDC, pWinPointAry, pWinFlagAry, nPoints);
+        PolyDraw(getHDC(), pWinPointAry, pWinFlagAry, nPoints);
 
-        if( EndPath( mhDC ) )
+        if( EndPath( getHDC() ) )
         {
-            if( StrokeAndFillPath( mhDC ) )
+            if( StrokeAndFillPath( getHDC() ) )
                 bRet = sal_True;
         }
     }
@@ -1603,13 +1603,13 @@ sal_Bool WinSalGraphics::drawPolyPolygon
 
     sal_Bool bRet( sal_False );
 
-    if( BeginPath( mhDC ) )
+    if( BeginPath( getHDC() ) )
     {
-        PolyDraw(mhDC, pWinPointAry, pWinFlagAry, nTotalPoints);
+        PolyDraw(getHDC(), pWinPointAry, pWinFlagAry, nTotalPoints);
 
-        if( EndPath( mhDC ) )
+        if( EndPath( getHDC() ) )
         {
-            if( StrokeAndFillPath( mhDC ) )
+            if( StrokeAndFillPath( getHDC() ) )
                 bRet = sal_True;
         }
     }
@@ -1719,7 +1719,7 @@ sal_Bool WinSalGraphics::drawEPS( long n
 	{
 		int nEscape = POSTSCRIPT_PASSTHROUGH;
 
-		if ( Escape( mhDC, QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) )
+		if ( Escape( getHDC(), QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) )
 		{
 			double	nBoundingBox[4];
 
@@ -1806,7 +1806,7 @@ sal_Bool WinSalGraphics::drawEPS( long n
                 // #107797# Write out buffer
                 // ----------------------------------------------------------------------------------
 				*((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 );
-				Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
+				Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
 
 
                 // #107797# Write out EPS transformation code
@@ -1826,7 +1826,7 @@ sal_Bool WinSalGraphics::drawEPS( long n
                 aBuf.append( "] concat\n"
                              "%%BeginDocument:\n" );
 				*((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 );
-				Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
+				Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
 
 
                 // #107797# Write out actual EPS content
@@ -1842,7 +1842,7 @@ sal_Bool WinSalGraphics::drawEPS( long n
                     // of size POSTSCRIPT_BUFSIZE at construction time of aBuf
 					*((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)nDoNow;
 					memcpy( (void*)(aBuf.getStr() + 2), (BYTE*)pPtr + nSize - nToDo, nDoNow );
-					sal_uLong nResult = Escape ( mhDC, nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 );
+					sal_uLong nResult = Escape ( getHDC(), nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 );
 					if (!nResult )
 						break;
 					nToDo -= nResult;
@@ -1858,7 +1858,7 @@ sal_Bool WinSalGraphics::drawEPS( long n
                              "countdictstack dict_count_salWin sub {end} repeat\n"
                              "b4_Inc_state_salWin restore\n\n" );
 				*((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 );
-				Escape ( mhDC, nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
+				Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
 				bRetValue = TRUE;
 			}
 		}
@@ -1873,7 +1873,7 @@ SystemGraphicsData WinSalGraphics::GetGr
 {
     SystemGraphicsData aRes;
     aRes.nSize = sizeof(aRes);
-    aRes.hDC = mhDC;
+    aRes.hDC = const_cast< WinSalGraphics* >(this)->getHDC();
     return aRes;
 }
 

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi2.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi2.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi2.cxx Sun Feb  3 13:23:59 2013
@@ -59,42 +59,42 @@ bool WinSalGraphics::supportsOperation( 
 
 // =======================================================================
 
-void WinSalGraphics::copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics )
+void WinSalGraphics::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics )
 {
 	HDC 	hSrcDC;
 	DWORD	nRop;
 
 	if ( pSrcGraphics )
-		hSrcDC = static_cast<WinSalGraphics*>(pSrcGraphics)->mhDC;
+		hSrcDC = static_cast<WinSalGraphics*>(pSrcGraphics)->getHDC();
 	else
-		hSrcDC = mhDC;
+		hSrcDC = getHDC();
 
 	if ( mbXORMode )
 		nRop = SRCINVERT;
 	else
 		nRop = SRCCOPY;
 
-	if ( (pPosAry->mnSrcWidth  == pPosAry->mnDestWidth) &&
-		 (pPosAry->mnSrcHeight == pPosAry->mnDestHeight) )
+	if ( (rPosAry.mnSrcWidth  == rPosAry.mnDestWidth) &&
+		 (rPosAry.mnSrcHeight == rPosAry.mnDestHeight) )
 	{
-		BitBlt( mhDC,
-				(int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
-				(int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+		BitBlt( getHDC(),
+				(int)rPosAry.mnDestX, (int)rPosAry.mnDestY,
+				(int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight,
 				hSrcDC,
-				(int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
+				(int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY,
 				nRop );
 	}
 	else
 	{
-		int nOldStretchMode = SetStretchBltMode( mhDC, STRETCH_DELETESCANS );
-		StretchBlt( mhDC,
-					(int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
-					(int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+		int nOldStretchMode = SetStretchBltMode( getHDC(), STRETCH_DELETESCANS );
+		StretchBlt( getHDC(),
+					(int)rPosAry.mnDestX, (int)rPosAry.mnDestY,
+					(int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight,
 					hSrcDC,
-					(int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
-					(int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight,
+					(int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY,
+					(int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight,
 					nRop );
-		SetStretchBltMode( mhDC, nOldStretchMode );
+		SetStretchBltMode( getHDC(), nOldStretchMode );
 	}
 }
 
@@ -285,19 +285,19 @@ void WinSalGraphics::copyArea( long nDes
                     // we will prevent bitblt from copying useless data
                     // epsecially now shadows from overlapping windows will appear (#i36344)
                     hOldClipRgn = CreateRectRgn( 0, 0, 0, 0 );
-                    nOldClipRgnType = GetClipRgn( mhDC, hOldClipRgn );
+                    nOldClipRgnType = GetClipRgn( getHDC(), hOldClipRgn );
 
                     bRestoreClipRgn = TRUE; // indicate changed clipregion and force invalidate
-                    ExtSelectClipRgn( mhDC, hInvalidateRgn, RGN_DIFF );
+                    ExtSelectClipRgn( getHDC(), hInvalidateRgn, RGN_DIFF );
 				}
 			}
 		}
 	}
 
-	BitBlt( mhDC,
+	BitBlt( getHDC(),
 			(int)nDestX, (int)nDestY,
 			(int)nSrcWidth, (int)nSrcHeight,
-			mhDC,
+			getHDC(),
 			(int)nSrcX, (int)nSrcY,
 			SRCCOPY );
 
@@ -305,7 +305,7 @@ void WinSalGraphics::copyArea( long nDes
     {
         // restore old clip region
         if( nOldClipRgnType != ERROR )
-            SelectClipRgn( mhDC, hOldClipRgn);
+            SelectClipRgn( getHDC(), hOldClipRgn);
         DeleteRegion( hOldClipRgn );
 
         // invalidate regions that were not copied
@@ -313,7 +313,7 @@ void WinSalGraphics::copyArea( long nDes
 
 		// Combine Invalidate Region with existing ClipRegion
         HRGN    hTempRgn = CreateRectRgn( 0, 0, 0, 0 );
-		if ( GetClipRgn( mhDC, hTempRgn ) == 1 )
+		if ( GetClipRgn( getHDC(), hTempRgn ) == 1 )
         {
 			int nRgnType = CombineRgn( hInvalidateRgn, hTempRgn, hInvalidateRgn, RGN_AND );
 		    if ( (nRgnType == ERROR) || (nRgnType == NULLREGION) )
@@ -342,7 +342,7 @@ void WinSalGraphics::copyArea( long nDes
 // -----------------------------------------------------------------------
 
 void ImplDrawBitmap( HDC hDC,
-					 const SalTwoRect* pPosAry, const WinSalBitmap& rSalBitmap,
+					 const SalTwoRect& rPosAry, const WinSalBitmap& rSalBitmap,
 					 sal_Bool bPrinter, int nDrawMode )
 {
 	if( hDC )
@@ -370,10 +370,10 @@ void ImplDrawBitmap( HDC hDC,
 			const int			nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS );
 
 			StretchDIBits( hDC,
-                           (int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
-                           (int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
-                           (int)pPosAry->mnSrcX, (int)(pBIH->biHeight - pPosAry->mnSrcHeight - pPosAry->mnSrcY),
-                           (int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight,
+                           (int)rPosAry.mnDestX, (int)rPosAry.mnDestY,
+                           (int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight,
+                           (int)rPosAry.mnSrcX, (int)(pBIH->biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY),
+                           (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight,
                            pBits, pBI, DIB_RGB_COLORS, nDrawMode );
 
 			GlobalUnlock( hDrawDIB );
@@ -392,14 +392,14 @@ void ImplDrawBitmap( HDC hDC,
 				nOldTextColor = ::SetTextColor( hDC, RGB( 0x00, 0x00, 0x00 ) );
 			}
 
-			if ( (pPosAry->mnSrcWidth  == pPosAry->mnDestWidth) &&
-				 (pPosAry->mnSrcHeight == pPosAry->mnDestHeight) )
+			if ( (rPosAry.mnSrcWidth  == rPosAry.mnDestWidth) &&
+				 (rPosAry.mnSrcHeight == rPosAry.mnDestHeight) )
 			{
 				BitBlt( hDC,
-						(int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
-						(int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+						(int)rPosAry.mnDestX, (int)rPosAry.mnDestY,
+						(int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight,
 						hBmpDC,
-						(int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
+						(int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY,
 						nDrawMode );
 			}
 			else
@@ -407,11 +407,11 @@ void ImplDrawBitmap( HDC hDC,
 				const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS );
 
 				StretchBlt( hDC,
-							(int)pPosAry->mnDestX, (int)pPosAry->mnDestY,
-							(int)pPosAry->mnDestWidth, (int)pPosAry->mnDestHeight,
+							(int)rPosAry.mnDestX, (int)rPosAry.mnDestY,
+							(int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight,
 							hBmpDC,
-							(int)pPosAry->mnSrcX, (int)pPosAry->mnSrcY,
-							(int)pPosAry->mnSrcWidth, (int)pPosAry->mnSrcHeight,
+							(int)rPosAry.mnSrcX, (int)rPosAry.mnSrcY,
+							(int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight,
 							nDrawMode );
 
 				SetStretchBltMode( hDC, nOldStretchMode );
@@ -433,17 +433,36 @@ void ImplDrawBitmap( HDC hDC,
 
 // -----------------------------------------------------------------------
 
-void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
-							  const SalBitmap& rSalBitmap )
+void WinSalGraphics::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap)
 {
-	ImplDrawBitmap( mhDC, pPosAry, static_cast<const WinSalBitmap&>(rSalBitmap),
-					mbPrinter,
-					mbXORMode ? SRCINVERT : SRCCOPY );
+    bool bTryDirectPaint(!mbPrinter && !mbXORMode);
+
+    if(bTryDirectPaint)
+    {
+        // only paint direct when no scaling and no MapMode, else the
+        // more expensive conversions may be done for short-time Bitmap/BitmapEx
+        // used for buffering only
+        if(rPosAry.mnSrcWidth == rPosAry.mnDestWidth && rPosAry.mnSrcHeight == rPosAry.mnDestHeight)
+        {
+            bTryDirectPaint = false;
+        }
+    }
+
+    // try to draw using GdiPlus directly
+    if(bTryDirectPaint && tryDrawBitmapGdiPlus(rPosAry, rSalBitmap))
+    {
+        return;
+    }
+
+    // fall back old stuff
+    ImplDrawBitmap(getHDC(), rPosAry, static_cast<const WinSalBitmap&>(rSalBitmap),
+        mbPrinter,
+        mbXORMode ? SRCINVERT : SRCCOPY );
 }
 
 // -----------------------------------------------------------------------
 
-void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
+void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry,
 							  const SalBitmap& rSSalBitmap,
 							  SalColor nTransparentColor )
 {
@@ -492,28 +511,46 @@ void WinSalGraphics::drawBitmap( const S
 
 	// hMaskBitmap is destroyed by new SalBitmap 'pMask' ( bDIB==FALSE, bCopy == FALSE )
 	if( pMask->Create( hMaskBitmap, FALSE, FALSE ) )
-		drawBitmap( pPosAry, rSalBitmap, *pMask );
+		drawBitmap( rPosAry, rSalBitmap, *pMask );
 
 	delete pMask;
 }
 
 // -----------------------------------------------------------------------
 
-void WinSalGraphics::drawBitmap( const SalTwoRect* pPosAry,
+void WinSalGraphics::drawBitmap( const SalTwoRect& rPosAry,
 							  const SalBitmap& rSSalBitmap,
 							  const SalBitmap& rSTransparentBitmap )
 {
 	DBG_ASSERT( !mbPrinter, "No transparency print possible!" );
+    bool bTryDirectPaint(!mbPrinter && !mbXORMode);
+
+    if(bTryDirectPaint)
+    {
+        // only paint direct when no scaling and no MapMode, else the
+        // more expensive conversions may be done for short-time Bitmap/BitmapEx
+        // used for buffering only
+        if(rPosAry.mnSrcWidth == rPosAry.mnDestWidth && rPosAry.mnSrcHeight == rPosAry.mnDestHeight)
+        {
+            bTryDirectPaint = false;
+        }
+    }
+
+    // try to draw using GdiPlus directly
+    if(bTryDirectPaint && drawAlphaBitmap(rPosAry, rSSalBitmap, rSTransparentBitmap))
+    {
+        return;
+    }
 
     const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap);
     const WinSalBitmap& rTransparentBitmap = static_cast<const WinSalBitmap&>(rSTransparentBitmap);
 
-	SalTwoRect	aPosAry = *pPosAry;
+	SalTwoRect	aPosAry = rPosAry;
 	int 		nDstX = (int)aPosAry.mnDestX;
 	int 		nDstY = (int)aPosAry.mnDestY;
 	int 		nDstWidth = (int)aPosAry.mnDestWidth;
 	int 		nDstHeight = (int)aPosAry.mnDestHeight;
-	HDC 		hDC = mhDC;
+	HDC 		hDC = getHDC();
 	HBITMAP 	hMemBitmap = 0;
 	HBITMAP 	hMaskBitmap = 0;
 
@@ -537,17 +574,17 @@ void WinSalGraphics::drawBitmap( const S
 		WinSalBitmap aTmp;
 
 		if( aTmp.Create( rTransparentBitmap, this ) )
-			ImplDrawBitmap( hMaskDC, &aPosAry, aTmp, FALSE, SRCCOPY );
+			ImplDrawBitmap( hMaskDC, aPosAry, aTmp, FALSE, SRCCOPY );
 	}
 	else
-		ImplDrawBitmap( hMaskDC, &aPosAry, rTransparentBitmap, FALSE, SRCCOPY );
+		ImplDrawBitmap( hMaskDC, aPosAry, rTransparentBitmap, FALSE, SRCCOPY );
 
     // now MemDC contains background, MaskDC the transparency mask
 
     // #105055# Respect XOR mode
     if( mbXORMode )
     {
-        ImplDrawBitmap( hMaskDC, &aPosAry, rSalBitmap, FALSE, SRCERASE );
+        ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, FALSE, SRCERASE );
         // now MaskDC contains the bitmap area with black background
         BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCINVERT );
         // now MemDC contains background XORed bitmap area ontop
@@ -556,7 +593,7 @@ void WinSalGraphics::drawBitmap( const S
     {
         BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCAND );       
         // now MemDC contains background with masked-out bitmap area
-        ImplDrawBitmap( hMaskDC, &aPosAry, rSalBitmap, FALSE, SRCERASE );
+        ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, FALSE, SRCERASE );
         // now MaskDC contains the bitmap area with black background
         BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCPAINT );
         // now MemDC contains background and bitmap merged together
@@ -577,19 +614,6 @@ void WinSalGraphics::drawBitmap( const S
 
 // -----------------------------------------------------------------------
 
-bool WinSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
-				      const SalBitmap&  rSrcBitmap, 
-				      const SalBitmap&  rAlphaBmp )
-{
-    (void)rTR; (void)rSrcBitmap; (void)rAlphaBmp;
-
-    // TODO(P3): implement alpha bmp blits. Catch: Windows only
-    // handles 32bpp, premultiplied bitmaps
-    return false;
-}
-
-// -----------------------------------------------------------------------
-
 bool WinSalGraphics::drawAlphaRect( long nX, long nY, long nWidth, 
                                     long nHeight, sal_uInt8 nTransparency )
 {
@@ -608,7 +632,7 @@ bool WinSalGraphics::drawAlphaRect( long
 
     // hMemDC contains a 1x1 bitmap of the right color - stretch-blit
     // that to dest hdc
-    bool bRet = AlphaBlend( mhDC, nX, nY, nWidth, nHeight, 
+    bool bRet = AlphaBlend( getHDC(), nX, nY, nWidth, nHeight, 
                             hMemDC, 0,0,1,1,
                             aFunc ) == TRUE;
 
@@ -619,7 +643,7 @@ bool WinSalGraphics::drawAlphaRect( long
 
 // -----------------------------------------------------------------------
 
-void WinSalGraphics::drawMask( const SalTwoRect* pPosAry,
+void WinSalGraphics::drawMask( const SalTwoRect& rPosAry,
 							const SalBitmap& rSSalBitmap,
 							SalColor nMaskColor )
 {
@@ -627,11 +651,11 @@ void WinSalGraphics::drawMask( const Sal
 
     const WinSalBitmap& rSalBitmap = static_cast<const WinSalBitmap&>(rSSalBitmap);
 
-	SalTwoRect	aPosAry = *pPosAry;
+	SalTwoRect	aPosAry = rPosAry;
 	const BYTE	cRed = SALCOLOR_RED( nMaskColor );
 	const BYTE	cGreen = SALCOLOR_GREEN( nMaskColor );
 	const BYTE	cBlue = SALCOLOR_BLUE( nMaskColor );
-	HDC 		hDC = mhDC;
+	HDC 		hDC = getHDC();
 	HBRUSH		hMaskBrush = CreateSolidBrush( RGB( cRed, cGreen, cBlue ) );
 	HBRUSH		hOldBrush = SelectBrush( hDC, hMaskBrush );
 
@@ -643,10 +667,10 @@ void WinSalGraphics::drawMask( const Sal
 		WinSalBitmap aTmp;
 
 		if( aTmp.Create( rSalBitmap, this ) )
-			ImplDrawBitmap( hDC, &aPosAry, aTmp, FALSE, 0x00B8074AUL );
+			ImplDrawBitmap( hDC, aPosAry, aTmp, FALSE, 0x00B8074AUL );
 	}
 	else
-		ImplDrawBitmap( hDC, &aPosAry, rSalBitmap, FALSE, 0x00B8074AUL );
+		ImplDrawBitmap( hDC, aPosAry, rSalBitmap, FALSE, 0x00B8074AUL );
 
 	SelectBrush( hDC, hOldBrush );
 	DeleteBrush( hMaskBrush );
@@ -663,7 +687,7 @@ SalBitmap* WinSalGraphics::getBitmap( lo
 	nDX = labs( nDX );
 	nDY = labs( nDY );
 
-	HDC 	hDC = mhDC;
+	HDC 	hDC = getHDC();
 	HBITMAP hBmpBitmap = CreateCompatibleBitmap( hDC, nDX, nDY );
 	HDC 	hBmpDC = ImplGetCachedDC( CACHED_HDC_1, hBmpBitmap );
 	sal_Bool	bRet;
@@ -696,7 +720,7 @@ SalBitmap* WinSalGraphics::getBitmap( lo
 
 SalColor WinSalGraphics::getPixel( long nX, long nY )
 {
-	COLORREF aWinCol = ::GetPixel( mhDC, (int) nX, (int) nY );
+	COLORREF aWinCol = ::GetPixel( getHDC(), (int) nX, (int) nY );
 
 	if ( CLR_INVALID == aWinCol )
 		return MAKE_SALCOLOR( 0, 0, 0 );
@@ -713,15 +737,15 @@ void WinSalGraphics::invert( long nX, lo
 	if ( nFlags & SAL_INVERT_TRACKFRAME )
 	{
 		HPEN	hDotPen = CreatePen( PS_DOT, 0, 0 );
-		HPEN	hOldPen = SelectPen( mhDC, hDotPen );
-		HBRUSH	hOldBrush = SelectBrush( mhDC, GetStockBrush( NULL_BRUSH ) );
-		int 	nOldROP = SetROP2( mhDC, R2_NOT );
-
-		WIN_Rectangle( mhDC, (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
-
-		SetROP2( mhDC, nOldROP );
-		SelectPen( mhDC, hOldPen );
-		SelectBrush( mhDC, hOldBrush );
+		HPEN	hOldPen = SelectPen( getHDC(), hDotPen );
+		HBRUSH	hOldBrush = SelectBrush( getHDC(), GetStockBrush( NULL_BRUSH ) );
+		int 	nOldROP = SetROP2( getHDC(), R2_NOT );
+
+		WIN_Rectangle( getHDC(), (int)nX, (int)nY, (int)(nX+nWidth), (int)(nY+nHeight) );
+
+		SetROP2( getHDC(), nOldROP );
+		SelectPen( getHDC(), hOldPen );
+		SelectBrush( getHDC(), hOldBrush );
 		DeletePen( hDotPen );
 	}
 	else if ( nFlags & SAL_INVERT_50 )
@@ -734,11 +758,11 @@ void WinSalGraphics::invert( long nX, lo
 			pSalData->mh50Brush = CreatePatternBrush( pSalData->mh50Bmp );
 		}
 
-		COLORREF nOldTextColor = ::SetTextColor( mhDC, 0 );
-		HBRUSH hOldBrush = SelectBrush( mhDC, pSalData->mh50Brush );
-		PatBlt( mhDC, nX, nY, nWidth, nHeight, PATINVERT );
-		::SetTextColor( mhDC, nOldTextColor );
-		SelectBrush( mhDC, hOldBrush );
+		COLORREF nOldTextColor = ::SetTextColor( getHDC(), 0 );
+		HBRUSH hOldBrush = SelectBrush( getHDC(), pSalData->mh50Brush );
+		PatBlt( getHDC(), nX, nY, nWidth, nHeight, PATINVERT );
+		::SetTextColor( getHDC(), nOldTextColor );
+		SelectBrush( getHDC(), hOldBrush );
 	}
 	else
 	{
@@ -747,7 +771,7 @@ void WinSalGraphics::invert( long nX, lo
 		 aRect.top		 = (int)nY;
 		 aRect.right	 = (int)nX+nWidth;
 		 aRect.bottom	 = (int)nY+nHeight;
-		 ::InvertRect( mhDC, &aRect );
+		 ::InvertRect( getHDC(), &aRect );
 	}
 }
 
@@ -760,7 +784,7 @@ void WinSalGraphics::invert( sal_uLong n
 	HBRUSH		hBrush;
 	HBRUSH		hOldBrush = 0;
 	COLORREF	nOldTextColor RGB(0,0,0);
-	int 		nOldROP = SetROP2( mhDC, R2_NOT );
+	int 		nOldROP = SetROP2( getHDC(), R2_NOT );
 
 	if ( nSalFlags & SAL_INVERT_TRACKFRAME )
 		hPen = CreatePen( PS_DOT, 0, 0 );
@@ -783,10 +807,10 @@ void WinSalGraphics::invert( sal_uLong n
 			hBrush = GetStockBrush( BLACK_BRUSH );
 
 		hPen = GetStockPen( NULL_PEN );
-		nOldTextColor = ::SetTextColor( mhDC, 0 );
-		hOldBrush = SelectBrush( mhDC, hBrush );
+		nOldTextColor = ::SetTextColor( getHDC(), 0 );
+		hOldBrush = SelectBrush( getHDC(), hBrush );
 	}
-	hOldPen = SelectPen( mhDC, hPen );
+	hOldPen = SelectPen( getHDC(), hPen );
 
 	POINT* pWinPtAry;
 	// Unter NT koennen wir das Array direkt weiterreichen
@@ -798,23 +822,23 @@ void WinSalGraphics::invert( sal_uLong n
 	// von Punkten
 	if ( nSalFlags & SAL_INVERT_TRACKFRAME )
 	{
-		if ( !Polyline( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
-			Polyline( mhDC, pWinPtAry, MAX_64KSALPOINTS );
+		if ( !Polyline( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+			Polyline( getHDC(), pWinPtAry, MAX_64KSALPOINTS );
 	}
 	else
 	{
-		if ( !WIN_Polygon( mhDC, pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
-			WIN_Polygon( mhDC, pWinPtAry, MAX_64KSALPOINTS );
+		if ( !WIN_Polygon( getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
+			WIN_Polygon( getHDC(), pWinPtAry, MAX_64KSALPOINTS );
 	}
 
-	SetROP2( mhDC, nOldROP );
-	SelectPen( mhDC, hOldPen );
+	SetROP2( getHDC(), nOldROP );
+	SelectPen( getHDC(), hOldPen );
 
 	if ( nSalFlags & SAL_INVERT_TRACKFRAME )
 		DeletePen( hPen );
 	else
 	{
-		::SetTextColor( mhDC, nOldTextColor );
-		SelectBrush( mhDC, hOldBrush );
+		::SetTextColor( getHDC(), nOldTextColor );
+		SelectBrush( getHDC(), hOldBrush );
 	}
 }

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi3.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi3.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi3.cxx Sun Feb  3 13:23:59 2013
@@ -1339,7 +1339,7 @@ void WinSalGraphics::SetTextColor( SalCo
         aCol = PALRGB_TO_RGB( aCol );
     }
 
-    ::SetTextColor( mhDC, aCol );
+    ::SetTextColor( getHDC(), aCol );
 }
 
 // -----------------------------------------------------------------------
@@ -1545,7 +1545,7 @@ HFONT WinSalGraphics::ImplDoSetFont( Imp
     if( true/*aSalShlData.mbWNT*/ )
     {
         LOGFONTW aLogFont;
-        ImplGetLogFontFromFontSelect( mhDC, i_pFont, aLogFont, true );
+        ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true );
 
         // on the display we prefer Courier New when Courier is a
         // bitmap only font and we need to stretch or rotate it
@@ -1587,17 +1587,17 @@ HFONT WinSalGraphics::ImplDoSetFont( Imp
             // "PRB: Fonts Not Drawn Antialiased on Device Context for DirectDraw Surface"
             SelectFont( hdcScreen, SelectFont( hdcScreen , hNewFont ) );
         }
-        o_rOldFont = ::SelectFont( mhDC, hNewFont );
+        o_rOldFont = ::SelectFont( getHDC(), hNewFont );
 
         TEXTMETRICW aTextMetricW;
-        if( !::GetTextMetricsW( mhDC, &aTextMetricW ) )
+        if( !::GetTextMetricsW( getHDC(), &aTextMetricW ) )
         {
             // the selected font doesn't work => try a replacement
             // TODO: use its font fallback instead
             lstrcpynW( aLogFont.lfFaceName, L"Courier New", 11 );
             aLogFont.lfPitchAndFamily = FIXED_PITCH;
             HFONT hNewFont2 = CreateFontIndirectW( &aLogFont );
-            SelectFont( mhDC, hNewFont2 );
+            SelectFont( getHDC(), hNewFont2 );
             DeleteFont( hNewFont );
             hNewFont = hNewFont2;
         }
@@ -1616,7 +1616,7 @@ sal_uInt16 WinSalGraphics::SetFont( Impl
     {
         // deselect still active font
         if( mhDefFont )
-            ::SelectFont( mhDC, mhDefFont );
+            ::SelectFont( getHDC(), mhDefFont );
         // release no longer referenced font handles
         for( int i = nFallbackLevel; i < MAX_FALLBACK; ++i )
         {
@@ -1657,7 +1657,7 @@ sal_uInt16 WinSalGraphics::SetFont( Impl
     mhFonts[ nFallbackLevel ] = hNewFont;
     // now the font is live => update font face
     if( mpWinFontData[ nFallbackLevel ] )
-        mpWinFontData[ nFallbackLevel ]->UpdateFromHDC( mhDC );
+        mpWinFontData[ nFallbackLevel ]->UpdateFromHDC( getHDC() );
 
     if( !nFallbackLevel )
     {
@@ -1686,17 +1686,17 @@ sal_uInt16 WinSalGraphics::SetFont( Impl
 void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
 {
     // temporarily change the HDC to the font in the fallback level
-    HFONT hOldFont = SelectFont( mhDC, mhFonts[nFallbackLevel] );
+    HFONT hOldFont = SelectFont( getHDC(), mhFonts[nFallbackLevel] );
 
         wchar_t aFaceName[LF_FACESIZE+60];
-        if( ::GetTextFaceW( mhDC, sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) )
+        if( ::GetTextFaceW( getHDC(), sizeof(aFaceName)/sizeof(wchar_t), aFaceName ) )
             pMetric->maName = reinterpret_cast<const sal_Unicode*>(aFaceName);
 
     // get the font metric
     TEXTMETRICA aWinMetric;
-    const bool bOK = GetTextMetricsA( mhDC, &aWinMetric );
+    const bool bOK = GetTextMetricsA( getHDC(), &aWinMetric );
     // restore the HDC to the font in the base level
-    SelectFont( mhDC, hOldFont );
+    SelectFont( getHDC(), hOldFont );
     if( !bOK )
         return;
 
@@ -1715,7 +1715,7 @@ void WinSalGraphics::GetFontMetric( Impl
     {
         // check if there are kern pairs
         // TODO: does this work with GPOS kerning?
-        DWORD nKernPairs = ::GetKerningPairsA( mhDC, 0, NULL );
+        DWORD nKernPairs = ::GetKerningPairsA( getHDC(), 0, NULL );
         pMetric->mbKernableFont = (nKernPairs > 0);
     }
     else
@@ -1787,8 +1787,8 @@ static void ImplGetAllFontCharSets( WinS
     LOGFONTA aLogFont;
     memset( &aLogFont, 0, sizeof( aLogFont ) );
     aLogFont.lfCharSet = DEFAULT_CHARSET;
-    GetTextFaceA( pData->mhDC, sizeof( aLogFont.lfFaceName ), aLogFont.lfFaceName );
-    EnumFontFamiliesExA( pData->mhDC, &aLogFont, (FONTENUMPROCA)SalEnumCharSetsProcExA,
+    GetTextFaceA( pData->getHDC(), sizeof( aLogFont.lfFaceName ), aLogFont.lfFaceName );
+    EnumFontFamiliesExA( pData->getHDC(), &aLogFont, (FONTENUMPROCA)SalEnumCharSetsProcExA,
                          (LPARAM)(void*)pData, 0 );
 }
 
@@ -1796,12 +1796,12 @@ static void ImplGetAllFontCharSets( WinS
 
 static void ImplAddKerningPairs( WinSalGraphics* pData )
 {
-    sal_uLong nPairs = ::GetKerningPairsA( pData->mhDC, 0, NULL );
+    sal_uLong nPairs = ::GetKerningPairsA( pData->getHDC(), 0, NULL );
     if ( !nPairs )
         return;
 
     CHARSETINFO aInfo;
-    if ( !TranslateCharsetInfo( (DWORD*)(sal_uLong)GetTextCharset( pData->mhDC ), &aInfo, TCI_SRCCHARSET ) )
+    if ( !TranslateCharsetInfo( (DWORD*)(sal_uLong)GetTextCharset( pData->getHDC() ), &aInfo, TCI_SRCCHARSET ) )
         return;
 
     if ( !pData->mpFontKernPairs )
@@ -1818,7 +1818,7 @@ static void ImplAddKerningPairs( WinSalG
     UINT            nCP = aInfo.ciACP;
     sal_uLong           nOldPairs = pData->mnFontKernPairCount;
     KERNINGPAIR*    pTempPair = pData->mpFontKernPairs+pData->mnFontKernPairCount;
-    nPairs = ::GetKerningPairsA( pData->mhDC, nPairs, pTempPair );
+    nPairs = ::GetKerningPairsA( pData->getHDC(), nPairs, pTempPair );
     for ( sal_uLong i = 0; i < nPairs; i++ )
     {
         unsigned char   aBuf[2];
@@ -1908,18 +1908,18 @@ sal_uLong WinSalGraphics::GetKernPairs( 
         mnFontKernPairCount = 0;
 
         KERNINGPAIR* pPairs = NULL;
-        int nCount = ::GetKerningPairsW( mhDC, 0, NULL );
+        int nCount = ::GetKerningPairsW( getHDC(), 0, NULL );
         if( nCount )
         {
             #ifdef GCP_KERN_HACK
             pPairs = new KERNINGPAIR[ nCount+1 ];
             mpFontKernPairs = pPairs;
             mnFontKernPairCount = nCount;
-            ::GetKerningPairsW( mhDC, nCount, pPairs );
+            ::GetKerningPairsW( getHDC(), nCount, pPairs );
             #else // GCP_KERN_HACK
             pPairs = pKernPairs;
             nCount = (nCount < nPairs) : nCount : nPairs;
-            ::GetKerningPairsW( mhDC, nCount, pPairs );
+            ::GetKerningPairsW( getHDC(), nCount, pPairs );
             return nCount;
             #endif // GCP_KERN_HACK
         }
@@ -2374,7 +2374,7 @@ void WinSalGraphics::GetDevFontList( Imp
     }
 
     ImplEnumInfo aInfo;
-    aInfo.mhDC          = mhDC;
+    aInfo.mhDC          = getHDC();
     aInfo.mpList        = pFontList;
     aInfo.mpName        = NULL;
     aInfo.mpLogFontA    = NULL;
@@ -2403,7 +2403,7 @@ void WinSalGraphics::GetDevFontList( Imp
     memset( &aLogFont, 0, sizeof( aLogFont ) );
     aLogFont.lfCharSet = DEFAULT_CHARSET;
     aInfo.mpLogFontW = &aLogFont;
-    EnumFontFamiliesExW( mhDC, &aLogFont,
+    EnumFontFamiliesExW( getHDC(), &aLogFont,
             (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 );
 
     // Feststellen, was es fuer Courier-Schriften auf dem Bildschirm gibt,
@@ -2415,7 +2415,7 @@ void WinSalGraphics::GetDevFontList( Imp
     }
 
 	// set glyph fallback hook
-	static WinGlyphFallbackSubstititution aSubstFallback( mhDC );
+	static WinGlyphFallbackSubstititution aSubstFallback( getHDC() );
 	pFontList->SetFallbackHook( &aSubstFallback );
 }
 
@@ -2428,7 +2428,7 @@ void WinSalGraphics::GetDevFontSubstList
 
 sal_Bool WinSalGraphics::GetGlyphBoundRect( long nIndex, Rectangle& rRect )
 {
-    HDC hDC = mhDC;
+    HDC hDC = getHDC();
 
     // use unity matrix
     MAT2 aMat;
@@ -2463,7 +2463,7 @@ sal_Bool WinSalGraphics::GetGlyphOutline
 {
     rB2DPolyPoly.clear();
 
-    HDC  hDC = mhDC;
+    HDC  hDC = getHDC();
 
     // use unity matrix
     MAT2 aMat;
@@ -2667,7 +2667,7 @@ ScopedFont::~ScopedFont()
         // restore original font, destroy temporary font
         HFONT hTempFont = m_rData.mhFonts[0];
         m_rData.mhFonts[0] = m_hOrigFont;
-        SelectObject( m_rData.mhDC, m_hOrigFont );
+        SelectObject( m_rData.getHDC(), m_hOrigFont );
         DeleteObject( hTempFont );
     }
 }
@@ -2722,7 +2722,7 @@ sal_Bool WinSalGraphics::CreateFontSubse
 #if OSL_DEBUG_LEVEL > 1
     // get font metrics
     TEXTMETRICA aWinMetric;
-    if( !::GetTextMetricsA( mhDC, &aWinMetric ) )
+    if( !::GetTextMetricsA( getHDC(), &aWinMetric ) )
         return FALSE;
 
     DBG_ASSERT( !(aWinMetric.tmPitchAndFamily & TMPF_DEVICE), "cannot subset device font" );
@@ -2737,10 +2737,10 @@ sal_Bool WinSalGraphics::CreateFontSubse
 
 	// check if the font has a CFF-table
 	const DWORD nCffTag = CalcTag( "CFF " );
-	const RawFontData aRawCffData( mhDC, nCffTag );
+	const RawFontData aRawCffData( getHDC(), nCffTag );
 	if( aRawCffData.get() )
 	{
-		pWinFontData->UpdateFromHDC( mhDC );
+		pWinFontData->UpdateFromHDC( getHDC() );
 		const ImplFontCharMap* pCharMap = pWinFontData->GetImplFontCharMap();
 		pCharMap->AddReference();
 		
@@ -2770,7 +2770,7 @@ sal_Bool WinSalGraphics::CreateFontSubse
 	}
 
     // get raw font file data
-    const RawFontData xRawFontData( mhDC, NULL );
+    const RawFontData xRawFontData( getHDC(), NULL );
     if( !xRawFontData.get() )
 		return FALSE;
 
@@ -2870,19 +2870,19 @@ const void* WinSalGraphics::GetEmbedFont
     SetFont( &aIFSD, 0 );
 
     // get the raw font file data
-    RawFontData aRawFontData( mhDC );
+    RawFontData aRawFontData( getHDC() );
     *pDataLen = aRawFontData.size();
     if( !aRawFontData.get() )
         return NULL;
 
     // get important font properties
     TEXTMETRICA aTm;
-    if( !::GetTextMetricsA( mhDC, &aTm ) )
+    if( !::GetTextMetricsA( getHDC(), &aTm ) )
         *pDataLen = 0;
     const bool bPFA = (*aRawFontData.get() < 0x80);
     rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB;
     WCHAR aFaceName[64];
-    int nFNLen = ::GetTextFaceW( mhDC, 64, aFaceName );
+    int nFNLen = ::GetTextFaceW( getHDC(), 64, aFaceName );
     // #i59854# strip eventual null byte
     while( nFNLen > 0 && aFaceName[nFNLen-1] == 0 )
         nFNLen--;
@@ -2900,7 +2900,7 @@ const void* WinSalGraphics::GetEmbedFont
     {
         int nCharWidth = 0;
         const sal_Unicode cChar = pUnicodes[i];
-        if( !::GetCharWidth32W( mhDC, cChar, cChar, &nCharWidth ) )
+        if( !::GetCharWidth32W( getHDC(), cChar, cChar, &nCharWidth ) )
             *pDataLen = 0;
         pCharWidths[i] = nCharWidth;
     }
@@ -2941,7 +2941,7 @@ const Ucs2SIntMap* WinSalGraphics::GetFo
         // TODO: get correct encoding vector
         GLYPHSET aGlyphSet;
         aGlyphSet.cbThis = sizeof(aGlyphSet);
-        DWORD aW = ::GetFontUnicodeRanges( mhDC, &aGlyphSet);
+        DWORD aW = ::GetFontUnicodeRanges( getHDC(), &aGlyphSet);
         #else
         for( sal_Unicode i = 32; i < 256; ++i )
             (*pNewEncoding)[i] = i;
@@ -2974,7 +2974,7 @@ void WinSalGraphics::GetGlyphWidths( con
     if( pFont->IsSubsettable() )
     {
         // get raw font file data
-        const RawFontData xRawFontData( mhDC );
+        const RawFontData xRawFontData( getHDC() );
 	    if( !xRawFontData.get() )
 			return;
 
@@ -3038,7 +3038,7 @@ void WinSalGraphics::GetGlyphWidths( con
         for( sal_Unicode i = 32; i < 256; ++i )
         {
             int nCharWidth = 0;
-            if( ::GetCharWidth32W( mhDC, i, i, &nCharWidth ) )
+            if( ::GetCharWidth32W( getHDC(), i, i, &nCharWidth ) )
             {
                 rUnicodeEnc[ i ] = rWidths.size();
                 rWidths.push_back( nCharWidth );

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi_gdiplus.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi_gdiplus.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi_gdiplus.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salgdi_gdiplus.cxx Sun Feb  3 13:23:59 2013
@@ -19,20 +19,17 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
 #include <stdio.h>
 #include <string.h>
-
 #include <tools/svwin.h>
 #include <tools/debug.hxx>
-
 #include <win/wincomp.hxx>
 #include <win/saldata.hxx>
 #include <win/salgdi.h>
+#include <win/salbmp.h>
 
 #ifndef min
 #define min(a,b)	(((a) < (b)) ? (a) : (b))
@@ -155,7 +152,7 @@ bool WinSalGraphics::drawPolyPolygon( co
 
 	if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0))
 	{
-		Gdiplus::Graphics aGraphics(mhDC);
+		Gdiplus::Graphics aGraphics(getHDC());
 		const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0));
 		Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor));
 		Gdiplus::SolidBrush aTestBrush(aTestColor);
@@ -198,7 +195,7 @@ bool WinSalGraphics::drawPolyLine( 
 
 	if(mbPen && nCount)
 	{
-		Gdiplus::Graphics aGraphics(mhDC);
+		Gdiplus::Graphics aGraphics(getHDC());
 		const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) );
 		Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor));
 		Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX()));
@@ -287,3 +284,201 @@ bool WinSalGraphics::drawPolyLine( 
 }
 
 // -----------------------------------------------------------------------
+
+void paintToGdiPlus(
+    Gdiplus::Graphics& rGraphics,
+    const SalTwoRect& rTR,
+    Gdiplus::Bitmap& rBitmap)
+{
+    // only parts of source are used
+    Gdiplus::PointF aDestPoints[3];
+    Gdiplus::ImageAttributes aAttributes;
+
+    // define target region as paralellogram
+    aDestPoints[0].X = Gdiplus::REAL(rTR.mnDestX);
+    aDestPoints[0].Y = Gdiplus::REAL(rTR.mnDestY);
+    aDestPoints[1].X = Gdiplus::REAL(rTR.mnDestX + rTR.mnDestWidth);
+    aDestPoints[1].Y = Gdiplus::REAL(rTR.mnDestY);
+    aDestPoints[2].X = Gdiplus::REAL(rTR.mnDestX);
+    aDestPoints[2].Y = Gdiplus::REAL(rTR.mnDestY + rTR.mnDestHeight);
+
+    aAttributes.SetWrapMode(Gdiplus::WrapModeTileFlipXY);
+
+    rGraphics.DrawImage(
+        &rBitmap, 
+        aDestPoints,
+        3,
+        Gdiplus::REAL(rTR.mnSrcX),
+        Gdiplus::REAL(rTR.mnSrcY),
+        Gdiplus::REAL(rTR.mnSrcWidth),
+        Gdiplus::REAL(rTR.mnSrcHeight),
+        Gdiplus::UnitPixel,
+        &aAttributes,
+        0,
+        0);
+}
+
+// -----------------------------------------------------------------------
+
+void setInterpolationMode(
+    Gdiplus::Graphics& rGraphics,
+    const long& rSrcWidth,
+    const long& rDestWidth,
+    const long& rSrcHeight,
+    const long& rDestHeight)
+{
+    const bool bSameWidth(rSrcWidth == rDestWidth);
+    const bool bSameHeight(rSrcHeight == rDestHeight);
+
+    if(bSameWidth && bSameHeight)
+    {
+        rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeInvalid);
+    }
+    else if(rDestWidth > rSrcWidth && rDestHeight > rSrcHeight)
+    {
+        rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeDefault);
+    }
+    else if(rDestWidth < rSrcWidth && rDestHeight < rSrcHeight)
+    {
+        rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeBicubic);
+    }
+    else
+    {
+        rGraphics.SetInterpolationMode(Gdiplus::InterpolationModeDefault);
+    }
+}
+
+
+bool WinSalGraphics::tryDrawBitmapGdiPlus(const SalTwoRect& rTR, const SalBitmap& rSrcBitmap)
+{
+    if(rTR.mnSrcWidth && rTR.mnSrcHeight && rTR.mnDestWidth && rTR.mnDestHeight)
+    {
+        const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSrcBitmap);
+        GdiPlusBmpPtr aARGB(rSalBitmap.ImplGetGdiPlusBitmap());
+
+        if(aARGB.get())
+        {
+            Gdiplus::Graphics aGraphics(getHDC());
+
+            setInterpolationMode(
+                aGraphics, 
+                rTR.mnSrcWidth,
+                rTR.mnDestWidth, 
+                rTR.mnSrcHeight,
+                rTR.mnDestHeight);
+
+            paintToGdiPlus(
+                aGraphics, 
+                rTR, 
+                *aARGB.get());
+
+            return true;
+        }
+    }
+
+    return false;
+}
+
+bool WinSalGraphics::drawAlphaBitmap( 
+    const SalTwoRect& rTR,
+    const SalBitmap& rSrcBitmap, 
+    const SalBitmap& rAlphaBmp)
+{
+    if(rTR.mnSrcWidth && rTR.mnSrcHeight && rTR.mnDestWidth && rTR.mnDestHeight)
+    {
+        const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSrcBitmap);
+        const WinSalBitmap& rSalAlpha = static_cast< const WinSalBitmap& >(rAlphaBmp);
+        GdiPlusBmpPtr aARGB(rSalBitmap.ImplGetGdiPlusBitmap(&rSalAlpha));
+
+        if(aARGB.get())
+        {
+            Gdiplus::Graphics aGraphics(getHDC());
+
+            setInterpolationMode(
+                aGraphics, 
+                rTR.mnSrcWidth,
+                rTR.mnDestWidth, 
+                rTR.mnSrcHeight,
+                rTR.mnDestHeight);
+
+            paintToGdiPlus(
+                aGraphics, 
+                rTR, 
+                *aARGB.get());
+
+            return true;
+        }
+    }
+
+    return false;
+}
+
+// -----------------------------------------------------------------------
+
+bool WinSalGraphics::drawTransformedBitmap(
+    const basegfx::B2DPoint& rNull,
+    const basegfx::B2DPoint& rX,
+    const basegfx::B2DPoint& rY,
+    const SalBitmap& rSourceBitmap,
+    const SalBitmap* pAlphaBitmap)
+{
+    const WinSalBitmap& rSalBitmap = static_cast< const WinSalBitmap& >(rSourceBitmap);
+    const WinSalBitmap* pSalAlpha = static_cast< const WinSalBitmap* >(pAlphaBitmap);
+    GdiPlusBmpPtr aARGB(rSalBitmap.ImplGetGdiPlusBitmap(pSalAlpha));
+
+    if(aARGB.get())
+    {
+        const long nSrcWidth(aARGB->GetWidth());
+        const long nSrcHeight(aARGB->GetHeight());
+
+        if(nSrcWidth && nSrcHeight)
+        {
+            const long nDestWidth(basegfx::fround(basegfx::B2DVector(rX - rNull).getLength()));
+            const long nDestHeight(basegfx::fround(basegfx::B2DVector(rY - rNull).getLength()));
+
+            if(nDestWidth && nDestHeight)
+            {
+                Gdiplus::Graphics aGraphics(getHDC());
+                Gdiplus::PointF aDestPoints[3];
+                Gdiplus::ImageAttributes aAttributes;
+
+                setInterpolationMode(
+                    aGraphics, 
+                    nSrcWidth,
+                    nDestWidth, 
+                    nSrcHeight,
+                    nDestHeight);
+
+                // this mode is only capable of drawing the whole bitmap to a paralellogram
+                aDestPoints[0].X = Gdiplus::REAL(rNull.getX());
+                aDestPoints[0].Y = Gdiplus::REAL(rNull.getY());
+                aDestPoints[1].X = Gdiplus::REAL(rX.getX());
+                aDestPoints[1].Y = Gdiplus::REAL(rX.getY());
+                aDestPoints[2].X = Gdiplus::REAL(rY.getX());
+                aDestPoints[2].Y = Gdiplus::REAL(rY.getY());
+
+                aAttributes.SetWrapMode(Gdiplus::WrapModeTileFlipXY);
+
+                aGraphics.DrawImage(
+                    aARGB.get(), 
+                    aDestPoints, 
+                    3,
+                    Gdiplus::REAL(0.0),
+                    Gdiplus::REAL(0.0),
+                    Gdiplus::REAL(nSrcWidth),
+                    Gdiplus::REAL(nSrcHeight),
+                    Gdiplus::UnitPixel,
+                    &aAttributes,
+                    0,
+                    0);
+            }
+        }
+
+        return true;
+    }
+
+    return false;
+}
+
+// -----------------------------------------------------------------------
+// eof

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salnativewidgets-luna.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salnativewidgets-luna.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salnativewidgets-luna.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salnativewidgets-luna.cxx Sun Feb  3 13:23:59 2013
@@ -1157,15 +1157,15 @@ sal_Bool WinSalGraphics::drawNativeContr
     rc.bottom = buttonRect.Bottom()+1;
 
     // set default text alignment
-    int ta = SetTextAlign( mhDC, TA_LEFT|TA_TOP|TA_NOUPDATECP );
+    int ta = SetTextAlign( getHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP );
 
     OUString aCaptionStr( aCaption.replace('~', '&') ); // translate mnemonics
-    bOk = ImplDrawNativeControl(mhDC, hTheme, rc,
+    bOk = ImplDrawNativeControl(getHDC(), hTheme, rc,
                             nType, nPart, nState, aValue,
 							aCaptionStr );
 
     // restore alignment
-    SetTextAlign( mhDC, ta );
+    SetTextAlign( getHDC(), ta );
    
 
     //GdiFlush();

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salprn.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salprn.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salprn.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salprn.cxx Sun Feb  3 13:23:59 2013
@@ -1444,7 +1444,7 @@ static WinSalGraphics* ImplCreateSalPrnG
 {
 	WinSalGraphics* pGraphics = new WinSalGraphics;
     pGraphics->SetLayout( 0 );
-	pGraphics->mhDC		= hDC;
+	pGraphics->setHDC(hDC);
 	pGraphics->mhWnd 	= 0;
 	pGraphics->mbPrinter = TRUE;
 	pGraphics->mbVirDev	= FALSE;
@@ -1465,7 +1465,7 @@ static sal_Bool ImplUpdateSalPrnIC( WinS
 	if ( pPrinter->mpGraphics )
 	{
 		ImplSalDeInitGraphics( pPrinter->mpGraphics );
-		DeleteDC( pPrinter->mpGraphics->mhDC );
+		DeleteDC( pPrinter->mpGraphics->getHDC() );
 		delete pPrinter->mpGraphics;
 	}
 
@@ -1533,7 +1533,7 @@ WinSalInfoPrinter::~WinSalInfoPrinter()
 	if ( mpGraphics )
 	{
 		ImplSalDeInitGraphics( mpGraphics );
-		DeleteDC( mpGraphics->mhDC );
+		DeleteDC( mpGraphics->getHDC() );
 		delete mpGraphics;
 	}
 }

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/salvd.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/salvd.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/salvd.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/salvd.cxx Sun Feb  3 13:23:59 2013
@@ -94,11 +94,11 @@ SalVirtualDevice* WinSalInstance::Create
     }
     else
     {
-	    hDC 	= CreateCompatibleDC( pGraphics->mhDC );
+	    hDC 	= CreateCompatibleDC( pGraphics->getHDC() );
         if( !hDC )
             ImplWriteLastError( GetLastError(), "CreateCompatibleDC in CreateVirtualDevice" );
 
-	    hBmp	= ImplCreateVirDevBitmap( pGraphics->mhDC,
+	    hBmp	= ImplCreateVirDevBitmap( pGraphics->getHDC(),
 		                                nDX, nDY, nBitCount );
         if( !hBmp )
             ImplWriteLastError( GetLastError(), "ImplCreateVirDevBitmap in CreateVirtualDevice" );
@@ -117,7 +117,7 @@ SalVirtualDevice* WinSalInstance::Create
 		SalData*                pSalData = GetSalData();
 		WinSalGraphics*         pVirGraphics = new WinSalGraphics;
         pVirGraphics->SetLayout( 0 );   // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL()
-		pVirGraphics->mhDC	   = hDC;
+		pVirGraphics->setHDC(hDC);
 		pVirGraphics->mhWnd	   = 0;
 		pVirGraphics->mbPrinter = FALSE;
 		pVirGraphics->mbVirDev  = TRUE;
@@ -130,7 +130,7 @@ SalVirtualDevice* WinSalInstance::Create
 		}
 		ImplSalInitGraphics( pVirGraphics );
 
-		pVDev->mhDC		    = hDC;
+		pVDev->setHDC(hDC);
 		pVDev->mhBmp		= hBmp;
         if( hBmp )
 		    pVDev->mhDefBmp	= SelectBitmap( hDC, hBmp );
@@ -168,7 +168,7 @@ void WinSalInstance::DestroyVirtualDevic
 
 WinSalVirtualDevice::WinSalVirtualDevice()
 {
-	mhDC = (HDC) NULL;			// HDC or 0 for Cache Device
+	setHDC((HDC)NULL);			// HDC or 0 for Cache Device
 	mhBmp = (HBITMAP) NULL;		// Memory Bitmap
 	mhDefBmp = (HBITMAP) NULL;	// Default Bitmap
 	mpGraphics = NULL; 			// current VirDev graphics
@@ -191,12 +191,12 @@ WinSalVirtualDevice::~WinSalVirtualDevic
 
     // destroy saved DC
     if( mpGraphics->mhDefPal )
-        SelectPalette( mpGraphics->mhDC, mpGraphics->mhDefPal, TRUE );
+        SelectPalette( mpGraphics->getHDC(), mpGraphics->mhDefPal, TRUE );
     ImplSalDeInitGraphics( mpGraphics );
     if( mhDefBmp )
-        SelectBitmap( mpGraphics->mhDC, mhDefBmp );
+        SelectBitmap( mpGraphics->getHDC(), mhDefBmp );
     if( !mbForeignDC )
-        DeleteDC( mpGraphics->mhDC );
+        DeleteDC( mpGraphics->getHDC() );
     if( mhBmp )
         DeleteBitmap( mhBmp );
     delete mpGraphics;
@@ -231,11 +231,11 @@ sal_Bool WinSalVirtualDevice::SetSize( l
         return TRUE;    // ???
     else
     {
-	    HBITMAP hNewBmp = ImplCreateVirDevBitmap( mhDC, nDX, nDY,
+	    HBITMAP hNewBmp = ImplCreateVirDevBitmap( getHDC(), nDX, nDY,
 											  mnBitCount );
 	    if ( hNewBmp )
 	    {
-		    SelectBitmap( mhDC, hNewBmp );
+		    SelectBitmap( getHDC(), hNewBmp );
 		    DeleteBitmap( mhBmp );
 		    mhBmp = hNewBmp;
 		    return TRUE;
@@ -250,6 +250,6 @@ sal_Bool WinSalVirtualDevice::SetSize( l
 
 void WinSalVirtualDevice::GetSize( long& rWidth, long& rHeight )
 {
-    rWidth = GetDeviceCaps( mhDC, HORZRES );
-    rHeight= GetDeviceCaps( mhDC, VERTRES );
+    rWidth = GetDeviceCaps( getHDC(), HORZRES );
+    rHeight= GetDeviceCaps( getHDC(), VERTRES );
 }

Modified: openoffice/branches/l10n/main/vcl/win/source/gdi/winlayout.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/vcl/win/source/gdi/winlayout.cxx?rev=1441909&r1=1441908&r2=1441909&view=diff
==============================================================================
--- openoffice/branches/l10n/main/vcl/win/source/gdi/winlayout.cxx (original)
+++ openoffice/branches/l10n/main/vcl/win/source/gdi/winlayout.cxx Sun Feb  3 13:23:59 2013
@@ -644,7 +644,7 @@ void SimpleWinLayout::DrawText( SalGraph
         return;
 
     WinSalGraphics& rWinGraphics = static_cast<WinSalGraphics&>(rGraphics);
-    HDC aHDC = rWinGraphics.mhDC;
+    HDC aHDC = rWinGraphics.getHDC();
 
     HFONT hOrigFont = DisableFontScaling();
 
@@ -2937,7 +2937,7 @@ void  GraphiteWinLayout::AdjustLayout(Im
 void GraphiteWinLayout::DrawText(SalGraphics &sal_graphics) const
 {
     HFONT hOrigFont = DisableFontScaling();
-    HDC aHDC = static_cast<WinSalGraphics&>(sal_graphics).mhDC;
+    const HDC aHDC = static_cast<WinSalGraphics&>(sal_graphics).getHDC();
     maImpl.DrawBase() = WinLayout::maDrawBase;
     maImpl.DrawOffset() = WinLayout::maDrawOffset;
     const int MAX_GLYPHS = 2;
@@ -2956,7 +2956,7 @@ void GraphiteWinLayout::DrawText(SalGrap
 		              NULL, (LPCWSTR)&(glyphWStr), nGlyphs, NULL);
     } while (nGlyphs);
     if( hOrigFont )
-          DeleteFont( SelectFont( mhDC, hOrigFont ) );
+          DeleteFont( SelectFont( aHDC, hOrigFont ) );
 }
 
 int GraphiteWinLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const
@@ -3017,11 +3017,11 @@ SalLayout* WinSalGraphics::GetTextLayout
     {
 #ifdef ENABLE_GRAPHITE
         if (rFontFace.SupportsGraphite())
-            pWinLayout = new GraphiteWinLayout(mhDC, rFontFace, rFontInstance);
+            pWinLayout = new GraphiteWinLayout( getHDC(), rFontFace, rFontInstance);
         else
 #endif // ENABLE_GRAPHITE
         // script complexity is determined in upper layers
-        pWinLayout = new UniscribeLayout( mhDC, rFontFace, rFontInstance );
+        pWinLayout = new UniscribeLayout( getHDC(), rFontFace, rFontInstance );
         // NOTE: it must be guaranteed that the WinSalGraphics lives longer than
         // the created UniscribeLayout, otherwise the data passed into the
         // constructor might become invalid too early
@@ -3044,10 +3044,10 @@ SalLayout* WinSalGraphics::GetTextLayout
             eCharSet = mpLogFont->lfCharSet;
 #ifdef ENABLE_GRAPHITE
         if (rFontFace.SupportsGraphite())
-            pWinLayout = new GraphiteWinLayout(mhDC, rFontFace, rFontInstance);
+            pWinLayout = new GraphiteWinLayout( getHDC(), rFontFace, rFontInstance);
         else
 #endif // ENABLE_GRAPHITE
-            pWinLayout = new SimpleWinLayout( mhDC, eCharSet, rFontFace, rFontInstance );
+            pWinLayout = new SimpleWinLayout( getHDC(), eCharSet, rFontFace, rFontInstance );
     }
 
     if( mfFontScale != 1.0 )
@@ -3062,7 +3062,7 @@ int	WinSalGraphics::GetMinKashidaWidth()
 {
 	if( !mpWinFontEntry[0] )
 		return 0;
-	mpWinFontEntry[0]->InitKashidaHandling( mhDC );
+	mpWinFontEntry[0]->InitKashidaHandling( getHDC() );
 	int nMinKashida = static_cast<int>(mfFontScale * mpWinFontEntry[0]->GetMinKashidaWidth());
 	return nMinKashida;
 }