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
99a034f9
Kaydet (Commit)
99a034f9
authored
Nis 27, 2014
tarafından
Zolnai Tamás
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
OpenGLHelper: extract BGRA buffer -> BitmepEx conversion
Change-Id: I71edb2768d24f0c6686a9c94333447a5acc498b4
üst
825265f0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
52 deletions
+33
-52
OpenGLRender.cxx
chart2/source/view/main/OpenGLRender.cxx
+1
-26
OpenGLHelper.hxx
include/vcl/opengl/OpenGLHelper.hxx
+1
-0
OpenGLContext.cxx
vcl/source/opengl/OpenGLContext.cxx
+2
-26
OpenGLHelper.cxx
vcl/source/opengl/OpenGLHelper.cxx
+29
-0
No files found.
chart2/source/view/main/OpenGLRender.cxx
Dosyayı görüntüle @
99a034f9
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include <GL/glew.h>
#include <GL/glew.h>
#include <vector>
#include <vector>
#include "OpenGLRender.hxx"
#include "OpenGLRender.hxx"
#include <vcl/bmpacc.hxx>
#include <vcl/graph.hxx>
#include <vcl/graph.hxx>
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
...
@@ -200,31 +199,7 @@ BitmapEx OpenGLRender::GetAsBitmap()
...
@@ -200,31 +199,7 @@ BitmapEx OpenGLRender::GetAsBitmap()
boost
::
scoped_array
<
sal_uInt8
>
buf
(
new
sal_uInt8
[
m_iWidth
*
m_iHeight
*
4
]);
boost
::
scoped_array
<
sal_uInt8
>
buf
(
new
sal_uInt8
[
m_iWidth
*
m_iHeight
*
4
]);
glReadPixels
(
0
,
0
,
m_iWidth
,
m_iHeight
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
buf
.
get
());
glReadPixels
(
0
,
0
,
m_iWidth
,
m_iHeight
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
buf
.
get
());
Bitmap
aBitmap
(
Size
(
m_iWidth
,
m_iHeight
),
24
);
BitmapEx
aBmp
=
OpenGLHelper
::
ConvertBGRABufferToBitmapEx
(
buf
.
get
(),
m_iWidth
,
m_iHeight
);
AlphaMask
aAlpha
(
Size
(
m_iWidth
,
m_iHeight
)
);
{
Bitmap
::
ScopedWriteAccess
pWriteAccess
(
aBitmap
);
AlphaMask
::
ScopedWriteAccess
pAlphaWriteAccess
(
aAlpha
);
size_t
nCurPos
=
0
;
for
(
int
y
=
0
;
y
<
m_iHeight
;
++
y
)
{
Scanline
pScan
=
pWriteAccess
->
GetScanline
(
y
);
Scanline
pAlphaScan
=
pAlphaWriteAccess
->
GetScanline
(
y
);
for
(
int
x
=
0
;
x
<
m_iWidth
;
++
x
)
{
*
pScan
++
=
buf
[
nCurPos
];
*
pScan
++
=
buf
[
nCurPos
+
1
];
*
pScan
++
=
buf
[
nCurPos
+
2
];
nCurPos
+=
3
;
*
pAlphaScan
++
=
static_cast
<
sal_uInt8
>
(
255
-
buf
[
nCurPos
++
]
);
}
}
}
BitmapEx
aBmp
(
aBitmap
,
aAlpha
);
#if DEBUG_PNG // debug PNG writing
#if DEBUG_PNG // debug PNG writing
static
int
nIdx
=
0
;
static
int
nIdx
=
0
;
...
...
include/vcl/opengl/OpenGLHelper.hxx
Dosyayı görüntüle @
99a034f9
...
@@ -22,6 +22,7 @@ public:
...
@@ -22,6 +22,7 @@ public:
static
GLint
LoadShaders
(
const
OUString
&
rVertexShaderName
,
const
OUString
&
rFragmentShaderName
);
static
GLint
LoadShaders
(
const
OUString
&
rVertexShaderName
,
const
OUString
&
rFragmentShaderName
);
static
sal_uInt8
*
ConvertBitmapExToRGBABuffer
(
const
BitmapEx
&
rBitmapEx
);
static
sal_uInt8
*
ConvertBitmapExToRGBABuffer
(
const
BitmapEx
&
rBitmapEx
);
static
BitmapEx
ConvertBGRABufferToBitmapEx
(
const
sal_uInt8
*
const
pBuffer
,
long
nWidth
,
long
nHeight
);
};
};
#endif
#endif
...
...
vcl/source/opengl/OpenGLContext.cxx
Dosyayı görüntüle @
99a034f9
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
*/
*/
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
#include <vcl/syschild.hxx>
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/sysdata.hxx>
...
@@ -15,7 +16,6 @@
...
@@ -15,7 +16,6 @@
#include <vcl/pngwrite.hxx>
#include <vcl/pngwrite.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/graph.hxx>
#include <vcl/graph.hxx>
#include <vcl/bitmapex.hxx>
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
;
...
@@ -522,31 +522,7 @@ void OpenGLContext::renderToFile()
...
@@ -522,31 +522,7 @@ void OpenGLContext::renderToFile()
boost
::
scoped_array
<
sal_uInt8
>
buf
(
new
sal_uInt8
[
iWidth
*
iHeight
*
4
]);
boost
::
scoped_array
<
sal_uInt8
>
buf
(
new
sal_uInt8
[
iWidth
*
iHeight
*
4
]);
glReadPixels
(
0
,
0
,
iWidth
,
iHeight
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
buf
.
get
());
glReadPixels
(
0
,
0
,
iWidth
,
iHeight
,
GL_BGRA
,
GL_UNSIGNED_BYTE
,
buf
.
get
());
Bitmap
aBitmap
(
Size
(
iWidth
,
iHeight
),
24
);
BitmapEx
aBmp
=
OpenGLHelper
::
ConvertBGRABufferToBitmapEx
(
buf
.
get
(),
iWidth
,
iHeight
);
AlphaMask
aAlpha
(
Size
(
iWidth
,
iHeight
)
);
{
Bitmap
::
ScopedWriteAccess
pWriteAccess
(
aBitmap
);
AlphaMask
::
ScopedWriteAccess
pAlphaWriteAccess
(
aAlpha
);
size_t
nCurPos
=
0
;
for
(
int
y
=
0
;
y
<
iHeight
;
++
y
)
{
Scanline
pScan
=
pWriteAccess
->
GetScanline
(
y
);
Scanline
pAlphaScan
=
pAlphaWriteAccess
->
GetScanline
(
y
);
for
(
int
x
=
0
;
x
<
iWidth
;
++
x
)
{
*
pScan
++
=
buf
[
nCurPos
];
*
pScan
++
=
buf
[
nCurPos
+
1
];
*
pScan
++
=
buf
[
nCurPos
+
2
];
nCurPos
+=
3
;
*
pAlphaScan
++
=
static_cast
<
sal_uInt8
>
(
255
-
buf
[
nCurPos
++
]
);
}
}
}
BitmapEx
aBmp
(
aBitmap
,
aAlpha
);
static
int
nIdx
=
0
;
static
int
nIdx
=
0
;
OUString
aName
=
OUString
(
"file:///home/moggi/Documents/work/text"
)
+
OUString
::
number
(
nIdx
++
)
+
".png"
;
OUString
aName
=
OUString
(
"file:///home/moggi/Documents/work/text"
)
+
OUString
::
number
(
nIdx
++
)
+
".png"
;
try
{
try
{
...
...
vcl/source/opengl/OpenGLHelper.cxx
Dosyayı görüntüle @
99a034f9
...
@@ -168,4 +168,33 @@ sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
...
@@ -168,4 +168,33 @@ sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
return
pBitmapBuf
;
return
pBitmapBuf
;
}
}
BitmapEx
OpenGLHelper
::
ConvertBGRABufferToBitmapEx
(
const
sal_uInt8
*
const
pBuffer
,
long
nWidth
,
long
nHeight
)
{
assert
(
pBuffer
);
Bitmap
aBitmap
(
Size
(
nWidth
,
nHeight
),
24
);
AlphaMask
aAlpha
(
Size
(
nWidth
,
nHeight
)
);
{
Bitmap
::
ScopedWriteAccess
pWriteAccess
(
aBitmap
);
AlphaMask
::
ScopedWriteAccess
pAlphaWriteAccess
(
aAlpha
);
size_t
nCurPos
=
0
;
for
(
int
y
=
0
;
y
<
nHeight
;
++
y
)
{
Scanline
pScan
=
pWriteAccess
->
GetScanline
(
y
);
Scanline
pAlphaScan
=
pAlphaWriteAccess
->
GetScanline
(
y
);
for
(
int
x
=
0
;
x
<
nWidth
;
++
x
)
{
*
pScan
++
=
pBuffer
[
nCurPos
];
*
pScan
++
=
pBuffer
[
nCurPos
+
1
];
*
pScan
++
=
pBuffer
[
nCurPos
+
2
];
nCurPos
+=
3
;
*
pAlphaScan
++
=
static_cast
<
sal_uInt8
>
(
255
-
pBuffer
[
nCurPos
++
]
);
}
}
}
return
BitmapEx
(
aBitmap
,
aAlpha
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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