diff options
-rw-r--r-- | src/XPM.cxx | 16 | ||||
-rw-r--r-- | src/XPM.h | 26 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/XPM.cxx b/src/XPM.cxx index 380ae14c4..364523dd8 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -24,7 +24,7 @@ using namespace Scintilla; namespace { -const char *NextField(const char *s) { +const char *NextField(const char *s) noexcept { // In case there are leading spaces in the string while (*s == ' ') { s++; @@ -39,7 +39,7 @@ const char *NextField(const char *s) { } // Data lines in XPM can be terminated either with NUL or " -size_t MeasureLength(const char *s) { +size_t MeasureLength(const char *s) noexcept { size_t i = 0; while (s[i] && (s[i] != '\"')) i++; @@ -67,7 +67,7 @@ ColourDesired ColourFromHex(const char *val) noexcept { } -ColourDesired XPM::ColourFromCode(int ch) const { +ColourDesired XPM::ColourFromCode(int ch) const noexcept { return colourCodeTable[ch]; } @@ -170,7 +170,7 @@ void XPM::Draw(Surface *surface, const PRectangle &rc) { } } -void XPM::PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const { +void XPM::PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const noexcept { if (pixels.empty() || (x<0) || (x >= width) || (y<0) || (y >= height)) { colour = ColourDesired(0); transparent = true; @@ -247,15 +247,15 @@ RGBAImage::RGBAImage(const XPM &xpm) { RGBAImage::~RGBAImage() { } -int RGBAImage::CountBytes() const { +int RGBAImage::CountBytes() const noexcept { return width * height * 4; } -const unsigned char *RGBAImage::Pixels() const { +const unsigned char *RGBAImage::Pixels() const noexcept { return &pixelBytes[0]; } -void RGBAImage::SetPixel(int x, int y, ColourDesired colour, int alpha) { +void RGBAImage::SetPixel(int x, int y, ColourDesired colour, int alpha) noexcept { unsigned char *pixel = &pixelBytes[0] + (y*width+x) * 4; // RGBA pixel[0] = colour.GetRed(); @@ -287,7 +287,7 @@ RGBAImageSet::~RGBAImageSet() { } /// Remove all images. -void RGBAImageSet::Clear() { +void RGBAImageSet::Clear() noexcept { images.clear(); height = -1; width = -1; @@ -20,7 +20,7 @@ class XPM { std::vector<unsigned char> pixels; ColourDesired colourCodeTable[256]; char codeTransparent=' '; - ColourDesired ColourFromCode(int ch) const; + ColourDesired ColourFromCode(int ch) const noexcept; void FillRun(Surface *surface, int code, int startX, int y, int x) const; public: explicit XPM(const char *textForm); @@ -34,9 +34,9 @@ public: void Init(const char *const *linesForm); /// Decompose image into runs and use FillRectangle for each run void Draw(Surface *surface, const PRectangle &rc); - int GetHeight() const { return height; } - int GetWidth() const { return width; } - void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const; + int GetHeight() const noexcept { return height; } + int GetWidth() const noexcept { return width; } + void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const noexcept; private: static std::vector<const char *>LinesFormFromTextForm(const char *textForm); }; @@ -58,14 +58,14 @@ public: RGBAImage &operator=(const RGBAImage &) = default; RGBAImage &operator=(RGBAImage &&) noexcept = default; virtual ~RGBAImage(); - int GetHeight() const { return height; } - int GetWidth() const { return width; } - float GetScale() const { return scale; } - float GetScaledHeight() const { return height / scale; } - float GetScaledWidth() const { return width / scale; } - int CountBytes() const; - const unsigned char *Pixels() const; - void SetPixel(int x, int y, ColourDesired colour, int alpha); + int GetHeight() const noexcept { return height; } + int GetWidth() const noexcept { return width; } + float GetScale() const noexcept { return scale; } + float GetScaledHeight() const noexcept { return height / scale; } + float GetScaledWidth() const noexcept { return width / scale; } + int CountBytes() const noexcept; + const unsigned char *Pixels() const noexcept; + void SetPixel(int x, int y, ColourDesired colour, int alpha) noexcept; static void BGRAFromRGBA(unsigned char *pixelsBGRA, const unsigned char *pixelsRGBA, size_t count) noexcept; }; @@ -86,7 +86,7 @@ public: RGBAImageSet &operator=(RGBAImageSet &&) = delete; ~RGBAImageSet(); /// Remove all images. - void Clear(); + void Clear() noexcept; /// Add an image. void Add(int ident, RGBAImage *image); /// Get image by id. |