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
1e3b09d3
Kaydet (Commit)
1e3b09d3
authored
Ock 14, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lokdocview: clean up renderDocument()
Change-Id: I7ee58b2c889da3ca01969617f7a382bf4135b7a1
üst
57204a48
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
lokdocview.c
libreofficekit/source/gtk/lokdocview.c
+16
-27
No files found.
libreofficekit/source/gtk/lokdocview.c
Dosyayı görüntüle @
1e3b09d3
...
...
@@ -100,19 +100,20 @@ SAL_DLLPUBLIC_EXPORT GtkWidget* lok_docview_new( LibreOfficeKit* pOffice )
return
GTK_WIDGET
(
pDocView
);
}
// We know that VirtualDevises use a DPI of 96.
static
const
int
g_nDPI
=
96
;
/// Converts from document coordinates to screen pixels.
static
float
twipToPixel
(
float
nInput
)
{
return
nInput
/
1440
.
0
f
*
g_nDPI
;
}
void
renderDocument
(
LOKDocView
*
pDocView
)
{
long
nWidth
,
nHeight
;
int
nRenderWidth
,
nRenderHeight
;
long
nDocumentWidthTwips
,
nDocumentHeightTwips
,
nBufferWidthPixels
,
nBufferHeightPixels
;
unsigned
char
*
pBuffer
;
int
nRowStride
;
// TODO: we really should scale by screen DPI here -- 10 seems to be a vaguely
// correct factor for my screen at least.
const
float
fScaleFactor
=
0
.
1
;
// Various things blow up if we try to draw too large a tile,
// this size seems to be safe. (Very rare/unlikely that
const
int
nMaxWidth
=
100000
;
g_assert
(
pDocView
->
pDocument
);
...
...
@@ -121,37 +122,25 @@ void renderDocument( LOKDocView* pDocView )
g_object_unref
(
G_OBJECT
(
pDocView
->
pPixBuf
)
);
}
pDocView
->
pDocument
->
pClass
->
getDocumentSize
(
pDocView
->
pDocument
,
&
nWidth
,
&
nHeight
);
if
(
nWidth
*
fScaleFactor
>
nMaxWidth
)
{
nWidth
=
nMaxWidth
;
}
if
(
nHeight
*
fScaleFactor
>
nMaxWidth
)
{
nHeight
=
nMaxWidth
;
}
pDocView
->
pDocument
->
pClass
->
getDocumentSize
(
pDocView
->
pDocument
,
&
nDocumentWidthTwips
,
&
nDocumentHeightTwips
);
// Draw the whole document at once (for now)
n
RenderWidth
=
nWidth
*
pDocView
->
fZoom
*
fScaleFactor
;
n
RenderHeight
=
nHeight
*
pDocView
->
fZoom
*
fScaleFactor
;
n
BufferWidthPixels
=
twipToPixel
(
nDocumentWidthTwips
)
*
pDocView
->
fZoom
;
n
BufferHeightPixels
=
twipToPixel
(
nDocumentHeightTwips
)
*
pDocView
->
fZoom
;
pDocView
->
pPixBuf
=
gdk_pixbuf_new
(
GDK_COLORSPACE_RGB
,
TRUE
,
8
,
n
RenderWidth
,
nRenderHeight
);
n
BufferWidthPixels
,
nBufferHeightPixels
);
pBuffer
=
gdk_pixbuf_get_pixels
(
pDocView
->
pPixBuf
);
pDocView
->
pDocument
->
pClass
->
paintTile
(
pDocView
->
pDocument
,
pBuffer
,
n
RenderWidth
,
nRenderHeight
,
n
BufferWidthPixels
,
nBufferHeightPixels
,
&
nRowStride
,
0
,
0
,
// origin
nWidth
,
nHeight
);
// TODO: double check that the rowstride really matches what we expected,
// although presumably we'd already be crashing by now if things were
// wrong.
nDocumentWidthTwips
,
nDocumentHeightTwips
);
(
void
)
nRowStride
;
gtk_image_set_from_pixbuf
(
GTK_IMAGE
(
pDocView
->
pCanvas
),
pDocView
->
pPixBuf
);
...
...
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