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
9e9a4b40
Kaydet (Commit)
9e9a4b40
authored
Ock 14, 2014
tarafından
Markus Mohrhard
Kaydeden (comit)
Markus Mohrhard
Ock 29, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
more work for text rendering
Change-Id: I4c94757de59722b7dfec9e2d0db83fc5734ba942
üst
2a7538ff
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
47 deletions
+64
-47
DummyXShape.hxx
chart2/source/view/inc/DummyXShape.hxx
+3
-0
DummyXShape.cxx
chart2/source/view/main/DummyXShape.cxx
+39
-12
OpenGLRender.cxx
chart2/source/view/main/OpenGLRender.cxx
+20
-34
OpenGLRender.hxx
chart2/source/view/main/OpenGLRender.hxx
+2
-1
No files found.
chart2/source/view/inc/DummyXShape.hxx
Dosyayı görüntüle @
9e9a4b40
...
...
@@ -374,9 +374,12 @@ public:
virtual
void
render
()
SAL_OVERRIDE
;
virtual
void
SAL_CALL
setPropertyValue
(
const
OUString
&
aPropertyName
,
const
::
com
::
sun
::
star
::
uno
::
Any
&
aValue
)
throw
(
::
com
::
sun
::
star
::
beans
::
UnknownPropertyException
,
::
com
::
sun
::
star
::
beans
::
PropertyVetoException
,
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
,
::
com
::
sun
::
star
::
lang
::
WrappedTargetException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
private
:
OUString
maText
;
uno
::
Any
maTrans
;
BitmapEx
maBitmap
;
};
class
DummyFormattedText
:
public
DummyXShape
...
...
chart2/source/view/main/DummyXShape.cxx
Dosyayı görüntüle @
9e9a4b40
...
...
@@ -21,6 +21,8 @@
#include <rtl/ustring.hxx>
#include <vcl/window.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <tools/gen.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <editeng/unoprnms.hxx>
...
...
@@ -618,14 +620,6 @@ void DummyRectangle::render()
pChart
->
m_GLRender
.
RenderRectangleShape
(
bBorder
,
bFill
);
}
DummyText
::
DummyText
(
const
OUString
&
rText
,
const
tNameSequence
&
rNames
,
const
tAnySequence
&
rValues
,
const
uno
::
Any
&
rTrans
)
:
maText
(
rText
),
maTrans
(
rTrans
)
{
setProperties
(
rNames
,
rValues
,
maProperties
);
}
namespace
{
struct
FontAttribSetter
...
...
@@ -675,19 +669,52 @@ private:
}
void
DummyText
::
render
()
DummyText
::
DummyText
(
const
OUString
&
rText
,
const
tNameSequence
&
rNames
,
const
tAnySequence
&
rValues
,
const
uno
::
Any
&
rTrans
)
:
maText
(
rText
),
maTrans
(
rTrans
)
{
SAL_WARN
(
"chart2.opengl"
,
"render DummyText"
);
debugProperties
(
maProperties
);
setProperties
(
rNames
,
rValues
,
maProperties
);
Font
aFont
;
std
::
for_each
(
maProperties
.
begin
(),
maProperties
.
end
(),
FontAttribSetter
(
aFont
));
VirtualDevice
aDevice
(
*
Application
::
GetDefaultDevice
(),
0
,
0
);
aDevice
.
Erase
();
Rectangle
aRect
;
aDevice
.
SetFont
(
aFont
);
aDevice
.
GetTextBoundRect
(
aRect
,
rText
);
int
screenWidth
=
(
aRect
.
BottomRight
().
X
()
+
3
)
&
~
3
;
int
screenHeight
=
(
aRect
.
BottomRight
().
Y
()
+
3
)
&
~
3
;
aDevice
.
SetOutputSizePixel
(
Size
(
screenWidth
*
3
,
screenHeight
));
aDevice
.
SetBackground
(
Wallpaper
(
COL_TRANSPARENT
));
aDevice
.
DrawText
(
Point
(
0
,
0
),
rText
);
int
bmpWidth
=
(
aRect
.
Right
()
-
aRect
.
Left
()
+
3
)
&
~
3
;
int
bmpHeight
=
(
aRect
.
Bottom
()
-
aRect
.
Top
()
+
3
)
&
~
3
;
maBitmap
=
BitmapEx
(
aDevice
.
GetBitmapEx
(
aRect
.
TopLeft
(),
Size
(
bmpWidth
,
bmpHeight
)));
setSize
(
awt
::
Size
(
bmpWidth
,
bmpHeight
));
}
void
DummyText
::
render
()
{
SAL_WARN
(
"chart2.opengl"
,
"render DummyText"
);
debugProperties
(
maProperties
);
DummyChart
*
pChart
=
getRootShape
();
pChart
->
m_GLRender
.
CreateTextTexture
(
ma
Text
,
0
,
aFont
,
maPosition
,
maSize
,
0
);
pChart
->
m_GLRender
.
CreateTextTexture
(
ma
Bitmap
,
maPosition
,
maSize
,
0
);
pChart
->
m_GLRender
.
RenderTextShape
();
}
void
DummyText
::
setPropertyValue
(
const
OUString
&
rName
,
const
uno
::
Any
&
rValue
)
throw
(
beans
::
UnknownPropertyException
,
beans
::
PropertyVetoException
,
lang
::
IllegalArgumentException
,
lang
::
WrappedTargetException
,
uno
::
RuntimeException
)
{
SAL_WARN
(
"chart2.opengl"
,
"property value set after image has been created"
);
DummyXShape
::
setPropertyValue
(
rName
,
rValue
);
}
DummyFormattedText
::
DummyFormattedText
(
uno
::
Sequence
<
uno
::
Reference
<
chart2
::
XFormattedString
>
>&
rFormattedString
,
uno
::
Reference
<
beans
::
XPropertySet
>
,
double
fRotation
)
:
...
...
chart2/source/view/main/OpenGLRender.cxx
Dosyayı görüntüle @
9e9a4b40
...
...
@@ -10,7 +10,6 @@
#include <GL/glew.h>
#include <vector>
#include "OpenGLRender.hxx"
#include <vcl/bitmapex.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/graph.hxx>
#include <com/sun/star/awt/XBitmap.hpp>
...
...
@@ -36,8 +35,6 @@
#include <editeng/unoprnms.hxx>
#include <vcl/virdev.hxx>
#include <vcl/dibtools.hxx>
#include <vcl/bmpacc.hxx>
#include <vcl/svapp.hxx>
#include <boost/scoped_array.hpp>
...
...
@@ -45,7 +42,7 @@ using namespace com::sun::star;
using
namespace
std
;
#define DEBUG_PNG
0
#define DEBUG_PNG
1
#define BMP_HEADER_LEN 54
#if DEBUG_PNG
...
...
@@ -1459,27 +1456,14 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
}
int
OpenGLRender
::
CreateTextTexture
(
::
rtl
::
OUString
textValue
,
sal_uInt32
color
,
const
Font
&
rFont
,
awt
::
Point
aPos
,
awt
::
Size
aSize
,
long
rotation
)
int
OpenGLRender
::
CreateTextTexture
(
const
BitmapEx
&
rBitmapEx
,
awt
::
Point
aPos
,
awt
::
Size
aSize
,
long
rotation
)
{
VirtualDevice
aDevice
(
*
Application
::
GetDefaultDevice
(),
0
,
0
);
aDevice
.
Erase
();
Rectangle
aRect
;
aDevice
.
SetFont
(
rFont
);
aDevice
.
GetTextBoundRect
(
aRect
,
textValue
);
int
screenWidth
=
(
aRect
.
BottomRight
().
X
()
+
3
)
&
~
3
;
int
screenHeight
=
(
aRect
.
BottomRight
().
Y
()
+
3
)
&
~
3
;
aDevice
.
SetOutputSizePixel
(
Size
(
screenWidth
*
3
,
screenHeight
));
aDevice
.
SetBackground
(
Wallpaper
(
COL_TRANSPARENT
));
aDevice
.
DrawText
(
Point
(
0
,
0
),
textValue
);
int
bmpWidth
=
(
aRect
.
Right
()
-
aRect
.
Left
()
+
3
)
&
~
3
;
int
bmpHeight
=
(
aRect
.
Bottom
()
-
aRect
.
Top
()
+
3
)
&
~
3
;
BitmapEx
aBitmapEx
(
aDevice
.
GetBitmapEx
(
aRect
.
TopLeft
(),
Size
(
bmpWidth
,
bmpHeight
)));
#if DEBUG_PNG // debug PNG writing
static
int
nIdx
=
0
;
OUString
aName
=
OUString
(
"file:///home/moggi/Documents/work/text"
)
+
OUString
::
number
(
nIdx
++
)
+
".png"
;
try
{
vcl
::
PNGWriter
aWriter
(
a
BitmapEx
);
vcl
::
PNGWriter
aWriter
(
r
BitmapEx
);
SvFileStream
sOutput
(
aName
,
STREAM_WRITE
);
aWriter
.
Write
(
sOutput
);
sOutput
.
Close
();
...
...
@@ -1488,8 +1472,11 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
}
#endif
Bitmap
aBitmap
(
aBitmapEx
.
GetBitmap
());
AlphaMask
aAlpha
(
aBitmapEx
.
GetAlpha
());
long
bmpWidth
=
rBitmapEx
.
GetSizePixel
().
Width
();
long
bmpHeight
=
rBitmapEx
.
GetSizePixel
().
Height
();
Bitmap
aBitmap
(
rBitmapEx
.
GetBitmap
());
AlphaMask
aAlpha
(
rBitmapEx
.
GetAlpha
());
boost
::
scoped_array
<
sal_uInt8
>
bitmapBuf
(
new
sal_uInt8
[
4
*
bmpWidth
*
bmpHeight
]);
Bitmap
::
ScopedReadAccess
pReadAccces
(
aBitmap
);
AlphaMask
::
ScopedReadAccess
pAlphaReadAccess
(
aAlpha
);
...
...
@@ -1504,26 +1491,26 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
bitmapBuf
[
i
++
]
=
aCol
.
GetRed
();
bitmapBuf
[
i
++
]
=
aCol
.
GetGreen
();
bitmapBuf
[
i
++
]
=
aCol
.
GetBlue
();
bitmapBuf
[
i
++
]
=
*
pAScan
++
;
bitmapBuf
[
i
++
]
=
255
-
*
pAScan
++
;
}
}
TextInfo
aTextInfo
;
aTextInfo
.
x
=
(
float
)(
aPos
.
X
+
aSize
.
Width
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
y
=
(
float
)(
aPos
.
Y
+
aSize
.
Height
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
x
=
(
float
)(
aPos
.
X
+
aSize
.
Width
/
2
);
aTextInfo
.
y
=
(
float
)(
aPos
.
Y
+
aSize
.
Height
/
2
);
aTextInfo
.
z
=
m_fZStep
;
aTextInfo
.
rotation
=
-
(
double
)
rotation
*
GL_PI
/
18000.0
f
;
aTextInfo
.
vertex
[
0
]
=
(
float
)(
-
aSize
.
Width
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
1
]
=
(
float
)(
-
aSize
.
Height
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
0
]
=
(
float
)(
aPos
.
X
)
;
aTextInfo
.
vertex
[
1
]
=
(
float
)(
aPos
.
Y
)
;
aTextInfo
.
vertex
[
2
]
=
(
float
)(
a
Size
.
Width
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
3
]
=
(
float
)(
-
aSize
.
Height
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
2
]
=
(
float
)(
a
Pos
.
X
+
aSize
.
Width
)
;
aTextInfo
.
vertex
[
3
]
=
(
float
)(
aPos
.
Y
)
;
aTextInfo
.
vertex
[
4
]
=
(
float
)(
a
Size
.
Width
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
5
]
=
(
float
)(
a
Size
.
Height
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
4
]
=
(
float
)(
a
Pos
.
X
+
aSize
.
Width
)
;
aTextInfo
.
vertex
[
5
]
=
(
float
)(
a
Pos
.
Y
+
aSize
.
Height
)
;
aTextInfo
.
vertex
[
6
]
=
(
float
)(
-
aSize
.
Width
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
7
]
=
(
float
)(
a
Size
.
Height
/
2
)
/
OPENGL_SCALE_VALUE
;
aTextInfo
.
vertex
[
6
]
=
(
float
)(
aPos
.
X
)
;
aTextInfo
.
vertex
[
7
]
=
(
float
)(
a
Pos
.
Y
+
aSize
.
Height
)
;
//if has ratotion, we must re caculate the central pos
if
(
!
rtl
::
math
::
approxEqual
(
0
,
rotation
))
...
...
@@ -1561,7 +1548,6 @@ int OpenGLRender::CreateTextTexture(::rtl::OUString textValue, sal_uInt32 color,
glBindTexture
(
GL_TEXTURE_2D
,
0
);
CHECK_GL_ERROR
();
m_TextInfoList
.
push_back
(
aTextInfo
);
aDevice
.
Erase
();
return
0
;
}
...
...
@@ -1573,7 +1559,7 @@ int OpenGLRender::RenderTextShape()
for
(
size_t
i
=
0
;
i
<
listNum
;
i
++
)
{
TextInfo
&
textInfo
=
m_TextInfoList
.
front
();
PosVecf3
trans
=
{
textInfo
.
x
,
textInfo
.
y
,
textInfo
.
z
};
PosVecf3
trans
=
{
0
,
0
,
0
};
PosVecf3
angle
=
{
0.0
f
,
0.0
f
,
float
(
textInfo
.
rotation
)};
PosVecf3
scale
=
{
1.0
,
1.0
,
1.0
f
};
MoveModelf
(
trans
,
angle
,
scale
);
...
...
chart2/source/view/main/OpenGLRender.hxx
Dosyayı görüntüle @
9e9a4b40
...
...
@@ -28,6 +28,7 @@
#include <vcl/window.hxx>
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/bitmapex.hxx>
#if defined( _WIN32 )
#include <GL/glu.h>
...
...
@@ -170,7 +171,7 @@ public:
int
RenderRectangleShape
(
bool
bBorder
,
bool
bFill
);
int
RectangleShapePoint
(
float
x
,
float
y
,
float
directionX
,
float
directionY
);
int
CreateTextTexture
(
::
rtl
::
OUString
textValue
,
sal_uInt32
color
,
const
Font
&
rFont
,
int
CreateTextTexture
(
const
BitmapEx
&
rBitmapEx
,
com
::
sun
::
star
::
awt
::
Point
aPos
,
com
::
sun
::
star
::
awt
::
Size
aSize
,
long
rotation
);
int
RenderTextShape
();
...
...
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