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
4f989f30
Kaydet (Commit)
4f989f30
authored
Nis 03, 2013
tarafından
Thomas Arnhold
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fdo#62525: use cow_wrapper for SdrLightingAttribute
Change-Id: Ibd6bd31ef78f2e853ff668f64202eff89afb1234
üst
f61b5c36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
62 deletions
+24
-62
sdrlightingattribute3d.hxx
...yer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx
+5
-1
sdrlightingattribute3d.cxx
drawinglayer/source/attribute/sdrlightingattribute3d.cxx
+19
-61
No files found.
drawinglayer/inc/drawinglayer/attribute/sdrlightingattribute3d.hxx
Dosyayı görüntüle @
4f989f30
...
...
@@ -21,6 +21,7 @@
#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
#include <drawinglayer/drawinglayerdllapi.h>
#include <o3tl/cow_wrapper.hxx>
#include <vector>
...
...
@@ -45,8 +46,11 @@ namespace drawinglayer
{
class
DRAWINGLAYER_DLLPUBLIC
SdrLightingAttribute
{
public
:
typedef
o3tl
::
cow_wrapper
<
ImpSdrLightingAttribute
>
ImplType
;
private
:
Imp
SdrLightingAttribute
*
mpSdrLightingAttribute
;
Imp
lType
mpSdrLightingAttribute
;
public
:
/// constructors/assignmentoperator/destructor
...
...
drawinglayer/source/attribute/sdrlightingattribute3d.cxx
Dosyayı görüntüle @
4f989f30
...
...
@@ -21,6 +21,7 @@
#include <basegfx/color/bcolor.hxx>
#include <basegfx/vector/b3dvector.hxx>
#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
#include <rtl/instance.hxx>
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -31,9 +32,6 @@ namespace drawinglayer
class
ImpSdrLightingAttribute
{
public
:
// refcounter
sal_uInt32
mnRefCount
;
// 3D light attribute definitions
basegfx
::
BColor
maAmbientLight
;
::
std
::
vector
<
Sdr3DLightAttribute
>
maLightVector
;
...
...
@@ -41,12 +39,17 @@ namespace drawinglayer
ImpSdrLightingAttribute
(
const
basegfx
::
BColor
&
rAmbientLight
,
const
::
std
::
vector
<
Sdr3DLightAttribute
>&
rLightVector
)
:
mnRefCount
(
0
),
maAmbientLight
(
rAmbientLight
),
:
maAmbientLight
(
rAmbientLight
),
maLightVector
(
rLightVector
)
{
}
ImpSdrLightingAttribute
()
:
maAmbientLight
(
basegfx
::
BColor
()),
maLightVector
(
std
::
vector
<
Sdr3DLightAttribute
>
())
{
}
// data read access
const
basegfx
::
BColor
&
getAmbientLight
()
const
{
return
maAmbientLight
;
}
const
::
std
::
vector
<
Sdr3DLightAttribute
>&
getLightVector
()
const
{
return
maLightVector
;
}
...
...
@@ -56,95 +59,50 @@ namespace drawinglayer
return
(
getAmbientLight
()
==
rCandidate
.
getAmbientLight
()
&&
getLightVector
()
==
rCandidate
.
getLightVector
());
}
static
ImpSdrLightingAttribute
*
get_global_default
()
{
static
ImpSdrLightingAttribute
*
pDefault
=
0
;
if
(
!
pDefault
)
{
pDefault
=
new
ImpSdrLightingAttribute
(
basegfx
::
BColor
(),
std
::
vector
<
Sdr3DLightAttribute
>
());
// never delete; start with RefCount 1, not 0
pDefault
->
mnRefCount
++
;
}
return
pDefault
;
}
};
namespace
{
struct
theGlobalDefault
:
public
rtl
::
Static
<
SdrLightingAttribute
::
ImplType
,
theGlobalDefault
>
{};
}
SdrLightingAttribute
::
SdrLightingAttribute
(
const
basegfx
::
BColor
&
rAmbientLight
,
const
::
std
::
vector
<
Sdr3DLightAttribute
>&
rLightVector
)
:
mpSdrLightingAttribute
(
new
ImpSdrLightingAttribute
(
:
mpSdrLightingAttribute
(
ImpSdrLightingAttribute
(
rAmbientLight
,
rLightVector
))
{
}
SdrLightingAttribute
::
SdrLightingAttribute
()
:
mpSdrLightingAttribute
(
ImpSdrLightingAttribute
::
get_global_defaul
t
())
:
mpSdrLightingAttribute
(
theGlobalDefault
::
ge
t
())
{
mpSdrLightingAttribute
->
mnRefCount
++
;
}
SdrLightingAttribute
::
SdrLightingAttribute
(
const
SdrLightingAttribute
&
rCandidate
)
:
mpSdrLightingAttribute
(
rCandidate
.
mpSdrLightingAttribute
)
{
mpSdrLightingAttribute
->
mnRefCount
++
;
}
SdrLightingAttribute
::~
SdrLightingAttribute
()
{
if
(
mpSdrLightingAttribute
->
mnRefCount
)
{
mpSdrLightingAttribute
->
mnRefCount
--
;
}
else
{
delete
mpSdrLightingAttribute
;
}
}
bool
SdrLightingAttribute
::
isDefault
()
const
{
return
mpSdrLightingAttribute
==
ImpSdrLightingAttribute
::
get_global_default
(
);
return
mpSdrLightingAttribute
.
same_object
(
theGlobalDefault
::
get
()
);
}
SdrLightingAttribute
&
SdrLightingAttribute
::
operator
=
(
const
SdrLightingAttribute
&
rCandidate
)
{
if
(
rCandidate
.
mpSdrLightingAttribute
!=
mpSdrLightingAttribute
)
{
if
(
mpSdrLightingAttribute
->
mnRefCount
)
{
mpSdrLightingAttribute
->
mnRefCount
--
;
}
else
{
delete
mpSdrLightingAttribute
;
}
mpSdrLightingAttribute
=
rCandidate
.
mpSdrLightingAttribute
;
mpSdrLightingAttribute
->
mnRefCount
++
;
}
mpSdrLightingAttribute
=
rCandidate
.
mpSdrLightingAttribute
;
return
*
this
;
}
bool
SdrLightingAttribute
::
operator
==
(
const
SdrLightingAttribute
&
rCandidate
)
const
{
if
(
rCandidate
.
mpSdrLightingAttribute
==
mpSdrLightingAttribute
)
{
return
true
;
}
if
(
rCandidate
.
isDefault
()
!=
isDefault
())
{
return
false
;
}
return
(
*
rCandidate
.
mpSdrLightingAttribute
==
*
mpSdrLightingAttribute
);
return
rCandidate
.
mpSdrLightingAttribute
==
mpSdrLightingAttribute
;
}
const
::
std
::
vector
<
Sdr3DLightAttribute
>&
SdrLightingAttribute
::
getLightVector
()
const
...
...
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