summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-20 16:47:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-06-21 10:00:38 +0200
commit3e76985d5efe47a8c79945049831e791a9277498 (patch)
treee60743ebf818e94c5d5fae0af1b3fdb6e2aeb679 /vcl/unx
parentb3df3494174243e691d1be74bab4d7f5177ad3b7 (diff)
take the surface directly from the SvpSalVirtualDevice
Change-Id: I5e0d46fa863a9a74063063cc3d22ea15d2544d8b Reviewed-on: https://gerrit.libreoffice.org/56208 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx19
1 files changed, 2 insertions, 17 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index cb5ab02cee52..e454c58df342 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3820,7 +3820,6 @@ AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
}
-
class GtkInstanceDrawingArea : public GtkInstanceWidget, public virtual weld::DrawingArea
{
private:
@@ -3828,7 +3827,6 @@ private:
a11yref m_xAccessible;
AtkObject *m_pAccessible;
ScopedVclPtrInstance<VirtualDevice> m_xDevice;
- std::vector<unsigned char> m_aBuffer;
cairo_surface_t* m_pSurface;
sal_uInt16 m_nLastMouseButton;
gulong m_nDrawSignalId;
@@ -3876,19 +3874,8 @@ private:
}
void signal_size_allocate(guint nWidth, guint nHeight)
{
- if (m_pSurface)
- cairo_surface_destroy(m_pSurface);
-
- const int nScale = gtk_widget_get_scale_factor(GTK_WIDGET(m_pDrawingArea));
- const int nStride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nWidth * nScale);
- m_aBuffer.resize(nHeight * nScale * nStride);
- m_xDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nWidth, nHeight), Fraction(1.0), Point(),
- m_aBuffer.data());
- m_pSurface = cairo_image_surface_create_for_data(m_aBuffer.data(), CAIRO_FORMAT_ARGB32,
- nWidth * nScale, nHeight * nScale, nStride);
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
- cairo_surface_set_device_scale(m_pSurface, nScale, nScale);
-#endif
+ m_xDevice->SetOutputSizePixel(Size(nWidth, nHeight));
+ m_pSurface = get_underlying_cairo_suface(*m_xDevice);
m_aSizeAllocateHdl.Call(Size(nWidth, nHeight));
}
static void signalStyleUpdated(GtkWidget*, gpointer widget)
@@ -4138,8 +4125,6 @@ public:
g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
if (m_pAccessible)
g_object_unref(m_pAccessible);
- if (m_pSurface)
- cairo_surface_destroy(m_pSurface);
g_signal_handler_disconnect(m_pDrawingArea, m_nQueryTooltip);
g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nKeyPressSignalId);