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
4ba89680
Kaydet (Commit)
4ba89680
authored
Mar 07, 2014
tarafından
Markus Mohrhard
Kaydeden (comit)
Markus Mohrhard
Mar 07, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
cache text rendering for performance
Change-Id: I644556ed6b74069d0e7d441d4056310a282f190e
üst
20113d8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
18 deletions
+88
-18
DummyXShape.hxx
chart2/source/view/inc/DummyXShape.hxx
+35
-0
DummyXShape.cxx
chart2/source/view/main/DummyXShape.cxx
+53
-16
OpenglShapeFactory.cxx
chart2/source/view/main/OpenglShapeFactory.cxx
+0
-2
No files found.
chart2/source/view/inc/DummyXShape.hxx
Dosyayı görüntüle @
4ba89680
...
...
@@ -60,6 +60,7 @@
#include <vector>
#include <map>
#include <boost/scoped_ptr.hpp>
#include <boost/unordered_map.hpp>
#if defined( MACOSX )
#include <OpenGL/gl.h>
...
...
@@ -97,6 +98,38 @@ class DummyChart;
struct
OpenglContext
;
class
TextCache
{
public
:
struct
TextCacheKey
{
OUString
maText
;
std
::
map
<
OUString
,
com
::
sun
::
star
::
uno
::
Any
>
maProperties
;
bool
operator
==
(
const
TextCacheKey
&
rKey
)
const
{
return
maText
==
rKey
.
maText
&&
maProperties
==
rKey
.
maProperties
;
}
};
struct
TextCacheKeyHash
{
size_t
operator
()(
const
TextCacheKey
&
rKey
)
const
{
return
rKey
.
maText
.
hashCode
();
}
};
bool
hasEntry
(
const
TextCacheKey
&
rKey
);
BitmapEx
&
getBitmap
(
const
TextCacheKey
&
rKey
);
void
insertBitmap
(
const
TextCacheKey
&
rKey
,
const
BitmapEx
&
rBitmap
);
private
:
boost
::
unordered_map
<
TextCacheKey
,
BitmapEx
,
TextCacheKeyHash
>
maCache
;
};
class
DummyXShape
:
public
cppu
::
WeakAggImplHelper6
<
::
com
::
sun
::
star
::
drawing
::
XShape
,
com
::
sun
::
star
::
beans
::
XPropertySet
,
...
...
@@ -392,6 +425,7 @@ public:
virtual
void
render
()
SAL_OVERRIDE
;
void
clear
();
TextCache
&
getTextCache
();
private
:
...
...
@@ -403,6 +437,7 @@ private:
bool
initOpengl
();
boost
::
scoped_ptr
<
Window
>
mpWindow
;
boost
::
scoped_ptr
<
SystemChildWindow
>
pWindow
;
TextCache
maTextCache
;
public
:
OpenGLRender
m_GLRender
;
};
...
...
chart2/source/view/main/DummyXShape.cxx
Dosyayı görüntüle @
4ba89680
...
...
@@ -48,6 +48,21 @@ namespace chart {
namespace
dummy
{
bool
TextCache
::
hasEntry
(
const
TextCacheKey
&
rKey
)
{
return
maCache
.
find
(
rKey
)
!=
maCache
.
end
();
}
BitmapEx
&
TextCache
::
getBitmap
(
const
TextCacheKey
&
rKey
)
{
return
maCache
.
find
(
rKey
)
->
second
;
}
void
TextCache
::
insertBitmap
(
const
TextCacheKey
&
rKey
,
const
BitmapEx
&
rBitmap
)
{
maCache
.
insert
(
std
::
pair
<
TextCacheKey
,
BitmapEx
>
(
rKey
,
rBitmap
));
}
class
DummyPropertySetInfo
:
public
cppu
::
WeakImplHelper1
<
com
::
sun
::
star
::
beans
::
XPropertySetInfo
>
{
...
...
@@ -791,22 +806,39 @@ DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
{
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
());
int
screenHeight
=
(
aRect
.
BottomRight
().
Y
());
aDevice
.
SetOutputSizePixel
(
Size
(
screenWidth
*
3
,
screenHeight
));
aDevice
.
SetBackground
(
Wallpaper
(
COL_TRANSPARENT
));
aDevice
.
DrawText
(
Point
(
0
,
0
),
rText
);
int
bmpWidth
=
aRect
.
Right
()
-
aRect
.
Left
();
int
bmpHeight
=
aRect
.
Bottom
()
-
aRect
.
Top
();
maBitmap
=
BitmapEx
(
aDevice
.
GetBitmapEx
(
aRect
.
TopLeft
(),
Size
(
bmpWidth
,
bmpHeight
)));
xTarget
->
add
(
this
);
DummyChart
*
pChart
=
getRootShape
();
TextCache
&
rCache
=
pChart
->
getTextCache
();
TextCache
::
TextCacheKey
aKey
;
aKey
.
maText
=
maText
;
aKey
.
maProperties
=
maProperties
;
int
bmpWidth
;
int
bmpHeight
;
if
(
rCache
.
hasEntry
(
aKey
))
{
maBitmap
=
rCache
.
getBitmap
(
aKey
);
bmpWidth
=
maBitmap
.
GetSizePixel
().
Width
();
bmpHeight
=
maBitmap
.
GetSizePixel
().
Height
();
}
else
{
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
());
int
screenHeight
=
(
aRect
.
BottomRight
().
Y
());
aDevice
.
SetOutputSizePixel
(
Size
(
screenWidth
*
3
,
screenHeight
));
aDevice
.
SetBackground
(
Wallpaper
(
COL_TRANSPARENT
));
aDevice
.
DrawText
(
Point
(
0
,
0
),
rText
);
bmpWidth
=
aRect
.
Right
()
-
aRect
.
Left
();
bmpHeight
=
aRect
.
Bottom
()
-
aRect
.
Top
();
maBitmap
=
BitmapEx
(
aDevice
.
GetBitmapEx
(
aRect
.
TopLeft
(),
Size
(
bmpWidth
,
bmpHeight
)));
rCache
.
insertBitmap
(
aKey
,
maBitmap
);
}
if
(
rTrans
.
hasValue
())
{
...
...
@@ -1541,6 +1573,11 @@ void DummyChart::clear()
maShapes
.
clear
();
}
TextCache
&
DummyChart
::
getTextCache
()
{
return
maTextCache
;
}
}
}
...
...
chart2/source/view/main/OpenglShapeFactory.cxx
Dosyayı görüntüle @
4ba89680
...
...
@@ -404,7 +404,6 @@ uno::Reference< drawing::XShape >
{
dummy
::
DummyText
*
pText
=
new
dummy
::
DummyText
(
rText
,
rPropNames
,
rPropValues
,
rATransformation
,
xTarget
,
0
);
xTarget
->
add
(
pText
);
return
pText
;
}
...
...
@@ -453,7 +452,6 @@ uno::Reference< drawing::XShape >
dummy
::
DummyText
*
pText
=
new
dummy
::
DummyText
(
aString
,
aPropNames
,
aPropValues
,
uno
::
makeAny
(
B2DHomMatrixToHomogenMatrix3
(
aM
)),
xTarget
,
nRotation
);
pText
->
setName
(
rName
);
xTarget
->
add
(
pText
);
return
pText
;
}
...
...
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