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
7ffd1af7
Kaydet (Commit)
7ffd1af7
authored
May 08, 2014
tarafından
Markus Mohrhard
Kaydeden (comit)
Markus Mohrhard
May 08, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move the renderToFile function to the helper to avoid the context
Change-Id: I5493126047179d67b2f2ed0d3d5d936ebbaf4810
üst
6470b42c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
OpenGLHelper.hxx
include/vcl/opengl/OpenGLHelper.hxx
+1
-0
OpenGLContext.cxx
vcl/source/opengl/OpenGLContext.cxx
+1
-12
OpenGLHelper.cxx
vcl/source/opengl/OpenGLHelper.cxx
+18
-0
No files found.
include/vcl/opengl/OpenGLHelper.hxx
Dosyayı görüntüle @
7ffd1af7
...
...
@@ -23,6 +23,7 @@ public:
static
sal_uInt8
*
ConvertBitmapExToRGBABuffer
(
const
BitmapEx
&
rBitmapEx
);
static
BitmapEx
ConvertBGRABufferToBitmapEx
(
const
sal_uInt8
*
const
pBuffer
,
long
nWidth
,
long
nHeight
);
static
void
renderToFile
(
long
nWidth
,
long
nHeight
,
const
OUString
&
rFileName
);
static
const
char
*
GLErrorString
(
GLenum
errorCode
);
};
...
...
vcl/source/opengl/OpenGLContext.cxx
Dosyayı görüntüle @
7ffd1af7
...
...
@@ -558,20 +558,9 @@ void OpenGLContext::renderToFile()
{
int
iWidth
=
m_aGLWin
.
Width
;
int
iHeight
=
m_aGLWin
.
Height
;
boost
::
scoped_array
<
sal_uInt8
>
buf
(
new
sal_uInt8
[
iWidth
*
iHeight
*
4
]);
glReadPixels
(
0
,
0
,
iWidth
,
iHeight
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
buf
.
get
());
BitmapEx
aBmp
=
OpenGLHelper
::
ConvertBGRABufferToBitmapEx
(
buf
.
get
(),
iWidth
,
iHeight
);
static
int
nIdx
=
0
;
OUString
aName
=
OUString
(
"file:///home/moggi/Documents/work/output"
)
+
OUString
::
number
(
nIdx
++
)
+
".png"
;
try
{
vcl
::
PNGWriter
aWriter
(
aBmp
);
SvFileStream
sOutput
(
aName
,
STREAM_WRITE
);
aWriter
.
Write
(
sOutput
);
sOutput
.
Close
();
}
catch
(...)
{
SAL_WARN
(
"vcl.opengl"
,
"Error writing png to "
<<
aName
);
}
OpenGLHelper
::
renderToFile
(
iWidth
,
iHeight
,
aName
);
}
#if defined( WNT )
...
...
vcl/source/opengl/OpenGLHelper.cxx
Dosyayı görüntüle @
7ffd1af7
...
...
@@ -14,6 +14,9 @@
#include <config_folders.h>
#include <vcl/salbtype.hxx>
#include <vcl/bmpacc.hxx>
#include <boost/scoped_array.hpp>
#include <vcl/pngwrite.hxx>
#include <vcl/graph.hxx>
#include <vector>
...
...
@@ -168,6 +171,21 @@ sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
return
pBitmapBuf
;
}
void
OpenGLHelper
::
renderToFile
(
long
nWidth
,
long
nHeight
,
const
OUString
&
rFileName
)
{
boost
::
scoped_array
<
sal_uInt8
>
pBuffer
(
new
sal_uInt8
[
nWidth
*
nHeight
*
4
]);
glReadPixels
(
0
,
0
,
nWidth
,
nHeight
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
pBuffer
.
get
());
BitmapEx
aBitmap
=
ConvertBGRABufferToBitmapEx
(
pBuffer
.
get
(),
nWidth
,
nHeight
);
try
{
vcl
::
PNGWriter
aWriter
(
aBitmap
);
SvFileStream
sOutput
(
rFileName
,
STREAM_WRITE
);
aWriter
.
Write
(
sOutput
);
sOutput
.
Close
();
}
catch
(...)
{
SAL_WARN
(
"vcl.opengl"
,
"Error writing png to "
<<
rFileName
);
}
}
BitmapEx
OpenGLHelper
::
ConvertBGRABufferToBitmapEx
(
const
sal_uInt8
*
const
pBuffer
,
long
nWidth
,
long
nHeight
)
{
assert
(
pBuffer
);
...
...
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