summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-03-19 14:43:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-03-23 11:42:28 +0000
commite510a208b01c87a341b43d74d8d901f992379b84 (patch)
tree7f437b7d48e60ec14b0051993a9f2eb88f40bd53 /include/vcl
parent2b838285e206912374f464bd1ab8dc8a561f59f5 (diff)
move cairo helpers to vcl and make per-plug
Change-Id: I4de4d5c3a191784598e93a8cf70e45a3f59ae857 Reviewed-on: https://gerrit.libreoffice.org/14907 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/cairo.hxx67
-rw-r--r--include/vcl/outdev.hxx12
2 files changed, 79 insertions, 0 deletions
diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx
new file mode 100644
index 000000000000..c8cc23e802b3
--- /dev/null
+++ b/include/vcl/cairo.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_CAIRO_HXX
+#define INCLUDED_VCL_CAIRO_HXX
+
+#include <sal/config.h>
+#include <boost/shared_ptr.hpp>
+
+typedef struct _cairo_surface cairo_surface_t;
+typedef struct _cairo cairo_t;
+
+class VirtualDevice;
+
+namespace cairo {
+
+ typedef boost::shared_ptr<cairo_surface_t> CairoSurfaceSharedPtr;
+ typedef boost::shared_ptr<cairo_t> CairoSharedPtr;
+
+ /** Cairo surface interface
+
+ For each cairo-supported platform, there's an implementation of
+ this interface
+ */
+ struct Surface
+ {
+ public:
+ virtual ~Surface() {}
+
+ // Query methods
+ virtual CairoSharedPtr getCairo() const = 0;
+ virtual CairoSurfaceSharedPtr getCairoSurface() const = 0;
+ virtual boost::shared_ptr<Surface> getSimilar(int cairo_content_type, int width, int height) const = 0;
+
+ /// factory for VirDev on this surface
+ virtual boost::shared_ptr<VirtualDevice> createVirtualDevice() const = 0;
+
+ /// Resize the surface (possibly destroying content), only possible for X11 typically
+ /// so on failure caller must create a new surface instead
+ virtual bool Resize( int /*width*/, int /*height*/ ) { return false; }
+
+ /// Flush all pending output to surface
+ virtual void flush() const = 0;
+ };
+
+ typedef boost::shared_ptr<Surface> SurfaceSharedPtr;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index c3adbbff7bfc..7911b662b285 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -26,6 +26,7 @@
#include <tools/color.hxx>
#include <tools/poly.hxx>
+#include <vcl/cairo.hxx>
#include <vcl/devicecoordinate.hxx>
#include <vcl/dllapi.h>
#include <vcl/font.hxx>
@@ -120,6 +121,8 @@ namespace basegfx {
class B2DHomMatrix;
class B2DPolygon;
class B2DPolyPolygon;
+ class B2IVector;
+ typedef B2IVector B2ISize;
}
namespace com {
@@ -233,6 +236,7 @@ class FontSelectPattern;
class ImplFontMetricData;
class VCLXGraphics;
class OutDevStateStack;
+struct BitmapSystemData;
typedef boost::intrusive_ptr< FontCharMap > FontCharMapPtr;
@@ -377,6 +381,14 @@ public:
SystemGraphicsData GetSystemGfxData() const;
bool SupportsCairo() const;
+ /// Create Surface from given cairo surface
+ cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const;
+ /// Create surface with given dimensions
+ cairo::SurfaceSharedPtr CreateSurface(int x, int y, int width, int height) const;
+ /// Create Surface for given bitmap data
+ cairo::SurfaceSharedPtr CreateBitmapSurface(const BitmapSystemData& rData, const Size& rSize) const;
+ /// Return native handle for underlying surface
+ css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const ::basegfx::B2ISize& rSize) const;
css::uno::Any GetSystemGfxDataAny() const;
void SetRefPoint();