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;
SvpSalFrame* SvpSalFrame::s_pFocusFrame = NULL;
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics
#endif
#ifndef IOS
namespace {
......
......@@ -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: */
......@@ -29,8 +29,8 @@
#include <list>
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics
#define SvpSalInstance AquaSalInstance
#define SvpSalGraphics AquaSalGraphics
#endif
class SvpSalInstance;
......
......@@ -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
......
......@@ -24,10 +24,6 @@
#include <list>
#ifdef IOS
#define SvpSalGraphics AquaSalGraphics
#endif
class SvpSalGraphics;
class SvpSalVirtualDevice : public SalVirtualDevice
......
......@@ -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"
......
......@@ -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 )
{
......
......@@ -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();
......
......@@ -36,6 +36,7 @@
#ifdef IOS
#include "saldatabasic.hxx"
#include <vcl/sysdata.hxx>
#endif
#if defined(IOS) && defined(DBG_UTIL)
......
......@@ -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 )
......
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