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
20e4e65b
Kaydet (Commit)
20e4e65b
authored
May 24, 2014
tarafından
Markus Mohrhard
Kaydeden (comit)
Markus Mohrhard
May 24, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add a text cache to improve rendering performance
Change-Id: I5b3fbe9476f0eafed4524f57aa7bf65dfd029c1d
üst
4f8d9775
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
14 deletions
+43
-14
GL3DBarChart.cxx
chart2/source/view/charttypes/GL3DBarChart.cxx
+8
-4
3DChartObjects.hxx
chart2/source/view/inc/3DChartObjects.hxx
+14
-2
GL3DBarChart.hxx
chart2/source/view/inc/GL3DBarChart.hxx
+3
-0
3DChartObjects.cxx
chart2/source/view/main/3DChartObjects.cxx
+18
-8
No files found.
chart2/source/view/charttypes/GL3DBarChart.cxx
Dosyayı görüntüle @
20e4e65b
...
...
@@ -30,7 +30,8 @@ GL3DBarChart::GL3DBarChart(
mpRenderer
(
new
opengl3D
::
OpenGL3DRenderer
()),
mrWindow
(
rWindow
),
mpCamera
(
NULL
),
mbValidContext
(
true
)
mbValidContext
(
true
),
mpTextCache
(
new
opengl3D
::
TextCache
())
{
Size
aSize
=
mrWindow
.
GetSizePixel
();
mpRenderer
->
SetSize
(
aSize
);
...
...
@@ -101,7 +102,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
if
(
!
aSeriesName
.
isEmpty
())
{
maShapes
.
push_back
(
new
opengl3D
::
Text
(
mpRenderer
.
get
(),
aSeriesName
,
nId
++
));
maShapes
.
push_back
(
new
opengl3D
::
Text
(
mpRenderer
.
get
(),
*
mpTextCache
,
aSeriesName
,
nId
++
));
opengl3D
::
Text
*
p
=
static_cast
<
opengl3D
::
Text
*>
(
&
maShapes
.
back
());
glm
::
vec3
aTopLeft
,
aTopRight
,
aBottomRight
;
aTopLeft
.
x
=
-
nBarDistanceY
;
...
...
@@ -181,7 +183,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
float
nXPos
=
i
*
(
nBarSizeX
+
nBarDistanceX
);
maShapes
.
push_back
(
new
opengl3D
::
Text
(
mpRenderer
.
get
(),
aCats
[
i
],
nId
++
));
maShapes
.
push_back
(
new
opengl3D
::
Text
(
mpRenderer
.
get
(),
*
mpTextCache
,
aCats
[
i
],
nId
++
));
opengl3D
::
Text
*
p
=
static_cast
<
opengl3D
::
Text
*>
(
&
maShapes
.
back
());
aTopLeft
.
x
=
nXPos
+
TEXT_HEIGHT
;
aTopLeft
.
y
=
nYPos
+
calculateTextWidth
(
aCats
[
i
])
+
0.5
*
nBarDistanceY
;
...
...
@@ -193,7 +196,8 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
// create shapes on other side as well
maShapes
.
push_back
(
new
opengl3D
::
Text
(
mpRenderer
.
get
(),
aCats
[
i
],
nId
++
));
maShapes
.
push_back
(
new
opengl3D
::
Text
(
mpRenderer
.
get
(),
*
mpTextCache
,
aCats
[
i
],
nId
++
));
p
=
static_cast
<
opengl3D
::
Text
*>
(
&
maShapes
.
back
());
aTopLeft
.
x
=
nXPos
+
TEXT_HEIGHT
;
aTopLeft
.
y
=
-
0.5
*
nBarDistanceY
;
...
...
chart2/source/view/inc/3DChartObjects.hxx
Dosyayı görüntüle @
20e4e65b
...
...
@@ -14,10 +14,22 @@
#include <vcl/opengl/OpenGLContext.hxx>
#include "GL3DRenderer.hxx"
#include <boost/ptr_container/ptr_map.hpp>
namespace
chart
{
namespace
opengl3D
{
class
TextCache
{
public
:
const
BitmapEx
&
getText
(
OUString
rText
);
private
:
typedef
boost
::
ptr_map
<
OUString
,
BitmapEx
>
TextCacheType
;
TextCacheType
maTextCache
;
};
class
Renderable3DObject
{
public
:
...
...
@@ -65,7 +77,7 @@ private:
class
Text
:
public
Renderable3DObject
{
public
:
Text
(
OpenGL3DRenderer
*
pRenderer
,
const
OUString
&
rStr
,
sal_uInt32
nId
);
Text
(
OpenGL3DRenderer
*
pRenderer
,
TextCache
&
rTextCache
,
const
OUString
&
rStr
,
sal_uInt32
nId
);
virtual
void
render
()
SAL_OVERRIDE
;
Size
getSize
()
const
;
...
...
@@ -73,7 +85,7 @@ public:
void
setPosition
(
const
glm
::
vec3
&
rTopLeft
,
const
glm
::
vec3
&
rTopRight
,
const
glm
::
vec3
&
rBottomRight
);
private
:
BitmapEx
ma
Text
;
const
BitmapEx
&
mr
Text
;
glm
::
vec3
maTopLeft
;
glm
::
vec3
maTopRight
;
glm
::
vec3
maBottomRight
;
...
...
chart2/source/view/inc/GL3DBarChart.hxx
Dosyayı görüntüle @
20e4e65b
...
...
@@ -26,6 +26,7 @@ namespace opengl3D {
class
Renderable3DObject
;
class
OpenGL3DRenderer
;
class
TextCache
;
class
Camera
;
}
...
...
@@ -58,6 +59,8 @@ private:
opengl3D
::
Camera
*
mpCamera
;
bool
mbValidContext
;
boost
::
scoped_ptr
<
opengl3D
::
TextCache
>
mpTextCache
;
};
}
...
...
chart2/source/view/main/3DChartObjects.cxx
Dosyayı görüntüle @
20e4e65b
...
...
@@ -68,10 +68,12 @@ void Line::setLineColor(const Color& rColor)
maLineColor
=
rColor
;
}
Text
::
Text
(
OpenGL3DRenderer
*
pRenderer
,
const
OUString
&
rStr
,
sal_uInt32
nId
)
:
Renderable3DObject
(
pRenderer
,
nId
)
const
BitmapEx
&
TextCache
::
getText
(
OUString
rText
)
{
// Convert OUString to BitmapEx.
TextCacheType
::
const_iterator
itr
=
maTextCache
.
find
(
rText
);
if
(
itr
!=
maTextCache
.
end
())
return
*
itr
->
second
;
VirtualDevice
aDevice
(
*
Application
::
GetDefaultDevice
(),
0
,
0
);
Font
aFont
=
aDevice
.
GetFont
();
aFont
.
SetSize
(
Size
(
0
,
96
));
...
...
@@ -79,27 +81,35 @@ Text::Text(OpenGL3DRenderer* pRenderer, const OUString& rStr, sal_uInt32 nId):
::
Rectangle
aRect
;
aDevice
.
SetFont
(
aFont
);
aDevice
.
Erase
();
aDevice
.
GetTextBoundRect
(
aRect
,
r
Str
);
aDevice
.
GetTextBoundRect
(
aRect
,
r
Text
);
Size
aSize
=
aRect
.
GetSize
();
aSize
.
Width
()
+=
5
;
aSize
.
Height
()
*=
1.6
;
aDevice
.
SetOutputSizePixel
(
aSize
);
aDevice
.
SetBackground
(
Wallpaper
(
COL_TRANSPARENT
));
aDevice
.
DrawText
(
Point
(
0
,
0
),
r
Str
);
aDevice
.
DrawText
(
Point
(
0
,
0
),
r
Text
);
maText
=
BitmapEx
(
aDevice
.
GetBitmapEx
(
Point
(
0
,
0
),
aSize
));
BitmapEx
*
pText
=
new
BitmapEx
(
aDevice
.
GetBitmapEx
(
Point
(
0
,
0
),
aSize
));
maTextCache
.
insert
(
rText
,
pText
);
return
*
pText
;
}
Text
::
Text
(
OpenGL3DRenderer
*
pRenderer
,
TextCache
&
rTextCache
,
const
OUString
&
rStr
,
sal_uInt32
nId
)
:
Renderable3DObject
(
pRenderer
,
nId
),
mrText
(
rTextCache
.
getText
(
rStr
))
{
}
void
Text
::
render
()
{
glm
::
vec3
dir2
=
maTopRight
-
maTopLeft
;
glm
::
vec3
bottomLeft
=
maBottomRight
-
dir2
;
mpRenderer
->
CreateTextTexture
(
m
a
Text
,
maTopLeft
,
maTopRight
,
maBottomRight
,
bottomLeft
,
mnUniqueId
);
mpRenderer
->
CreateTextTexture
(
m
r
Text
,
maTopLeft
,
maTopRight
,
maBottomRight
,
bottomLeft
,
mnUniqueId
);
}
Size
Text
::
getSize
()
const
{
return
m
a
Text
.
GetSizePixel
();
return
m
r
Text
.
GetSizePixel
();
}
void
Text
::
setPosition
(
const
glm
::
vec3
&
rTopLeft
,
const
glm
::
vec3
&
rTopRight
,
const
glm
::
vec3
&
rBottomRight
)
...
...
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