[Libreoffice-commits] .: canvas/source

Tor Lillqvist tml at kemper.freedesktop.org
Mon Jan 24 15:52:41 PST 2011


 canvas/source/directx/dx_canvashelper_texturefill.cxx |    6 ++---
 canvas/source/directx/dx_surfacebitmap.cxx            |   20 +++++++++---------
 canvas/source/directx/dx_winstuff.hxx                 |   10 ++-------
 3 files changed, 16 insertions(+), 20 deletions(-)

New commits:
commit a82aae8c5da6d708ff0efd17d28548f6d2fa5cc0
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Tue Jan 25 01:32:10 2011 +0200

    Work around compilation errors on 64-bit Windows
    
    Again the ULONG clashes on 64-bit Windows cause pain. Work around by
    using pre/postwin.h, and that then necessitates use of explict
    WIN_BYTE instead of just BYTE. Sigh...

diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx
index 2b7ad6f..51ba495 100644
--- a/canvas/source/directx/dx_canvashelper_texturefill.cxx
+++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx
@@ -342,9 +342,9 @@ namespace dxcanvas
                     boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT);
 
                     const Gdiplus::Color aFillColor(
-                        static_cast<BYTE>( basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha) ),
-                        static_cast<BYTE>( basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha) ),
-                        static_cast<BYTE>( basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha) ) );
+                        static_cast<WIN_BYTE>( basegfx::tools::lerp(rColors[nIndex].GetRed(),rColors[nIndex+1].GetRed(),fAlpha) ),
+                        static_cast<WIN_BYTE>( basegfx::tools::lerp(rColors[nIndex].GetGreen(),rColors[nIndex+1].GetGreen(),fAlpha) ),
+                        static_cast<WIN_BYTE>( basegfx::tools::lerp(rColors[nIndex].GetBlue(),rColors[nIndex+1].GetBlue(),fAlpha) ) );
 
                     aFillBrush.SetColor( aFillColor );
                     aCurrPath.Reset(); aCurrPath.StartFigure();
diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx
index 4272e59..5c78290 100644
--- a/canvas/source/directx/dx_surfacebitmap.cxx
+++ b/canvas/source/directx/dx_surfacebitmap.cxx
@@ -370,7 +370,7 @@ namespace dxcanvas
             pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(),
                                                aSurfaceDesc.lPitch,
                                                nFormat,
-                                               (BYTE *)aSurfaceDesc.lpSurface ));
+                                               (WIN_BYTE *)aSurfaceDesc.lpSurface ));
             
             // unlock the directx surface
             mpSurface->Unlock(NULL);
@@ -387,7 +387,7 @@ namespace dxcanvas
             pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(),
                                                 aLockedRect.Pitch,
                                                 nFormat,
-                                                (BYTE *)aLockedRect.pBits ));
+                                                (WIN_BYTE *)aLockedRect.pBits ));
 
             mpSurface->UnlockRect();
         }
@@ -560,7 +560,7 @@ namespace dxcanvas
             if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
                 return uno::Sequence< sal_Int8 >();
 
-            sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1);
+            sal_uInt8 *pSrc = (sal_uInt8 *)((((WIN_BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1);
             sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray();
             sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
             for(sal_uInt32 y=0; y<nHeight; ++y) 
@@ -576,7 +576,7 @@ namespace dxcanvas
             if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
                 return uno::Sequence< sal_Int8 >();
 
-            sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1);
+            sal_uInt8 *pSrc = (sal_uInt8 *)((((WIN_BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1);
             sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray();
             sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
             for(sal_uInt32 y=0; y<nHeight; ++y) 
@@ -643,7 +643,7 @@ namespace dxcanvas
                 throw uno::RuntimeException();
 
             sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray();
-            sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1);
+            sal_uInt8 *pDst = (sal_uInt8 *)((((WIN_BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1);
             sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
             for(sal_uInt32 y=0; y<nHeight; ++y) 
             {
@@ -660,7 +660,7 @@ namespace dxcanvas
                 throw uno::RuntimeException();
 
             sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray();
-            sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1);
+            sal_uInt8 *pDst = (sal_uInt8 *)((((WIN_BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1);
             sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
             for(sal_uInt32 y=0; y<nHeight; ++y) 
             {
@@ -722,7 +722,7 @@ namespace dxcanvas
             if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
                 throw uno::RuntimeException();
 
-            sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aSurfaceDesc.lpSurface)+(pos.Y*aSurfaceDesc.lPitch))+pos.X);
+            sal_uInt32 *pDst = (sal_uInt32 *)((((WIN_BYTE *)aSurfaceDesc.lpSurface)+(pos.Y*aSurfaceDesc.lPitch))+pos.X);
             *pDst = aColor.GetValue();
             mpSurface->Unlock(NULL);
 #else
@@ -731,7 +731,7 @@ namespace dxcanvas
             if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
                 throw uno::RuntimeException();
 
-            sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
+            sal_uInt32 *pDst = (sal_uInt32 *)((((WIN_BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
             *pDst = aColor.GetValue();
             mpSurface->UnlockRect();
 #endif
@@ -780,7 +780,7 @@ namespace dxcanvas
             if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
                 throw uno::RuntimeException();
 
-            sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aSurfaceDesc.lpSurface)+(pos.Y*aSurfaceDesc.lPitch))+pos.X);
+            sal_uInt32 *pDst = (sal_uInt32 *)((((WIN_BYTE *)aSurfaceDesc.lpSurface)+(pos.Y*aSurfaceDesc.lPitch))+pos.X);
             Gdiplus::Color aColor(*pDst);
             mpSurface->Unlock(NULL);
 #else
@@ -789,7 +789,7 @@ namespace dxcanvas
             if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
                 throw uno::RuntimeException();
 
-            sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
+            sal_uInt32 *pDst = (sal_uInt32 *)((((WIN_BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
             Gdiplus::Color aColor(*pDst);
             mpSurface->UnlockRect();
 #endif
diff --git a/canvas/source/directx/dx_winstuff.hxx b/canvas/source/directx/dx_winstuff.hxx
index e92b17c..6501e53 100644
--- a/canvas/source/directx/dx_winstuff.hxx
+++ b/canvas/source/directx/dx_winstuff.hxx
@@ -66,7 +66,7 @@
 #undef WB_RIGHT
 
 #define WIN32_LEAN_AND_MEAN
-#include <windows.h> // TODO(Q1): extract minimal set of required headers for gdiplus
+#include <tools/prewin.h>
 
 #if DIRECTX_VERSION < 0x0900
 
@@ -107,6 +107,8 @@ using ::std::min;
 
 #include <gdiplus.h>
 
+#include <tools/postwin.h>
+
 #ifdef min
 #   undef min
 #endif
@@ -216,12 +218,6 @@ namespace dxcanvas
 #pragma warning(pop)
 #endif
 
-#undef DELETE
-#undef BOOL
-#undef INT32
-#undef UINT32
-#undef PolyPolygon
-
 #endif /* _DXCANVAS_WINSTUFF_HXX */
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list