Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
707a8bc1
Kaydet (Commit)
707a8bc1
authored
Mar 18, 2015
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
enable gtk3 to support cairo canvas
Change-Id: Ie6edf155288d1514ce7a0c859ba751cdebc93391
üst
e510a208
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
208 additions
and
6 deletions
+208
-6
Library_vclplug_gtk3.mk
vcl/Library_vclplug_gtk3.mk
+1
-0
gtkframe.hxx
vcl/inc/unx/gtk/gtkframe.hxx
+1
-1
gtkgdi.hxx
vcl/inc/unx/gtk/gtkgdi.hxx
+6
-1
gtksalframe.cxx
vcl/unx/gtk/window/gtksalframe.cxx
+9
-3
cairo_gtk3_cairo.cxx
vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx
+117
-0
cairo_gtk3_cairo.hxx
vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx
+51
-0
gtk3salnativewidgets-gtk.cxx
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+23
-1
No files found.
vcl/Library_vclplug_gtk3.mk
Dosyayı görüntüle @
707a8bc1
...
...
@@ -102,6 +102,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gtk3,\
vcl/unx/gtk3/app/gtk3gtkinst \
vcl/unx/gtk3/app/gtk3gtksys \
vcl/unx/gtk3/app/gtk3fpicker \
vcl/unx/gtk3/gdi/cairo_gtk3_cairo \
vcl/unx/gtk3/gdi/gtk3cairotextrender \
vcl/unx/gtk3/gdi/gtk3gtkprintwrapper \
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk \
...
...
vcl/inc/unx/gtk/gtkframe.hxx
Dosyayı görüntüle @
707a8bc1
...
...
@@ -343,7 +343,7 @@ public:
#if GTK_CHECK_VERSION(3,0,0)
// only for gtk3 ...
cairo_t
*
getCairoContext
();
cairo_t
*
getCairoContext
()
const
;
void
damaged
(
const
basegfx
::
B2IBox
&
rDamageRect
);
#endif
virtual
~
GtkSalFrame
();
...
...
vcl/inc/unx/gtk/gtkgdi.hxx
Dosyayı görüntüle @
707a8bc1
...
...
@@ -49,11 +49,16 @@ public:
const
OUString
&
rCaption
,
Rectangle
&
rNativeBoundingRegion
,
Rectangle
&
rNativeContentRegion
)
SAL_OVERRIDE
;
virtual
bool
SupportsCairo
()
const
SAL_OVERRIDE
;
virtual
cairo
::
SurfaceSharedPtr
CreateSurface
(
const
cairo
::
CairoSurfaceSharedPtr
&
rSurface
)
const
SAL_OVERRIDE
;
virtual
cairo
::
SurfaceSharedPtr
CreateSurface
(
const
OutputDevice
&
rRefDevice
,
int
x
,
int
y
,
int
width
,
int
height
)
const
SAL_OVERRIDE
;
void
WidgetQueueDraw
()
const
;
void
updateSettings
(
AllSettings
&
rSettings
);
static
void
refreshFontconfig
(
GtkSettings
*
pSettings
);
static
void
signalSettingsNotify
(
GObject
*
,
GParamSpec
*
pSpec
,
gpointer
);
cairo_t
*
getCairoContext
();
cairo_t
*
getCairoContext
()
const
;
void
clipRegion
(
cairo_t
*
cr
);
...
...
vcl/unx/gtk/window/gtksalframe.cxx
Dosyayı görüntüle @
707a8bc1
...
...
@@ -3356,7 +3356,7 @@ gboolean GtkSalFrame::signalCrossing( GtkWidget*, GdkEventCrossing* pEvent, gpoi
#if GTK_CHECK_VERSION(3,0,0)
cairo_t
*
GtkSalFrame
::
getCairoContext
()
cairo_t
*
GtkSalFrame
::
getCairoContext
()
const
{
basebmp
::
RawMemorySharedArray
data
=
m_aFrame
->
getBuffer
();
basegfx
::
B2IVector
size
=
m_aFrame
->
getSize
();
...
...
@@ -3391,7 +3391,9 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect)
{
static
int
frame
;
OString
tmp
(
"/tmp/frame"
+
OString
::
number
(
frame
++
)
+
".png"
);
cairo_surface_write_to_png
(
cairo_get_target
(
getCairoContext
()),
tmp
.
getStr
());
cairo_t
*
cr
=
getCairoContext
();
cairo_surface_write_to_png
(
cairo_get_target
(
cr
),
tmp
.
getStr
());
cairo_destroy
(
cr
);
}
gtk_widget_queue_draw_area
(
m_pWindow
,
...
...
@@ -3408,11 +3410,15 @@ gboolean GtkSalFrame::signalDraw( GtkWidget*, cairo_t *cr, gpointer frame )
cairo_save
(
cr
);
cairo_surface_t
*
pSurface
=
cairo_get_target
(
pThis
->
getCairoContext
());
cairo_t
*
source
=
pThis
->
getCairoContext
();
cairo_surface_t
*
pSurface
=
cairo_get_target
(
source
);
cairo_set_operator
(
cr
,
CAIRO_OPERATOR_OVER
);
cairo_set_source_surface
(
cr
,
pSurface
,
0
,
0
);
cairo_paint
(
cr
);
cairo_destroy
(
source
);
cairo_restore
(
cr
);
cairo_surface_flush
(
cairo_get_target
(
cr
));
...
...
vcl/unx/gtk3/gdi/cairo_gtk3_cairo.cxx
0 → 100644
Dosyayı görüntüle @
707a8bc1
/* -*- 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 <utility>
#include "cairo_cairo.hxx"
#include "cairo_gtk3_cairo.hxx"
#include <vcl/sysdata.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/virdev.hxx>
#include <vcl/window.hxx>
#include <basegfx/vector/b2isize.hxx>
#include "unx/gtk/gtkgdi.hxx"
namespace
cairo
{
/**
* Surface::Surface: Create generic Canvas surface using given Cairo Surface
*
* @param pSurface Cairo Surface
*
* This constructor only stores data, it does no processing.
* It is used with e.g. cairo_image_surface_create_for_data()
*
* Set the mpSurface as pSurface
**/
Gtk3Surface
::
Gtk3Surface
(
const
CairoSurfaceSharedPtr
&
pSurface
)
:
mpGraphics
(
NULL
)
,
cr
(
NULL
)
,
mpSurface
(
pSurface
)
{}
/**
* Surface::Surface: Create Canvas surface from Window reference.
* @param x horizontal location of the new surface
* @param y vertical location of the new surface
* @param width width of the new surface
* @param height height of the new surface
*
* Set the mpSurface to the new surface or NULL
**/
Gtk3Surface
::
Gtk3Surface
(
const
GtkSalGraphics
*
pGraphics
,
int
x
,
int
y
,
int
width
,
int
height
)
:
mpGraphics
(
pGraphics
)
,
cr
(
pGraphics
->
getCairoContext
())
{
cairo_surface_t
*
surface
=
cairo_get_target
(
cr
);
mpSurface
.
reset
(
cairo_surface_create_for_rectangle
(
surface
,
x
,
y
,
width
,
height
),
&
cairo_surface_destroy
);
}
Gtk3Surface
::~
Gtk3Surface
()
{
if
(
cr
)
cairo_destroy
(
cr
);
}
/**
* Surface::getCairo: Create Cairo (drawing object) for the Canvas surface
*
* @return new Cairo or NULL
**/
CairoSharedPtr
Gtk3Surface
::
getCairo
()
const
{
return
CairoSharedPtr
(
cairo_create
(
mpSurface
.
get
()),
&
cairo_destroy
);
}
/**
* Surface::getSimilar: Create new similar Canvas surface
* @param cairo_content_type format of the new surface (cairo_content_t from cairo/src/cairo.h)
* @param width width of the new surface
* @param height height of the new surface
*
* Creates a new Canvas surface. This normally creates platform native surface, even though
* generic function is used.
*
* Cairo surface from cairo_content_type (cairo_content_t)
*
* @return new surface or NULL
**/
SurfaceSharedPtr
Gtk3Surface
::
getSimilar
(
int
cairo_content_type
,
int
width
,
int
height
)
const
{
return
SurfaceSharedPtr
(
new
Gtk3Surface
(
CairoSurfaceSharedPtr
(
cairo_surface_create_similar
(
mpSurface
.
get
(),
static_cast
<
cairo_content_t
>
(
cairo_content_type
),
width
,
height
),
&
cairo_surface_destroy
)));
}
void
Gtk3Surface
::
flush
()
const
{
cairo_surface_flush
(
mpSurface
.
get
());
//Wonder if there is any benefit in using cairo_fill/stroke extents on
//every canvas call and only redrawing the union of those in a
//poor-mans-damage tracking
if
(
mpGraphics
)
mpGraphics
->
WidgetQueueDraw
();
}
boost
::
shared_ptr
<
VirtualDevice
>
Gtk3Surface
::
createVirtualDevice
()
const
{
return
boost
::
shared_ptr
<
VirtualDevice
>
(
new
VirtualDevice
(
NULL
,
Size
(
1
,
1
),
0
));
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/unx/gtk3/gdi/cairo_gtk3_cairo.hxx
0 → 100644
Dosyayı görüntüle @
707a8bc1
/* -*- 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_CANVAS_SOURCE_CAIRO_CAIRO_GTK3_CAIRO_HXX
#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_GTK3_CAIRO_HXX
#include <sal/config.h>
#include <sal/types.h>
#include <vcl/cairo.hxx>
class
GtkSalGraphics
;
class
OutputDevice
;
namespace
cairo
{
class
Gtk3Surface
:
public
Surface
{
const
GtkSalGraphics
*
mpGraphics
;
cairo_t
*
cr
;
CairoSurfaceSharedPtr
mpSurface
;
public
:
/// takes over ownership of passed cairo_surface
explicit
Gtk3Surface
(
const
CairoSurfaceSharedPtr
&
pSurface
);
/// create surface on subarea of given drawable
explicit
Gtk3Surface
(
const
GtkSalGraphics
*
pGraphics
,
int
x
,
int
y
,
int
width
,
int
height
);
// Surface interface
virtual
CairoSharedPtr
getCairo
()
const
SAL_OVERRIDE
;
virtual
CairoSurfaceSharedPtr
getCairoSurface
()
const
SAL_OVERRIDE
{
return
mpSurface
;
}
virtual
SurfaceSharedPtr
getSimilar
(
int
nContentType
,
int
width
,
int
height
)
const
SAL_OVERRIDE
;
virtual
boost
::
shared_ptr
<
VirtualDevice
>
createVirtualDevice
()
const
SAL_OVERRIDE
;
virtual
void
flush
()
const
SAL_OVERRIDE
;
~
Gtk3Surface
();
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
Dosyayı görüntüle @
707a8bc1
...
...
@@ -17,6 +17,7 @@
#include <vcl/settings.hxx>
#include "fontmanager.hxx"
#include "gtk3cairotextrender.hxx"
#include "cairo_gtk3_cairo.hxx"
GtkStyleContext
*
GtkSalGraphics
::
mpButtonStyle
=
NULL
;
GtkStyleContext
*
GtkSalGraphics
::
mpEntryStyle
=
NULL
;
...
...
@@ -1447,6 +1448,27 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
return
false
;
}
bool
GtkSalGraphics
::
SupportsCairo
()
const
{
return
true
;
}
cairo
::
SurfaceSharedPtr
GtkSalGraphics
::
CreateSurface
(
const
cairo
::
CairoSurfaceSharedPtr
&
rSurface
)
const
{
return
cairo
::
SurfaceSharedPtr
(
new
cairo
::
Gtk3Surface
(
rSurface
));
}
cairo
::
SurfaceSharedPtr
GtkSalGraphics
::
CreateSurface
(
const
OutputDevice
&
/*rRefDevice*/
,
int
x
,
int
y
,
int
width
,
int
height
)
const
{
return
cairo
::
SurfaceSharedPtr
(
new
cairo
::
Gtk3Surface
(
this
,
x
,
y
,
width
,
height
));
}
void
GtkSalGraphics
::
WidgetQueueDraw
()
const
{
//request gtk to sync the entire contents
gtk_widget_queue_draw
(
mpWindow
);
}
static
GtkWidget
*
gCacheWindow
;
static
GtkWidget
*
gDumbContainer
;
...
...
@@ -1551,7 +1573,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
gtk_widget_path_free
(
path
);
}
cairo_t
*
GtkSalGraphics
::
getCairoContext
()
cairo_t
*
GtkSalGraphics
::
getCairoContext
()
const
{
return
mpFrame
->
getCairoContext
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment