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
4df957f7
Kaydet (Commit)
4df957f7
authored
Tem 29, 2015
tarafından
Pranav Kant
Kaydeden (comit)
Miklos Vajna
Agu 04, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lokdocview: Don't use extern variable: lokThreadPool
Change-Id: Ia208e3309bb64baf71ceb97cdf1b3b57b6120353
üst
f0ca80f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
32 deletions
+44
-32
lokdocview.cxx
libreofficekit/source/gtk/lokdocview.cxx
+28
-25
tilebuffer.cxx
libreofficekit/source/gtk/tilebuffer.cxx
+4
-4
tilebuffer.hxx
libreofficekit/source/gtk/tilebuffer.hxx
+12
-3
No files found.
libreofficekit/source/gtk/lokdocview.cxx
Dosyayı görüntüle @
4df957f7
...
...
@@ -49,6 +49,7 @@ struct _LOKDocViewPrivate
LibreOfficeKitDocument
*
m_pDocument
;
TileBuffer
m_aTileBuffer
;
GThreadPool
*
lokThreadPool
;
gfloat
m_fZoom
;
glong
m_nDocumentWidthTwips
;
...
...
@@ -152,8 +153,6 @@ G_DEFINE_TYPE_WITH_CODE (LOKDocView, lok_doc_view, GTK_TYPE_DRAWING_AREA,
#pragma GCC diagnostic pop
#endif
GThreadPool
*
lokThreadPool
;
/// Helper struct used to pass the data from soffice thread -> main thread.
struct
CallbackData
{
...
...
@@ -308,7 +307,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
pLOEvent
->
m_nCharCode
=
nCharCode
;
pLOEvent
->
m_nKeyCode
=
nKeyCode
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
else
...
...
@@ -319,7 +318,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent)
pLOEvent
->
m_nCharCode
=
nCharCode
;
pLOEvent
->
m_nKeyCode
=
nKeyCode
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
...
...
@@ -487,7 +486,7 @@ setTilesInvalid (LOKDocView* pDocView, const GdkRectangle& rRectangle)
for
(
int
j
=
aStart
.
y
;
j
<
aEnd
.
y
;
j
++
)
{
GTask
*
task
=
g_task_new
(
pDocView
,
NULL
,
NULL
,
NULL
);
priv
->
m_aTileBuffer
.
setInvalid
(
i
,
j
,
priv
->
m_fZoom
,
task
);
priv
->
m_aTileBuffer
.
setInvalid
(
i
,
j
,
priv
->
m_fZoom
,
task
,
priv
->
lokThreadPool
);
g_object_unref
(
task
);
}
}
...
...
@@ -762,7 +761,7 @@ renderDocument(LOKDocView* pDocView, cairo_t* pCairo)
if
(
bPaint
)
{
GTask
*
task
=
g_task_new
(
pDocView
,
NULL
,
NULL
,
NULL
);
Tile
&
currentTile
=
priv
->
m_aTileBuffer
.
getTile
(
nRow
,
nColumn
,
priv
->
m_fZoom
,
task
);
Tile
&
currentTile
=
priv
->
m_aTileBuffer
.
getTile
(
nRow
,
nColumn
,
priv
->
m_fZoom
,
task
,
priv
->
lokThreadPool
);
GdkPixbuf
*
pPixBuf
=
currentTile
.
getBuffer
();
gdk_cairo_set_source_pixbuf
(
pCairo
,
pPixBuf
,
twipToPixel
(
aTileRectangleTwips
.
x
,
priv
->
m_fZoom
),
...
...
@@ -900,7 +899,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
pLOEvent
->
m_nSetGraphicSelectionY
=
pixelToTwip
(
pEvent
->
y
,
priv
->
m_fZoom
);
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
return
FALSE
;
...
...
@@ -919,7 +918,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
pLOEvent
->
m_nSetGraphicSelectionY
=
pixelToTwip
(
pEvent
->
y
,
priv
->
m_fZoom
);
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
return
FALSE
;
...
...
@@ -968,7 +967,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
pLOEvent
->
m_nSetGraphicSelectionY
=
pixelToTwip
(
priv
->
m_aGraphicHandleRects
[
i
].
y
+
priv
->
m_aGraphicHandleRects
[
i
].
height
/
2
,
priv
->
m_fZoom
);
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
return
FALSE
;
...
...
@@ -996,7 +995,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
pLOEvent
->
m_nPostMouseEventCount
=
nCount
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
break
;
}
...
...
@@ -1014,7 +1013,7 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent)
pLOEvent
->
m_nPostMouseEventCount
=
nCount
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
break
;
}
...
...
@@ -1101,7 +1100,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent)
pLOEvent
->
m_nSetGraphicSelectionY
=
pixelToTwip
(
pEvent
->
y
,
priv
->
m_fZoom
);
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
return
FALSE
;
...
...
@@ -1117,7 +1116,7 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent)
pLOEvent
->
m_nPostMouseEventCount
=
1
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
return
FALSE
;
...
...
@@ -1355,6 +1354,12 @@ static void lok_doc_view_init (LOKDocView* pDocView)
|
GDK_BUTTON_MOTION_MASK
|
GDK_KEY_PRESS_MASK
|
GDK_KEY_RELEASE_MASK
);
priv
->
lokThreadPool
=
g_thread_pool_new
(
lokThreadFunc
,
NULL
,
1
,
FALSE
,
NULL
);
}
static
void
lok_doc_view_set_property
(
GObject
*
object
,
guint
propId
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
...
...
@@ -1738,12 +1743,6 @@ static void lok_doc_view_class_init (LOKDocViewClass* pClass)
g_cclosure_marshal_VOID__STRING
,
G_TYPE_NONE
,
1
,
G_TYPE_STRING
);
lokThreadPool
=
g_thread_pool_new
(
lokThreadFunc
,
NULL
,
1
,
FALSE
,
NULL
);
}
/**
...
...
@@ -1806,7 +1805,7 @@ lok_doc_view_open_document (LOKDocView* pDocView,
priv
->
m_aDocPath
=
pPath
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
...
...
@@ -1878,12 +1877,14 @@ lok_doc_view_get_part (LOKDocView* pDocView)
SAL_DLLPUBLIC_EXPORT
void
lok_doc_view_set_part
(
LOKDocView
*
pDocView
,
int
nPart
)
{
LOKDocViewPrivate
*
priv
=
static_cast
<
LOKDocViewPrivate
*>
(
lok_doc_view_get_instance_private
(
pDocView
));
GTask
*
task
=
g_task_new
(
pDocView
,
NULL
,
NULL
,
NULL
);
LOEvent
*
pLOEvent
=
new
LOEvent
(
LOK_SET_PART
);
pLOEvent
->
m_nPart
=
nPart
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
...
...
@@ -1898,12 +1899,13 @@ SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_partmode
(
LOKDocView
*
pDocView
,
int
nPartMode
)
{
LOKDocViewPrivate
*
priv
=
static_cast
<
LOKDocViewPrivate
*>
(
lok_doc_view_get_instance_private
(
pDocView
));
GTask
*
task
=
g_task_new
(
pDocView
,
NULL
,
NULL
,
NULL
);
LOEvent
*
pLOEvent
=
new
LOEvent
(
LOK_SET_PARTMODE
);
pLOEvent
->
m_nPartMode
=
nPartMode
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
...
...
@@ -1926,12 +1928,13 @@ SAL_DLLPUBLIC_EXPORT void
lok_doc_view_set_edit
(
LOKDocView
*
pDocView
,
gboolean
bEdit
)
{
LOKDocViewPrivate
*
priv
=
static_cast
<
LOKDocViewPrivate
*>
(
lok_doc_view_get_instance_private
(
pDocView
));
GTask
*
task
=
g_task_new
(
pDocView
,
NULL
,
NULL
,
NULL
);
LOEvent
*
pLOEvent
=
new
LOEvent
(
LOK_SET_EDIT
);
pLOEvent
->
m_bEdit
=
bEdit
;
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
...
...
@@ -1961,14 +1964,14 @@ lok_doc_view_post_command (LOKDocView* pDocView,
const
gchar
*
pCommand
,
const
gchar
*
pArguments
)
{
LOKDocViewPrivate
*
priv
=
static_cast
<
LOKDocViewPrivate
*>
(
lok_doc_view_get_instance_private
(
pDocView
));
GTask
*
task
=
g_task_new
(
pDocView
,
NULL
,
NULL
,
NULL
);
LOEvent
*
pLOEvent
=
new
LOEvent
(
LOK_POST_COMMAND
);
pLOEvent
->
m_pCommand
=
pCommand
;
pLOEvent
->
m_pArguments
=
g_strdup
(
pArguments
);
g_task_set_task_data
(
task
,
pLOEvent
,
g_free
);
g_thread_pool_push
(
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_thread_pool_push
(
priv
->
lokThreadPool
,
g_object_ref
(
task
),
NULL
);
g_object_unref
(
task
);
}
...
...
libreofficekit/source/gtk/tilebuffer.cxx
Dosyayı görüntüle @
4df957f7
...
...
@@ -13,8 +13,6 @@
#define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
#endif
extern
GThreadPool
*
lokThreadPool
;
/* ------------------
Utility functions
------------------
...
...
@@ -62,7 +60,8 @@ void TileBuffer::resetAllTiles()
}
}
void
TileBuffer
::
setInvalid
(
int
x
,
int
y
,
float
fZoom
,
GTask
*
task
)
void
TileBuffer
::
setInvalid
(
int
x
,
int
y
,
float
fZoom
,
GTask
*
task
,
GThreadPool
*
lokThreadPool
)
{
int
index
=
x
*
m_nWidth
+
y
;
g_info
(
"Setting tile invalid (%d, %d)"
,
x
,
y
);
...
...
@@ -79,7 +78,8 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task)
}
}
Tile
&
TileBuffer
::
getTile
(
int
x
,
int
y
,
float
fZoom
,
GTask
*
task
)
Tile
&
TileBuffer
::
getTile
(
int
x
,
int
y
,
float
fZoom
,
GTask
*
task
,
GThreadPool
*
lokThreadPool
)
{
int
index
=
x
*
m_nWidth
+
y
;
...
...
libreofficekit/source/gtk/tilebuffer.hxx
Dosyayı görüntüle @
4df957f7
...
...
@@ -103,11 +103,15 @@ class TileBuffer
@param x the tile along the x-axis of the buffer
@param y the tile along the y-axis of the buffer
@param aZoom This function needs the zoom factor to draw the tile using paintTile()
@param aZoom current zoom factor of the document
@param task GTask object containing the necessary data
@param pool GThreadPool managed by the widget instance used for all the
LOK calls made by widget. It is needed here because getTile invokes one
of the LOK call : paintTile.
@return the tile at the mentioned position (x, y)
*/
Tile
&
getTile
(
int
x
,
int
y
,
float
aZoom
,
GTask
*
task
);
Tile
&
getTile
(
int
x
,
int
y
,
float
aZoom
,
GTask
*
task
,
GThreadPool
*
pool
);
/// Destroys all the tiles in the tile buffer; also frees the memory allocated
/// for all the Tile objects.
void
resetAllTiles
();
...
...
@@ -117,8 +121,13 @@ class TileBuffer
@param x the position of tile along x-axis
@param y the position of tile along y-axis
@param zoom zoom factor of the document
@param task GTask object containing the necessary data
@param pool GThreadPool managed by the widget instance used for all the
LOK calls made by widget. It is needed here because setInvalid() invokes one
of the LOK call : paintTile.
*/
void
setInvalid
(
int
x
,
int
y
,
float
zoom
,
GTask
*
task
);
void
setInvalid
(
int
x
,
int
y
,
float
zoom
,
GTask
*
task
,
GThreadPool
*
);
/// Contains the reference to the LOK Document that this tile buffer is for.
LibreOfficeKitDocument
*
m_pLOKDocument
;
...
...
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