summaryrefslogtreecommitdiff
path: root/vcl/inc/headless
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-01-14 20:49:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-01-18 11:34:09 +0000
commit4bf6f5581c9938504b841eb94f6121068b2eb752 (patch)
tree572ef155cd3307fcca30e6388bd3f685f781a3cf /vcl/inc/headless
parent7d8e94aaaddff0708dd8a5a6fde4d9922cd4e1ea (diff)
svp: replace basebmp surfaces with native cairo surfaces
so we can then a) drop all of our own clipping code in favour of cairos clipping code b) just pass cairo surfaces around the place instead of constantly creating and tearing down surfaces based on basebmp data c) we can additionally drop various flushing of the surfaces as it doesn't matter anymore d) use a lot less of our own code and far more of some one elses hopefully more drawing optimized code e) seeing as the graphics context are always cairo now, then they are always cairo compatible, so those checks can go also still need to figure out drawMask Change-Id: I320cd14cdc714ea59d00e90233f1171f821cf953
Diffstat (limited to 'vcl/inc/headless')
-rw-r--r--vcl/inc/headless/svpframe.hxx14
-rw-r--r--vcl/inc/headless/svpgdi.hxx33
-rw-r--r--vcl/inc/headless/svpvd.hxx13
3 files changed, 25 insertions, 35 deletions
diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx
index 507af74777d6..19d36214691d 100644
--- a/vcl/inc/headless/svpframe.hxx
+++ b/vcl/inc/headless/svpframe.hxx
@@ -44,9 +44,7 @@ class VCL_DLLPUBLIC SvpSalFrame : public SalFrame
SalFrameStyleFlags m_nStyle;
bool m_bVisible;
#ifndef IOS
- basebmp::BitmapDeviceSharedPtr m_aFrame;
- bool m_bDamageTracking;
- basebmp::Format m_nScanlineFormat;
+ cairo_surface_t* m_pSurface;
#endif
long m_nMinWidth;
long m_nMinHeight;
@@ -62,7 +60,6 @@ public:
SvpSalFrame( SvpSalInstance* pInstance,
SalFrame* pParent,
SalFrameStyleFlags nSalFrameStyle,
- basebmp::Format nScanlineFormat,
SystemParentData* pSystemParent = nullptr );
virtual ~SvpSalFrame();
@@ -70,10 +67,6 @@ public:
void LoseFocus();
void PostPaint(bool bImmediate) const;
-#if defined ANDROID
- const basebmp::BitmapDeviceSharedPtr& getDevice() const { return m_aFrame; }
-#endif
-
// SalFrame
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
@@ -122,11 +115,6 @@ public:
virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override;
virtual void EndSetClipRegion() override;
-#ifdef ANDROID
- // If enabled we can get damage notifications for regions immediately rendered to ...
- void enableDamageTracker( bool bOn = true );
-#endif
-
/*TODO: functional implementation */
virtual void SetScreenNumber( unsigned int nScreen ) override { (void)nScreen; }
virtual void SetApplicationID(const OUString &rApplicationID) override { (void) rApplicationID; }
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index c2107b78aa39..e2acbd936f98 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -50,15 +50,23 @@ class ServerFont;
typedef struct _cairo cairo_t;
typedef struct _cairo_surface cairo_surface_t;
typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
+typedef struct _cairo_user_data_key cairo_user_data_key_t;
enum PaintMode { OVERPAINT, XOR, INVERT };
-class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics
+typedef void (*damageHandler)(void* handle,
+ sal_Int32 nExtentsLeft, sal_Int32 nExtentsTop,
+ sal_Int32 nExtentsRight, sal_Int32 nExtentsBottom);
+
+struct VCL_DLLPUBLIC DamageHandler
{
- basebmp::BitmapDeviceSharedPtr m_aDevice;
- basebmp::BitmapDeviceSharedPtr m_aOrigDevice;
+ void *handle;
+ damageHandler damaged;
+};
- basebmp::BitmapDeviceSharedPtr m_aClipMap;
+class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics
+{
+ cairo_surface_t* m_pSurface;
bool m_bUseLineColor;
basebmp::Color m_aLineColor;
@@ -69,18 +77,10 @@ class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics
public:
static GlyphCache& getPlatformGlyphCache();
- void setDevice(basebmp::BitmapDeviceSharedPtr& rDevice);
+ void setSurface(cairo_surface_t* pSurface);
+ static cairo_user_data_key_t* getDamageKey();
private:
- bool m_bClipSetup;
- struct ClipUndoHandle {
- SvpSalGraphics &m_rGfx;
- basebmp::BitmapDeviceSharedPtr m_aDevice;
- ClipUndoHandle( SvpSalGraphics *pGfx ) : m_rGfx( *pGfx ) {}
- ~ClipUndoHandle();
- };
- bool isClippedSetup( const basegfx::B2IBox &aRange, ClipUndoHandle &rUndo );
- void ensureClip();
void invert(const basegfx::B2DPolygon &rPoly, SalInvert nFlags);
void copySource(const SalTwoRect& rTR, cairo_surface_t* source);
void setupPolyPolygon(cairo_t* cr, const basegfx::B2DPolyPolygon& rPolyPoly);
@@ -224,10 +224,7 @@ public:
cairo_t* getCairoContext(bool bXorModeAllowed) const;
void releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, const cairo_rectangle_int_t& extents) const;
- static cairo_surface_t* createCairoSurface(const basebmp::BitmapDeviceSharedPtr& rBuffer);
- static cairo_t* createCairoContext(const basebmp::BitmapDeviceSharedPtr& rBuffer);
- static cairo_surface_t* createTmpCompatibleCairoSurface(const basebmp::BitmapDeviceSharedPtr& rBuffer);
- static cairo_t* createTmpCompatibleCairoContext(const basebmp::BitmapDeviceSharedPtr &rBuffer);
+ static cairo_surface_t* createCairoSurface(const basebmp::BitmapDeviceSharedPtr &rBuffer);
void clipRegion(cairo_t* cr);
};
diff --git a/vcl/inc/headless/svpvd.hxx b/vcl/inc/headless/svpvd.hxx
index 4241d383a989..8d6357e09e4b 100644
--- a/vcl/inc/headless/svpvd.hxx
+++ b/vcl/inc/headless/svpvd.hxx
@@ -25,15 +25,20 @@
#include <list>
class SvpSalGraphics;
+typedef struct _cairo_surface cairo_surface_t;
class VCL_DLLPUBLIC SvpSalVirtualDevice : public SalVirtualDevice
{
DeviceFormat m_eFormat;
- basebmp::BitmapDeviceSharedPtr m_aDevice;
+ cairo_surface_t* m_pSurface;
std::list< SvpSalGraphics* > m_aGraphics;
public:
- SvpSalVirtualDevice(DeviceFormat eFormat) : m_eFormat(eFormat) {}
+ SvpSalVirtualDevice(DeviceFormat eFormat)
+ : m_eFormat(eFormat)
+ , m_pSurface(nullptr)
+ {
+ }
virtual ~SvpSalVirtualDevice();
// SalVirtualDevice
@@ -46,8 +51,8 @@ public:
) override;
// SalGeometryProvider
- virtual long GetWidth() const override { return m_aDevice.get() ? m_aDevice->getSize().getX() : 0; }
- virtual long GetHeight() const override { return m_aDevice.get() ? m_aDevice->getSize().getY() : 0; }
+ virtual long GetWidth() const override;
+ virtual long GetHeight() const override;
};
#endif // INCLUDED_VCL_INC_HEADLESS_SVPVD_HXX