aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LineMarker.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-04-07 12:20:58 +1000
committerNeil <nyamatongwe@gmail.com>2019-04-07 12:20:58 +1000
commitbdfbc5325157c037fdaa70d6c7fe757046f08906 (patch)
treeb9d1155dc9e7b42b89ee978f6071ad526deea9a7 /src/LineMarker.cxx
parentd126e56e2c800188a2546c241299453c2e4304a8 (diff)
downloadscintilla-mirror-bdfbc5325157c037fdaa70d6c7fe757046f08906.tar.gz
Backport: Make XPM, RGBAImage, and LineMarker copyable and noexcept moveable.
This simplifies and optimizes their use in other classes and containers. Backport of changeset 7408:adc040eac41d.
Diffstat (limited to 'src/LineMarker.cxx')
-rw-r--r--src/LineMarker.cxx58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index ea5e5e780..d2c906d08 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -25,41 +25,41 @@
using namespace Scintilla;
-LineMarker::~LineMarker() {
-}
-
-LineMarker::LineMarker() {
- markType = SC_MARK_CIRCLE;
- fore = ColourDesired(0, 0, 0);
- back = ColourDesired(0xff, 0xff, 0xff);
- backSelected = ColourDesired(0xff, 0x00, 0x00);
- alpha = SC_ALPHA_NOALPHA;
- customDraw = nullptr;
-}
-
-LineMarker::LineMarker(const LineMarker &) {
+LineMarker::LineMarker(const LineMarker &other) {
// Defined to avoid pxpm and image being blindly copied, not as a complete copy constructor.
- markType = SC_MARK_CIRCLE;
- fore = ColourDesired(0, 0, 0);
- back = ColourDesired(0xff, 0xff, 0xff);
- backSelected = ColourDesired(0xff, 0x00, 0x00);
- alpha = SC_ALPHA_NOALPHA;
- pxpm.reset();
- image.reset();
- customDraw = nullptr;
+ markType = other.markType;
+ fore = other.fore;
+ back = other.back;
+ backSelected = other.backSelected;
+ alpha = other.alpha;
+ if (other.pxpm)
+ pxpm.reset(new XPM(*other.pxpm));
+ else
+ pxpm = nullptr;
+ if (other.image)
+ image.reset(new RGBAImage(*other.image));
+ else
+ image = nullptr;
+ customDraw = other.customDraw;
}
LineMarker &LineMarker::operator=(const LineMarker &other) {
// Defined to avoid pxpm and image being blindly copied, not as a complete assignment operator.
if (this != &other) {
- markType = SC_MARK_CIRCLE;
- fore = ColourDesired(0, 0, 0);
- back = ColourDesired(0xff, 0xff, 0xff);
- backSelected = ColourDesired(0xff, 0x00, 0x00);
- alpha = SC_ALPHA_NOALPHA;
- pxpm.reset();
- image.reset();
- customDraw = nullptr;
+ markType = other.markType;
+ fore = other.fore;
+ back = other.back;
+ backSelected = other.backSelected;
+ alpha = other.alpha;
+ if (other.pxpm)
+ pxpm.reset(new XPM(*other.pxpm));
+ else
+ pxpm = nullptr;
+ if (other.image)
+ image.reset(new RGBAImage(*other.image));
+ else
+ image = nullptr;
+ customDraw = other.customDraw;
}
return *this;
}