Kaydet (Commit) 253c0f07 authored tarafından Caolán McNamara's avatar Caolán McNamara

gtk3: move createCairoContext down to svpgdi

Change-Id: Ib3c6d6689c4b79a636a3f2f0f985f3573aa46f3d
üst a8be3fba
......@@ -33,6 +33,10 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basebmp/scanlineformats.hxx>
#if ENABLE_CAIRO_CANVAS
#include <cairo.h>
#endif
#if OSL_DEBUG_LEVEL > 2
#include <basebmp/debug.hxx>
#include <fstream>
......@@ -738,6 +742,27 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
#if ENABLE_CAIRO_CANVAS
cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr &rBuffer)
{
if (rBuffer->getScanlineFormat() != basebmp::Format::ThirtyTwoBitTcMaskBGRX)
return NULL;
basegfx::B2IVector size = rBuffer->getSize();
sal_Int32 nStride = rBuffer->getScanlineStride();
if (cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, size.getX()) != nStride)
return NULL;
basebmp::RawMemorySharedArray data = rBuffer->getBuffer();
cairo_surface_t *target =
cairo_image_surface_create_for_data(data.get(),
CAIRO_FORMAT_RGB24,
size.getX(), size.getY(),
nStride);
cairo_t* cr = cairo_create(target);
cairo_surface_destroy(target);
return cr;
}
bool SvpSalGraphics::SupportsCairo() const
{
return false;
......
......@@ -36,6 +36,7 @@
class GlyphCache;
class ServerFont;
typedef struct _cairo cairo_t;
class VCL_DLLPUBLIC SvpSalGraphics : public SalGraphics
{
......@@ -210,6 +211,8 @@ public:
virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE;
static cairo_t* createCairoContext(const basebmp::BitmapDeviceSharedPtr& rBuffer);
#endif // ENABLE_CAIRO_CANVAS
virtual void BeginPaint() SAL_OVERRIDE { };
......
......@@ -3465,17 +3465,8 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpoi
cairo_t* GtkSalFrame::getCairoContext() const
{
basebmp::RawMemorySharedArray data = m_aFrame->getBuffer();
basegfx::B2IVector size = m_aFrame->getSize();
sal_Int32 nStride = m_aFrame->getScanlineStride();
assert(cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, size.getX()) == nStride);
cairo_surface_t *target =
cairo_image_surface_create_for_data(data.get(),
CAIRO_FORMAT_RGB24,
size.getX(), size.getY(),
nStride);
cairo_t* cr = cairo_create(target);
cairo_surface_destroy(target);
cairo_t* cr = SvpSalGraphics::createCairoContext(m_aFrame);
assert(cr);
return cr;
}
......
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