[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/quartz

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Nov 29 20:16:53 PST 2014


 vcl/headless/svpframe.cxx     |    4 ++
 vcl/headless/svpgdi.cxx       |    8 ----
 vcl/inc/headless/svpframe.hxx |    2 -
 vcl/inc/headless/svpgdi.hxx   |   73 +----------------------------------------
 vcl/inc/headless/svpvd.hxx    |    4 --
 vcl/inc/quartz/salbmp.h       |    4 --
 vcl/inc/quartz/salgdi.h       |   37 ++++++++++++---------
 vcl/quartz/salgdi.cxx         |   74 ++++++++++++++++++++++++------------------
 vcl/quartz/salgdicommon.cxx   |    1 
 vcl/quartz/salgdiutils.cxx    |   20 -----------
 10 files changed, 75 insertions(+), 152 deletions(-)

New commits:
commit 7514dc3424e703a58b0ae7b3b5fc0ee36ad52f9f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Oct 30 23:48:15 2014 +0100

    move the iOS SalGraphics code back into the OSX one
    
    Conflicts:
    	vcl/inc/headless/svpgdi.hxx
    
    Change-Id: I4cd9163bcbb8cdee21e5bce3303894923c4238d6

diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index dad80d1..4df6524 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -32,6 +32,10 @@ using namespace basegfx;
 
 SvpSalFrame* SvpSalFrame::s_pFocusFrame = NULL;
 
+#ifdef IOS
+#define SvpSalGraphics AquaSalGraphics
+#endif
+
 #ifndef IOS
 
 namespace {
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index a72c901..b65e7b9 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -738,12 +738,4 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
 
 #endif
 
-#ifdef IOS
-
-void  SvpSalGraphics::RefreshRect(float /* lX */, float /* lY */, float /* lWidth */, float /* lHeight */)
-{
-}
-
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index 8e0bbd4..4154252 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -29,8 +29,8 @@
 #include <list>
 
 #ifdef IOS
-#define SvpSalGraphics AquaSalGraphics
 #define SvpSalInstance AquaSalInstance
+#define SvpSalGraphics AquaSalGraphics
 #endif
 
 class SvpSalInstance;
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 9ae3d05..23b76ca 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -29,26 +29,13 @@
 #include "sallayout.hxx"
 
 #ifdef IOS
-#include "quartz/salgdi.h"
-#include <premac.h>
-#include <Foundation/Foundation.h>
-#include <CoreGraphics/CoreGraphics.h>
-#include <postmac.h>
-#endif
+#define SvpSalGraphics AquaSalGraphics
+#else
 
 class ServerFont;
 
-#ifdef IOS
-// To keep changes to the CoreText code shared with AOO to a minimum,
-// let's continue calling the SalGraphics subclass "AquaSalGraphics" even if it
-// is used by us also on iOS, where of course the term "Aqua" has no meaning at all.
-// (Note that even on OS X, using the term "Aqua" is a misunderstanding or obsolete.)
-#define SvpSalGraphics AquaSalGraphics
-#endif
-
 class SvpSalGraphics : public SalGraphics
 {
-#ifndef IOS
     basebmp::BitmapDeviceSharedPtr       m_aDevice;
     basebmp::BitmapDeviceSharedPtr       m_aOrigDevice;
 
@@ -84,42 +71,6 @@ private:
 public:
     void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice );
 
-#else
-    friend class CTLayout;
-
-    CGLayerRef                              mxLayer;
-    // mirror AquaSalVirtualDevice::mbForeignContext for SvpSalGraphics objects related to such
-    bool mbForeignContext;
-    CGContextRef                            mrContext;
-    int                                     mnContextStackDepth;
-    class XorEmulation*                     mpXorEmulation;
-    int                                     mnXorMode; // 0: off 1: on 2: invert only
-    int                                     mnWidth;
-    int                                     mnHeight;
-    int                                  mnBitmapDepth;  // zero unless bitmap
-
-    /// path representing current clip region
-    CGMutablePathRef                        mxClipPath;
-
-    /// Drawing colors
-    /// pen color RGBA
-    RGBAColor                               maLineColor;
-    /// brush color RGBA
-    RGBAColor                               maFillColor;
-
-    // Device Font settings
-    const CoreTextFontData*                 mpFontData;
-    CoreTextStyle*                          mpTextStyle;
-    RGBAColor                               maTextColor;
-    /// allows text to be rendered without antialiasing
-    bool                                    mbNonAntialiasedText;
-
-    /// is this a printer graphics
-    bool                                    mbPrinter;
-    /// is this a virtual device graphics
-    bool                                    mbVirDev;
-#endif
-
 protected:
     vcl::Region                               m_aClipRegion;
 
@@ -252,28 +203,10 @@ public:
     virtual void            BeginPaint() SAL_OVERRIDE { };
     virtual void            EndPaint() SAL_OVERRIDE { };
 
-#ifdef IOS
     void                SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, int = 0 );
+};
 
-    bool CheckContext();
-    CGContextRef GetContext();
-    bool GetRawFontData( const PhysicalFontFace* pFontData,
-                         std::vector<unsigned char>& rBuffer,
-                         bool* pJustCFF );
-    void                RefreshRect( const CGRect& ) { };
-    void                RefreshRect(float lX, float lY, float lWidth, float lHeight);
-    void                SetState();
-    void                UnsetState();
-    void                InvalidateContext();
-    bool                IsPenVisible() const    { return maLineColor.IsVisible(); }
-    bool                IsBrushVisible() const  { return maFillColor.IsVisible(); }
-    void                ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
-    CGPoint*            makeCGptArray(sal_uInt32 nPoints, const SalPoint*  pPtAry);
-    bool IsFlipped() const { return false; }
-    void ApplyXorContext();
-    void Pattern50Fill();
 #endif
-};
 
 #endif // INCLUDED_VCL_INC_HEADLESS_SVPGDI_HXX
 
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index f6a9cc5..e69bf8f 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -24,10 +24,6 @@
 
 #include <list>
 
-#ifdef IOS
-#define SvpSalGraphics AquaSalGraphics
-#endif
-
 class SvpSalGraphics;
 
 class SvpSalVirtualDevice : public SalVirtualDevice
diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h
index c98cf2f..7a012bb 100644
--- a/vcl/inc/quartz/salbmp.h
+++ b/vcl/inc/quartz/salbmp.h
@@ -26,11 +26,7 @@
 
 #include "vcl/salbtype.hxx"
 
-#ifdef MACOSX
 #include "quartz/salgdi.h"
-#else
-#include "headless/svpgdi.hxx"
-#endif
 
 #include "salinst.hxx"
 #include "salvd.hxx"
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 9a5d4da..2b7da0d 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -136,15 +136,15 @@ private:
     CTFontContainer maFontContainer;
 };
 
-#ifdef MACOSX
-
 // - AquaSalGraphics -
 
 class AquaSalGraphics : public SalGraphics
 {
     friend class CTLayout;
 protected:
+#ifdef MACOSX
     AquaSalFrame*                           mpFrame;
+#endif
     CGLayerRef                              mxLayer;    // Quartz graphics layer
     CGContextRef                            mrContext;  // Quartz drawing context
     int                                     mnContextStackDepth;
@@ -179,9 +179,17 @@ protected:
     bool                                    mbPrinter;
     /// is this a virtual device graphics
     bool                                    mbVirDev;
+#ifdef MACOSX
     /// is this a window graphics
     bool                                    mbWindow;
 
+#else // IOS
+
+    // mirror AquaSalVirtualDevice::mbForeignContext for SvpSalGraphics objects related to such
+    bool mbForeignContext;
+
+#endif
+
 public:
                             AquaSalGraphics();
     virtual                 ~AquaSalGraphics();
@@ -192,7 +200,7 @@ public:
     void                    SetWindowGraphics( AquaSalFrame* pFrame );
     void                    SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY );
     void                    SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
-
+#ifdef MACOSX
     void                    initResolution( NSWindow* );
     void                    copyResolution( AquaSalGraphics& );
     void                    updateResolution();
@@ -200,16 +208,18 @@ public:
     bool                    IsWindowGraphics()      const   { return mbWindow; }
     AquaSalFrame*           getGraphicsFrame() const { return mpFrame; }
     void                    setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; }
+#endif
 
     void                    ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
 
     bool                    CheckContext();
     CGContextRef            GetContext();
+#ifdef MACOSX
     void                    UpdateWindow( NSRect& ); // delivered in NSView coordinates
-#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
-    void                    RefreshRect( const CGRect& );
-#endif
     void                    RefreshRect( const NSRect& );
+#else
+    void                    RefreshRect( const CGRect& ) {}
+#endif
     void                    RefreshRect(float lX, float lY, float lWidth, float lHeight);
 
     void                    SetState();
@@ -292,6 +302,7 @@ public:
 
     CGPoint*                makeCGptArray(sal_uInt32 nPoints, const SalPoint*  pPtAry);
     // native widget rendering methods that require mirroring
+#ifdef MACOSX
     virtual bool            hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
                                                   const Point& aPos, bool& rIsInside ) SAL_OVERRIDE;
     virtual bool            drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
@@ -300,6 +311,7 @@ public:
     virtual bool            getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
                                                     const ImplControlValue& aValue, const OUString& aCaption,
                                                     Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
+#endif
 
     // get device resolution
     virtual void            GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) SAL_OVERRIDE;
@@ -397,8 +409,10 @@ public:
     virtual void            DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE;
     virtual bool            supportsOperation( OutDevSupportType ) const SAL_OVERRIDE;
 
+#ifdef MACOSX
     // Query the platform layer for control support
     virtual bool            IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
+#endif
 
     virtual SystemGraphicsData
                             GetGraphicsData() const SAL_OVERRIDE;
@@ -410,7 +424,7 @@ public:
 private:
     // differences between VCL, Quartz and kHiThemeOrientation coordinate systems
     // make some graphics seem to be vertically-mirrored from a VCL perspective
-    bool                    IsFlipped() const { return mbWindow; }
+    bool                    IsFlipped() const;
 
     void                    ApplyXorContext();
     void                    Pattern50Fill();
@@ -423,14 +437,7 @@ private:
 
 // --- some trivial inlines
 
-#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
-
-inline void AquaSalGraphics::RefreshRect( const CGRect& rRect )
-{
-    RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
-}
-
-#endif
+#ifdef MACOSX
 
 inline void AquaSalGraphics::RefreshRect( const NSRect& rRect )
 {
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 0b1ffef..2cb8271 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -227,10 +227,11 @@ void CoreTextFontData::ReadMacCmapEncoding( void ) const
         return;
 }
 
-AquaSalGraphics::AquaSalGraphics()
+AquaSalGraphics::AquaSalGraphics():
 #ifdef MACOSX
-    : mpFrame( NULL )
-    , mxLayer( NULL )
+      mpFrame( NULL ),
+#endif
+      mxLayer( NULL )
     , mrContext( NULL )
 #if OSL_DEBUG_LEVEL > 0
     , mnContextStackDepth( 0 )
@@ -251,28 +252,10 @@ AquaSalGraphics::AquaSalGraphics()
     , mbNonAntialiasedText( false )
     , mbPrinter( false )
     , mbVirDev( false )
+#ifdef MACOSX
     , mbWindow( false )
 #else
-    : mxLayer( NULL )
     , mbForeignContext( false )
-    , mrContext( NULL )
-#if OSL_DEBUG_LEVEL > 0
-    , mnContextStackDepth( 0 )
-#endif
-    , mpXorEmulation( NULL )
-    , mnXorMode( 0 )
-    , mnWidth( 0 )
-    , mnHeight( 0 )
-    , mnBitmapDepth( 0 )
-    , mxClipPath( NULL )
-    , maLineColor( COL_WHITE )
-    , maFillColor( COL_BLACK )
-    , mpFontData( NULL )
-    , mpTextStyle( NULL )
-    , maTextColor( COL_BLACK )
-    , mbNonAntialiasedText( false )
-    , mbPrinter( false )
-    , mbVirDev( false )
 #endif
 {
     SAL_INFO( "vcl.quartz", "AquaSalGraphics::AquaSalGraphics() this=" << this );
@@ -315,15 +298,11 @@ AquaSalGraphics::~AquaSalGraphics()
     }
 }
 
-#ifndef IOS
-
 SalGraphicsImpl* AquaSalGraphics::GetImpl() const
 {
     return NULL;
 }
 
-#endif
-
 void AquaSalGraphics::SetTextColor( SalColor nSalColor )
 {
     maTextColor = RGBAColor( nSalColor );
@@ -783,11 +762,46 @@ SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
     return aSysFontData;
 }
 
-#ifdef IOS
+bool AquaSalGraphics::IsFlipped() const
+{
+#ifdef MACOSX
+    return mbWindow;
+#else
+    return false;
+#endif
+}
+
+void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeight)
+{
+#ifdef MACOSX
+    if( ! mbWindow ) // view only on Window graphics
+        return;
+
+    if( mpFrame )
+    {
+        // update a little more around the designated rectangle
+        // this helps with antialiased rendering
+        // Rounding down x and width can accumulate a rounding error of up to 2
+        // The decrementing of x, the rounding error and the antialiasing border
+        // require that the width and the height need to be increased by four
+        const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
+                    static_cast<long int>(lY-1) ),
+                 Size(  static_cast<long int>(lWidth+4),
+                    static_cast<long int>(lHeight+4) ) );
+        mpFrame->maInvalidRect.Union( aVclRect );
+    }
+#else
+    (void) lX;
+    (void) lY;
+    (void) lWidth;
+    (void) lHeight;
+    return;
+#endif
+}
 
-// Note that "SvpSalGraphics" is actually called AquaSalGraphics for iOS
+#ifdef IOS
 
-bool SvpSalGraphics::CheckContext()
+bool AquaSalGraphics::CheckContext()
 {
     if (mbForeignContext)
     {
@@ -799,7 +813,7 @@ bool SvpSalGraphics::CheckContext()
     return false;
 }
 
-CGContextRef SvpSalGraphics::GetContext()
+CGContextRef AquaSalGraphics::GetContext()
 {
     if ( !mrContext )
         CheckContext();
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 21c8d2a..1c119ab7 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -36,6 +36,7 @@
 
 #ifdef IOS
 #include "saldatabasic.hxx"
+#include <vcl/sysdata.hxx>
 #endif
 
 #if defined(IOS) && defined(DBG_UTIL)
diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index 704fef5..403651b 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -173,26 +173,6 @@ CGContextRef AquaSalGraphics::GetContext()
     return mrContext;
 }
 
-void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeight)
-{
-    if( ! mbWindow ) // view only on Window graphics
-        return;
-
-    if( mpFrame )
-    {
-        // update a little more around the designated rectangle
-        // this helps with antialiased rendering
-        // Rounding down x and width can accumulate a rounding error of up to 2
-        // The decrementing of x, the rounding error and the antialiasing border
-        // require that the width and the height need to be increased by four
-        const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
-                    static_cast<long int>(lY-1) ),
-                 Size(  static_cast<long int>(lWidth+4),
-                    static_cast<long int>(lHeight+4) ) );
-        mpFrame->maInvalidRect.Union( aVclRect );
-    }
-}
-
 void AquaSalGraphics::UpdateWindow( NSRect& )
 {
     if( !mpFrame )


More information about the Libreoffice-commits mailing list