[Libreoffice-commits] core.git: include/vcl vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 5 10:44:57 UTC 2020
include/vcl/gradient.hxx | 50 ++++----------
vcl/source/gdi/gradient.cxx | 148 +++++++++++++++++++++++++++++++-------------
2 files changed, 121 insertions(+), 77 deletions(-)
New commits:
commit e0b7d6d9b7c7f3a0e7c5bdc4aad84b45c10e62af
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Mar 5 10:21:58 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Mar 5 11:44:17 2020 +0100
vcl: put Impl class for Gradient into the cxx file
Change-Id: Ib39ba659a09b680b3d15a59c51944eb213e63110
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90008
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx
index 92facb33dd19..aee89e06b50e 100644
--- a/include/vcl/gradient.hxx
+++ b/include/vcl/gradient.hxx
@@ -28,38 +28,16 @@
#include <o3tl/cow_wrapper.hxx>
-namespace tools
-{
-class Rectangle;
-}
+namespace tools { class Rectangle; }
+
class Point;
class SvStream;
-class Impl_Gradient
-{
-public:
- GradientStyle meStyle;
- Color maStartColor;
- Color maEndColor;
- sal_uInt16 mnAngle;
- sal_uInt16 mnBorder;
- sal_uInt16 mnOfsX;
- sal_uInt16 mnOfsY;
- sal_uInt16 mnIntensityStart;
- sal_uInt16 mnIntensityEnd;
- sal_uInt16 mnStepCount;
-
- Impl_Gradient();
- Impl_Gradient( const Impl_Gradient& rImplGradient );
-
- bool operator==( const Impl_Gradient& rImpl_Gradient ) const;
-};
-
-
class VCL_DLLPUBLIC Gradient
{
private:
- ::o3tl::cow_wrapper< Impl_Gradient > mpImplGradient;
+ class Impl;
+ ::o3tl::cow_wrapper<Impl> mpImplGradient;
public:
Gradient();
@@ -71,30 +49,30 @@ public:
~Gradient();
void SetStyle( GradientStyle eStyle );
- GradientStyle GetStyle() const { return mpImplGradient->meStyle; }
+ GradientStyle GetStyle() const;
void SetStartColor( const Color& rColor );
- const Color& GetStartColor() const { return mpImplGradient->maStartColor; }
+ const Color& GetStartColor() const;
void SetEndColor( const Color& rColor );
- const Color& GetEndColor() const { return mpImplGradient->maEndColor; }
+ const Color& GetEndColor() const;
void SetAngle( sal_uInt16 nAngle );
- sal_uInt16 GetAngle() const { return mpImplGradient->mnAngle; }
+ sal_uInt16 GetAngle() const;
void SetBorder( sal_uInt16 nBorder );
- sal_uInt16 GetBorder() const { return mpImplGradient->mnBorder; }
+ sal_uInt16 GetBorder() const;
void SetOfsX( sal_uInt16 nOfsX );
- sal_uInt16 GetOfsX() const { return mpImplGradient->mnOfsX; }
+ sal_uInt16 GetOfsX() const;
void SetOfsY( sal_uInt16 nOfsY );
- sal_uInt16 GetOfsY() const { return mpImplGradient->mnOfsY; }
+ sal_uInt16 GetOfsY() const;
void SetStartIntensity( sal_uInt16 nIntens );
- sal_uInt16 GetStartIntensity() const { return mpImplGradient->mnIntensityStart; }
+ sal_uInt16 GetStartIntensity() const;
void SetEndIntensity( sal_uInt16 nIntens );
- sal_uInt16 GetEndIntensity() const { return mpImplGradient->mnIntensityEnd; }
+ sal_uInt16 GetEndIntensity() const;
void SetSteps( sal_uInt16 nSteps );
- sal_uInt16 GetSteps() const { return mpImplGradient->mnStepCount; }
+ sal_uInt16 GetSteps() const;
void GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle &rBoundRect, Point& rCenter ) const;
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
index 12bfc93c0d76..2973f2d82719 100644
--- a/vcl/source/gdi/gradient.cxx
+++ b/vcl/source/gdi/gradient.cxx
@@ -20,47 +20,62 @@
#include <tools/gen.hxx>
#include <vcl/gradient.hxx>
-Impl_Gradient::Impl_Gradient() :
- maStartColor( COL_BLACK ),
- maEndColor( COL_WHITE )
-{
- meStyle = GradientStyle::Linear;
- mnAngle = 0;
- mnBorder = 0;
- mnOfsX = 50;
- mnOfsY = 50;
- mnIntensityStart = 100;
- mnIntensityEnd = 100;
- mnStepCount = 0;
-}
-
-Impl_Gradient::Impl_Gradient( const Impl_Gradient& rImplGradient ) :
- maStartColor( rImplGradient.maStartColor ),
- maEndColor( rImplGradient.maEndColor )
-{
- meStyle = rImplGradient.meStyle;
- mnAngle = rImplGradient.mnAngle;
- mnBorder = rImplGradient.mnBorder;
- mnOfsX = rImplGradient.mnOfsX;
- mnOfsY = rImplGradient.mnOfsY;
- mnIntensityStart = rImplGradient.mnIntensityStart;
- mnIntensityEnd = rImplGradient.mnIntensityEnd;
- mnStepCount = rImplGradient.mnStepCount;
-}
-
-bool Impl_Gradient::operator==( const Impl_Gradient& rImpl_Gradient ) const
-{
- return (meStyle == rImpl_Gradient.meStyle) &&
- (mnAngle == rImpl_Gradient.mnAngle) &&
- (mnBorder == rImpl_Gradient.mnBorder) &&
- (mnOfsX == rImpl_Gradient.mnOfsX) &&
- (mnOfsY == rImpl_Gradient.mnOfsY) &&
- (mnStepCount == rImpl_Gradient.mnStepCount) &&
- (mnIntensityStart == rImpl_Gradient.mnIntensityStart) &&
- (mnIntensityEnd == rImpl_Gradient.mnIntensityEnd) &&
- (maStartColor == rImpl_Gradient.maStartColor) &&
- (maEndColor == rImpl_Gradient.maEndColor);
-}
+class Gradient::Impl
+{
+public:
+ GradientStyle meStyle;
+ Color maStartColor;
+ Color maEndColor;
+ sal_uInt16 mnAngle;
+ sal_uInt16 mnBorder;
+ sal_uInt16 mnOfsX;
+ sal_uInt16 mnOfsY;
+ sal_uInt16 mnIntensityStart;
+ sal_uInt16 mnIntensityEnd;
+ sal_uInt16 mnStepCount;
+
+ Impl()
+ : meStyle (GradientStyle::Linear)
+ , maStartColor(COL_BLACK)
+ , maEndColor(COL_WHITE)
+ , mnAngle(0)
+ , mnBorder(0)
+ , mnOfsX(50)
+ , mnOfsY(50)
+ , mnIntensityStart(100)
+ , mnIntensityEnd(100)
+ , mnStepCount(0)
+ {
+ }
+
+ Impl(const Impl& rImplGradient)
+ : meStyle (rImplGradient.meStyle)
+ , maStartColor(rImplGradient.maStartColor)
+ , maEndColor(rImplGradient.maEndColor)
+ , mnAngle(rImplGradient.mnAngle)
+ , mnBorder(rImplGradient.mnBorder)
+ , mnOfsX(rImplGradient.mnOfsX)
+ , mnOfsY(rImplGradient.mnOfsY)
+ , mnIntensityStart(rImplGradient.mnIntensityStart)
+ , mnIntensityEnd(rImplGradient.mnIntensityEnd)
+ , mnStepCount(rImplGradient.mnStepCount)
+ {
+ }
+
+ bool operator==(const Impl& rImpl_Gradient) const
+ {
+ return (meStyle == rImpl_Gradient.meStyle)
+ && (mnAngle == rImpl_Gradient.mnAngle)
+ && (mnBorder == rImpl_Gradient.mnBorder)
+ && (mnOfsX == rImpl_Gradient.mnOfsX)
+ && (mnOfsY == rImpl_Gradient.mnOfsY)
+ && (mnStepCount == rImpl_Gradient.mnStepCount)
+ && (mnIntensityStart == rImpl_Gradient.mnIntensityStart)
+ && (mnIntensityEnd == rImpl_Gradient.mnIntensityEnd)
+ && (maStartColor == rImpl_Gradient.maStartColor)
+ && (maEndColor == rImpl_Gradient.maEndColor);
+ }
+};
Gradient::Gradient() = default;
@@ -79,51 +94,102 @@ Gradient::Gradient( GradientStyle eStyle,
Gradient::~Gradient() = default;
+
+GradientStyle Gradient::GetStyle() const
+{
+ return mpImplGradient->meStyle;
+}
+
void Gradient::SetStyle( GradientStyle eStyle )
{
mpImplGradient->meStyle = eStyle;
}
+const Color& Gradient::GetStartColor() const
+{
+ return mpImplGradient->maStartColor;
+}
+
void Gradient::SetStartColor( const Color& rColor )
{
mpImplGradient->maStartColor = rColor;
}
+const Color& Gradient::GetEndColor() const
+{
+ return mpImplGradient->maEndColor;
+}
+
void Gradient::SetEndColor( const Color& rColor )
{
mpImplGradient->maEndColor = rColor;
}
+sal_uInt16 Gradient::GetAngle() const
+{
+ return mpImplGradient->mnAngle;
+}
+
void Gradient::SetAngle( sal_uInt16 nAngle )
{
mpImplGradient->mnAngle = nAngle;
}
+sal_uInt16 Gradient::GetBorder() const
+{
+ return mpImplGradient->mnBorder;
+}
+
void Gradient::SetBorder( sal_uInt16 nBorder )
{
mpImplGradient->mnBorder = nBorder;
}
+sal_uInt16 Gradient::GetOfsX() const
+{
+ return mpImplGradient->mnOfsX;
+}
+
void Gradient::SetOfsX( sal_uInt16 nOfsX )
{
mpImplGradient->mnOfsX = nOfsX;
}
+sal_uInt16 Gradient::GetOfsY() const
+{
+ return mpImplGradient->mnOfsY;
+}
+
void Gradient::SetOfsY( sal_uInt16 nOfsY )
{
mpImplGradient->mnOfsY = nOfsY;
}
+sal_uInt16 Gradient::GetStartIntensity() const
+{
+ return mpImplGradient->mnIntensityStart;
+}
+
void Gradient::SetStartIntensity( sal_uInt16 nIntens )
{
mpImplGradient->mnIntensityStart = nIntens;
}
+sal_uInt16 Gradient::GetEndIntensity() const
+{
+ return mpImplGradient->mnIntensityEnd;
+}
+
void Gradient::SetEndIntensity( sal_uInt16 nIntens )
{
mpImplGradient->mnIntensityEnd = nIntens;
}
+sal_uInt16 Gradient::GetSteps() const
+{
+ return mpImplGradient->mnStepCount;
+}
+
void Gradient::SetSteps( sal_uInt16 nSteps )
{
mpImplGradient->mnStepCount = nSteps;
More information about the Libreoffice-commits
mailing list