summaryrefslogtreecommitdiff
path: root/vcl/inc/aqua
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-03-16 23:58:39 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2012-06-23 23:23:21 -0500
commit9db88e11882c38cd22564c4a76bb0b878de5fe86 (patch)
tree0df2a5cb062f267552369ad8165528ba8605bfc3 /vcl/inc/aqua
parent55fd57ecfe1ce17779b744355b4e9c64dba0712d (diff)
factorize what we can share for salgdi between CoreText and ATSUI
Diffstat (limited to 'vcl/inc/aqua')
-rw-r--r--vcl/inc/aqua/atsui/salgdi.h61
-rw-r--r--vcl/inc/aqua/common.h16
-rw-r--r--vcl/inc/aqua/salgdicommon.hxx58
3 files changed, 81 insertions, 54 deletions
diff --git a/vcl/inc/aqua/atsui/salgdi.h b/vcl/inc/aqua/atsui/salgdi.h
index 0788095f798c..0ee4420ef8e5 100644
--- a/vcl/inc/aqua/atsui/salgdi.h
+++ b/vcl/inc/aqua/atsui/salgdi.h
@@ -29,6 +29,8 @@
#ifndef _SV_SALGDI_H
#define _SV_SALGDI_H
+#include <vector>
+
#include "basegfx/polygon/b2dpolypolygon.hxx"
#include "premac.h"
@@ -39,9 +41,10 @@
#include <vcl/fontcapabilities.hxx>
#include "outfont.hxx"
+#include "aqua/salframe.h"
#include "salgdi.hxx"
-#include <vector>
+#include "aqua/salgdicommon.hxx"
class AquaSalFrame;
class AquaSalBitmap;
@@ -80,19 +83,6 @@ private:
mutable bool mbFontCapabilitiesRead;
};
-// abstracting quartz color instead of having to use an CGFloat[] array
-class RGBAColor
-{
-public:
- RGBAColor( SalColor );
- RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET
- const float* AsArray() const { return &mfRed; }
- bool IsVisible() const { return (mfAlpha > 0); }
- void SetAlpha( float fAlpha ) { mfAlpha = fAlpha; }
-private:
- float mfRed, mfGreen, mfBlue, mfAlpha;
-};
-
// -------------------
// - AquaSalGraphics -
// -------------------
@@ -357,34 +347,11 @@ private:
void Pattern50Fill();
UInt32 getState( ControlState nState );
UInt32 getTrackState( ControlState nState );
+ bool GetRawFontData( const ImplFontData* pFontData,
+ std::vector<unsigned char>& rBuffer,
+ bool* pJustCFF );
};
-class XorEmulation
-{
-public:
- XorEmulation();
- /*final*/ ~XorEmulation();
-
- void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
- bool UpdateTarget();
- void Enable() { mbIsEnabled = true; }
- void Disable() { mbIsEnabled = false; }
- bool IsEnabled() const { return mbIsEnabled; }
- CGContextRef GetTargetContext() const { return mxTargetContext; }
- CGContextRef GetMaskContext() const { return (mbIsEnabled ? mxMaskContext : NULL); }
-
-private:
- CGLayerRef mxTargetLayer;
- CGContextRef mxTargetContext;
- CGContextRef mxMaskContext;
- CGContextRef mxTempContext;
- sal_uLong* mpMaskBuffer;
- sal_uLong* mpTempBuffer;
- int mnBufferLongs;
- bool mbIsEnabled;
-};
-
-
// --- some trivial inlines
inline void AquaSalGraphics::RefreshRect( const CGRect& rRect )
@@ -397,20 +364,6 @@ inline void AquaSalGraphics::RefreshRect( const NSRect& rRect )
RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height );
}
-inline RGBAColor::RGBAColor( SalColor nSalColor )
-: mfRed( SALCOLOR_RED(nSalColor) * (1.0/255))
-, mfGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255))
-, mfBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255))
-, mfAlpha( 1.0 ) // opaque
-{}
-
-inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
-: mfRed( fRed )
-, mfGreen( fGreen )
-, mfBlue( fBlue )
-, mfAlpha( fAlpha )
-{}
-
#endif // _SV_SALGDI_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/aqua/common.h b/vcl/inc/aqua/common.h
new file mode 100644
index 000000000000..d7a654128d08
--- /dev/null
+++ b/vcl/inc/aqua/common.h
@@ -0,0 +1,16 @@
+
+#ifndef _VCL_AQUA_COMMON_H
+#define _VCL_AQUA_COMMON_H
+
+#include <sal/types.h>
+#include <premac.h>
+#include <ApplicationServices/ApplicationServices.h>
+#include <postmac.h>
+
+// CoreFoundation designers, in their wisdom, decided that CFRelease of NULL
+// cause a Crash, yet few API can return NULL when asking for the creation
+// of an object, which force us to peper the code with egly if construct everywhere
+// and open the door to very nasty crash on rare occasion
+// this macro hide the mess
+#define SafeCFRelease(a) do { if(a) { CFRelease(a); } } while(false)
+#endif
diff --git a/vcl/inc/aqua/salgdicommon.hxx b/vcl/inc/aqua/salgdicommon.hxx
new file mode 100644
index 000000000000..21307ee14551
--- /dev/null
+++ b/vcl/inc/aqua/salgdicommon.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+#ifndef _VCL_AQUA_SALGDICOMMON_H
+#define _VCL_AQUA_SALGDICOMMON_H
+
+// abstracting quartz color instead of having to use an CGFloat[] array
+class RGBAColor
+{
+public:
+ RGBAColor( SalColor );
+ RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha ); //NOTUSEDYET
+ const float* AsArray() const { return &m_fRed; }
+ bool IsVisible() const { return m_fAlpha > 0; }
+ void SetAlpha( float fAlpha ) { m_fAlpha = fAlpha; }
+private:
+ float m_fRed, m_fGreen, m_fBlue, m_fAlpha;
+};
+
+inline RGBAColor::RGBAColor( SalColor nSalColor )
+: m_fRed( SALCOLOR_RED(nSalColor) * (1.0/255))
+, m_fGreen( SALCOLOR_GREEN(nSalColor) * (1.0/255))
+, m_fBlue( SALCOLOR_BLUE(nSalColor) * (1.0/255))
+, m_fAlpha( 1.0 ) // opaque
+{}
+
+inline RGBAColor::RGBAColor( float fRed, float fGreen, float fBlue, float fAlpha )
+: m_fRed( fRed )
+, m_fGreen( fGreen )
+, m_fBlue( fBlue )
+, m_fAlpha( fAlpha )
+{}
+
+class XorEmulation
+{
+public:
+ XorEmulation();
+ ~XorEmulation();
+
+ void SetTarget( int nWidth, int nHeight, int nBitmapDepth, CGContextRef, CGLayerRef );
+ bool UpdateTarget();
+ void Enable() { m_bIsEnabled = true; }
+ void Disable() { m_bIsEnabled = false; }
+ bool IsEnabled() const { return m_bIsEnabled; }
+ CGContextRef GetTargetContext() const { return m_xTargetContext; }
+ CGContextRef GetMaskContext() const { return (m_bIsEnabled ? m_xMaskContext : NULL); }
+
+private:
+ CGLayerRef m_xTargetLayer;
+ CGContextRef m_xTargetContext;
+ CGContextRef m_xMaskContext;
+ CGContextRef m_xTempContext;
+ sal_uLong* m_pMaskBuffer;
+ sal_uLong* m_pTempBuffer;
+ int m_nBufferLongs;
+ bool m_bIsEnabled;
+};
+
+#endif /* _VCL_AQUA_SALGDICOMMON_H */