Kaydet (Commit) 7514dc34 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

move the iOS SalGraphics code back into the OSX one

Conflicts:
	vcl/inc/headless/svpgdi.hxx

Change-Id: I4cd9163bcbb8cdee21e5bce3303894923c4238d6
üst d59b971a
...@@ -32,6 +32,10 @@ using namespace basegfx; ...@@ -32,6 +32,10 @@ using namespace basegfx;
SvpSalFrame* SvpSalFrame::s_pFocusFrame = NULL; SvpSalFrame* SvpSalFrame::s_pFocusFrame = NULL;
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics
#endif
#ifndef IOS #ifndef IOS
namespace { namespace {
......
...@@ -738,12 +738,4 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const ...@@ -738,12 +738,4 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
#endif #endif
#ifdef IOS
void SvpSalGraphics::RefreshRect(float /* lX */, float /* lY */, float /* lWidth */, float /* lHeight */)
{
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#include <list> #include <list>
#ifdef IOS #ifdef IOS
#define SvpSalGraphics AquaSalGraphics
#define SvpSalInstance AquaSalInstance #define SvpSalInstance AquaSalInstance
#define SvpSalGraphics AquaSalGraphics
#endif #endif
class SvpSalInstance; class SvpSalInstance;
......
...@@ -29,26 +29,13 @@ ...@@ -29,26 +29,13 @@
#include "sallayout.hxx" #include "sallayout.hxx"
#ifdef IOS #ifdef IOS
#include "quartz/salgdi.h" #define SvpSalGraphics AquaSalGraphics
#include <premac.h> #else
#include <Foundation/Foundation.h>
#include <CoreGraphics/CoreGraphics.h>
#include <postmac.h>
#endif
class ServerFont; 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 class SvpSalGraphics : public SalGraphics
{ {
#ifndef IOS
basebmp::BitmapDeviceSharedPtr m_aDevice; basebmp::BitmapDeviceSharedPtr m_aDevice;
basebmp::BitmapDeviceSharedPtr m_aOrigDevice; basebmp::BitmapDeviceSharedPtr m_aOrigDevice;
...@@ -84,42 +71,6 @@ private: ...@@ -84,42 +71,6 @@ private:
public: public:
void setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ); 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: protected:
vcl::Region m_aClipRegion; vcl::Region m_aClipRegion;
...@@ -252,28 +203,10 @@ public: ...@@ -252,28 +203,10 @@ public:
virtual void BeginPaint() SAL_OVERRIDE { }; virtual void BeginPaint() SAL_OVERRIDE { };
virtual void EndPaint() SAL_OVERRIDE { }; virtual void EndPaint() SAL_OVERRIDE { };
#ifdef IOS
void SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, int = 0 ); 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
};
#endif // INCLUDED_VCL_INC_HEADLESS_SVPGDI_HXX #endif // INCLUDED_VCL_INC_HEADLESS_SVPGDI_HXX
......
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
#include <list> #include <list>
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics
#endif
class SvpSalGraphics; class SvpSalGraphics;
class SvpSalVirtualDevice : public SalVirtualDevice class SvpSalVirtualDevice : public SalVirtualDevice
......
...@@ -26,11 +26,7 @@ ...@@ -26,11 +26,7 @@
#include "vcl/salbtype.hxx" #include "vcl/salbtype.hxx"
#ifdef MACOSX
#include "quartz/salgdi.h" #include "quartz/salgdi.h"
#else
#include "headless/svpgdi.hxx"
#endif
#include "salinst.hxx" #include "salinst.hxx"
#include "salvd.hxx" #include "salvd.hxx"
......
...@@ -136,15 +136,15 @@ private: ...@@ -136,15 +136,15 @@ private:
CTFontContainer maFontContainer; CTFontContainer maFontContainer;
}; };
#ifdef MACOSX
// - AquaSalGraphics - // - AquaSalGraphics -
class AquaSalGraphics : public SalGraphics class AquaSalGraphics : public SalGraphics
{ {
friend class CTLayout; friend class CTLayout;
protected: protected:
#ifdef MACOSX
AquaSalFrame* mpFrame; AquaSalFrame* mpFrame;
#endif
CGLayerRef mxLayer; // Quartz graphics layer CGLayerRef mxLayer; // Quartz graphics layer
CGContextRef mrContext; // Quartz drawing context CGContextRef mrContext; // Quartz drawing context
int mnContextStackDepth; int mnContextStackDepth;
...@@ -179,9 +179,17 @@ protected: ...@@ -179,9 +179,17 @@ protected:
bool mbPrinter; bool mbPrinter;
/// is this a virtual device graphics /// is this a virtual device graphics
bool mbVirDev; bool mbVirDev;
#ifdef MACOSX
/// is this a window graphics /// is this a window graphics
bool mbWindow; bool mbWindow;
#else // IOS
// mirror AquaSalVirtualDevice::mbForeignContext for SvpSalGraphics objects related to such
bool mbForeignContext;
#endif
public: public:
AquaSalGraphics(); AquaSalGraphics();
virtual ~AquaSalGraphics(); virtual ~AquaSalGraphics();
...@@ -192,7 +200,7 @@ public: ...@@ -192,7 +200,7 @@ public:
void SetWindowGraphics( AquaSalFrame* pFrame ); void SetWindowGraphics( AquaSalFrame* pFrame );
void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY ); void SetPrinterGraphics( CGContextRef, long nRealDPIX, long nRealDPIY );
void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 ); void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
#ifdef MACOSX
void initResolution( NSWindow* ); void initResolution( NSWindow* );
void copyResolution( AquaSalGraphics& ); void copyResolution( AquaSalGraphics& );
void updateResolution(); void updateResolution();
...@@ -200,16 +208,18 @@ public: ...@@ -200,16 +208,18 @@ public:
bool IsWindowGraphics() const { return mbWindow; } bool IsWindowGraphics() const { return mbWindow; }
AquaSalFrame* getGraphicsFrame() const { return mpFrame; } AquaSalFrame* getGraphicsFrame() const { return mpFrame; }
void setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; } void setGraphicsFrame( AquaSalFrame* pFrame ) { mpFrame = pFrame; }
#endif
void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels
bool CheckContext(); bool CheckContext();
CGContextRef GetContext(); CGContextRef GetContext();
#ifdef MACOSX
void UpdateWindow( NSRect& ); // delivered in NSView coordinates 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& ); void RefreshRect( const NSRect& );
#else
void RefreshRect( const CGRect& ) {}
#endif
void RefreshRect(float lX, float lY, float lWidth, float lHeight); void RefreshRect(float lX, float lY, float lWidth, float lHeight);
void SetState(); void SetState();
...@@ -292,6 +302,7 @@ public: ...@@ -292,6 +302,7 @@ public:
CGPoint* makeCGptArray(sal_uInt32 nPoints, const SalPoint* pPtAry); CGPoint* makeCGptArray(sal_uInt32 nPoints, const SalPoint* pPtAry);
// native widget rendering methods that require mirroring // native widget rendering methods that require mirroring
#ifdef MACOSX
virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
const Point& aPos, bool& rIsInside ) SAL_OVERRIDE; const Point& aPos, bool& rIsInside ) SAL_OVERRIDE;
virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, virtual bool drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
...@@ -300,6 +311,7 @@ public: ...@@ -300,6 +311,7 @@ public:
virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState, virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
const ImplControlValue& aValue, const OUString& aCaption, const ImplControlValue& aValue, const OUString& aCaption,
Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) SAL_OVERRIDE; Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
#endif
// get device resolution // get device resolution
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) SAL_OVERRIDE; virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) SAL_OVERRIDE;
...@@ -397,8 +409,10 @@ public: ...@@ -397,8 +409,10 @@ public:
virtual void DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE; virtual void DrawServerFontLayout( const ServerFontLayout& ) SAL_OVERRIDE;
virtual bool supportsOperation( OutDevSupportType ) const SAL_OVERRIDE; virtual bool supportsOperation( OutDevSupportType ) const SAL_OVERRIDE;
#ifdef MACOSX
// Query the platform layer for control support // Query the platform layer for control support
virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE; virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
#endif
virtual SystemGraphicsData virtual SystemGraphicsData
GetGraphicsData() const SAL_OVERRIDE; GetGraphicsData() const SAL_OVERRIDE;
...@@ -410,7 +424,7 @@ public: ...@@ -410,7 +424,7 @@ public:
private: private:
// differences between VCL, Quartz and kHiThemeOrientation coordinate systems // differences between VCL, Quartz and kHiThemeOrientation coordinate systems
// make some graphics seem to be vertically-mirrored from a VCL perspective // make some graphics seem to be vertically-mirrored from a VCL perspective
bool IsFlipped() const { return mbWindow; } bool IsFlipped() const;
void ApplyXorContext(); void ApplyXorContext();
void Pattern50Fill(); void Pattern50Fill();
...@@ -423,14 +437,7 @@ private: ...@@ -423,14 +437,7 @@ private:
// --- some trivial inlines // --- some trivial inlines
#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64) #ifdef MACOSX
inline void AquaSalGraphics::RefreshRect( const CGRect& rRect )
{
RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
}
#endif
inline void AquaSalGraphics::RefreshRect( const NSRect& rRect ) inline void AquaSalGraphics::RefreshRect( const NSRect& rRect )
{ {
......
...@@ -227,10 +227,11 @@ void CoreTextFontData::ReadMacCmapEncoding( void ) const ...@@ -227,10 +227,11 @@ void CoreTextFontData::ReadMacCmapEncoding( void ) const
return; return;
} }
AquaSalGraphics::AquaSalGraphics() AquaSalGraphics::AquaSalGraphics():
#ifdef MACOSX #ifdef MACOSX
: mpFrame( NULL ) mpFrame( NULL ),
, mxLayer( NULL ) #endif
mxLayer( NULL )
, mrContext( NULL ) , mrContext( NULL )
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
, mnContextStackDepth( 0 ) , mnContextStackDepth( 0 )
...@@ -251,28 +252,10 @@ AquaSalGraphics::AquaSalGraphics() ...@@ -251,28 +252,10 @@ AquaSalGraphics::AquaSalGraphics()
, mbNonAntialiasedText( false ) , mbNonAntialiasedText( false )
, mbPrinter( false ) , mbPrinter( false )
, mbVirDev( false ) , mbVirDev( false )
#ifdef MACOSX
, mbWindow( false ) , mbWindow( false )
#else #else
: mxLayer( NULL )
, mbForeignContext( false ) , 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 #endif
{ {
SAL_INFO( "vcl.quartz", "AquaSalGraphics::AquaSalGraphics() this=" << this ); SAL_INFO( "vcl.quartz", "AquaSalGraphics::AquaSalGraphics() this=" << this );
...@@ -315,15 +298,11 @@ AquaSalGraphics::~AquaSalGraphics() ...@@ -315,15 +298,11 @@ AquaSalGraphics::~AquaSalGraphics()
} }
} }
#ifndef IOS
SalGraphicsImpl* AquaSalGraphics::GetImpl() const SalGraphicsImpl* AquaSalGraphics::GetImpl() const
{ {
return NULL; return NULL;
} }
#endif
void AquaSalGraphics::SetTextColor( SalColor nSalColor ) void AquaSalGraphics::SetTextColor( SalColor nSalColor )
{ {
maTextColor = RGBAColor( nSalColor ); maTextColor = RGBAColor( nSalColor );
...@@ -783,11 +762,46 @@ SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const ...@@ -783,11 +762,46 @@ SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
return aSysFontData; 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) if (mbForeignContext)
{ {
...@@ -799,7 +813,7 @@ bool SvpSalGraphics::CheckContext() ...@@ -799,7 +813,7 @@ bool SvpSalGraphics::CheckContext()
return false; return false;
} }
CGContextRef SvpSalGraphics::GetContext() CGContextRef AquaSalGraphics::GetContext()
{ {
if ( !mrContext ) if ( !mrContext )
CheckContext(); CheckContext();
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#ifdef IOS #ifdef IOS
#include "saldatabasic.hxx" #include "saldatabasic.hxx"
#include <vcl/sysdata.hxx>
#endif #endif
#if defined(IOS) && defined(DBG_UTIL) #if defined(IOS) && defined(DBG_UTIL)
......
...@@ -173,26 +173,6 @@ CGContextRef AquaSalGraphics::GetContext() ...@@ -173,26 +173,6 @@ CGContextRef AquaSalGraphics::GetContext()
return mrContext; 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& ) void AquaSalGraphics::UpdateWindow( NSRect& )
{ {
if( !mpFrame ) if( !mpFrame )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment