vcl/unx/generic/gdi/openglx11cairotextrender.cxx |   50 +++++++++++++++++++++++
 vcl/unx/generic/gdi/openglx11cairotextrender.hxx |   26 +++++++++++
 2 files changed, 76 insertions(+)

New commits:
commit 58f46166c92db8bbbcf1bfa6243c4b636d8fa6cb
Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk>
Date:   Mon Nov 10 07:09:59 2014 +0100

    forgot to add the files
    
    Change-Id: I44a7e9bec213514708e4c971479660574508ad1b

diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.cxx 
b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
new file mode 100644
index 0000000..9b7c49e
--- /dev/null
+++ b/vcl/unx/generic/gdi/openglx11cairotextrender.cxx
@@ -0,0 +1,50 @@
+/* -*- 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/.
+ */
+
+#include "openglx11cairotextrender.hxx"
+
+#include "salbmp.hxx"
+#include <vcl/salbtype.hxx>
+
+#include <cairo-svg.h>
+
+OpenGLX11CairoTextRender::OpenGLX11CairoTextRender(bool bPrinter, 
X11SalGraphics& rParent):
+    X11CairoTextRender(bPrinter, rParent)
+{
+}
+
+cairo_surface_t* OpenGLX11CairoTextRender::getCairoSurface()
+{
+    // static size_t id = 0;
+    // OString aFileName = OString("/tmp/libo_logs/text_rendering") + 
OString::number(id++) + OString(".svg");
+    // cairo_surface_t* surface = cairo_svg_surface_create(aFileName.getStr(), 
GetWidth(), GetHeight());
+    cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, 
GetWidth(), GetHeight());
+    return surface;
+}
+
+void OpenGLX11CairoTextRender::drawSurface(cairo_t* cr)
+{
+    cairo_surface_t* surface = cairo_get_target(cr);
+    int width = cairo_image_surface_get_width(surface);
+    int height = cairo_image_surface_get_height(surface);
+    SalBitmap* pBitmap = ImplGetSVData()->mpDefInst->CreateSalBitmap();
+    pBitmap->Create(Size(width, height), 24, BitmapPalette());
+    BitmapBuffer* pBuffer = pBitmap->AcquireBuffer(false);
+    std::memcpy(pBuffer->mpBits, cairo_image_surface_get_data(surface), 
width*height*3);
+    pBitmap->ReleaseBuffer(pBuffer, false);
+    SalTwoRect aRect;
+    aRect.mnSrcX = 0;
+    aRect.mnSrcY = 0;
+    aRect.mnSrcWidth = width;
+    aRect.mnSrcHeight = height;
+    mrParent.drawBitmap(aRect, *pBitmap);
+    delete pBitmap;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/openglx11cairotextrender.hxx 
b/vcl/unx/generic/gdi/openglx11cairotextrender.hxx
new file mode 100644
index 0000000..87ef948
--- /dev/null
+++ b/vcl/unx/generic/gdi/openglx11cairotextrender.hxx
@@ -0,0 +1,26 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_VCL_UNX_GENERIC_GDI_OPENGLX11CAIROTEXTRENDER_HXX
+#define INCLUDED_VCL_UNX_GENERIC_GDI_OPENGLX11CAIROTEXTRENDER_HXX value
+
+#include "x11cairotextrender.hxx"
+
+class OpenGLX11CairoTextRender : public X11CairoTextRender
+{
+public:
+    OpenGLX11CairoTextRender(bool bPrinter, X11SalGraphics& rParent);
+
+    virtual cairo_surface_t* getCairoSurface() SAL_OVERRIDE;
+    virtual void drawSurface(cairo_t* cr) SAL_OVERRIDE;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to