summaryrefslogtreecommitdiff
path: root/splash
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-09-27 18:03:30 +0200
committerAlbert Astals Cid <aacid@kde.org>2019-09-27 22:08:28 +0200
commit120cfc0de67501988edc9ded58d2a534d0b5a70e (patch)
treebf7c7428279f9ba525bae21db535de260ab34bc0 /splash
parentcec2397fc0542516cac16615f63ab89032806a2e (diff)
Add some const
Suggested by clang-tidy readability-non-const-parameter check
Diffstat (limited to 'splash')
-rw-r--r--splash/Splash.cc4
-rw-r--r--splash/Splash.h4
-rw-r--r--splash/SplashFont.cc2
-rw-r--r--splash/SplashFont.h4
-rw-r--r--splash/SplashTypes.h5
5 files changed, 10 insertions, 9 deletions
diff --git a/splash/Splash.cc b/splash/Splash.cc
index c3e54b84..6e30fd80 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -1553,7 +1553,7 @@ inline void Splash::drawAALine(SplashPipe *pipe, int x0, int x1, int y, bool adj
//------------------------------------------------------------------------
// Transform a point from user space to device space.
-inline void Splash::transform(SplashCoord *matrix,
+inline void Splash::transform(const SplashCoord *matrix,
SplashCoord xi, SplashCoord yi,
SplashCoord *xo, SplashCoord *yo) {
// [ m[0] m[1] 0 ]
@@ -5291,7 +5291,7 @@ SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc,
return splashOk;
}
-void Splash::compositeBackground(SplashColorPtr color) {
+void Splash::compositeBackground(SplashColorConstPtr color) {
SplashColorPtr p;
unsigned char *q;
unsigned char alpha, alpha1, c, color0, color1, color2;
diff --git a/splash/Splash.h b/splash/Splash.h
index f18d7ae9..251a1001 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -222,7 +222,7 @@ public:
// Composite this Splash object onto a background color. The
// background alpha is assumed to be 1.
- void compositeBackground(SplashColorPtr color);
+ void compositeBackground(SplashColorConstPtr color);
// Copy a rectangular region from <src> onto the bitmap belonging to
// this Splash object. The destination alpha values are all set to
@@ -306,7 +306,7 @@ private:
void drawAAPixel(SplashPipe *pipe, int x, int y);
void drawSpan(SplashPipe *pipe, int x0, int x1, int y, bool noClip);
void drawAALine(SplashPipe *pipe, int x0, int x1, int y, bool adjustLine = false, unsigned char lineOpacity = 0);
- void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
+ void transform(const SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
SplashCoord *xo, SplashCoord *yo);
void updateModX(int x);
void updateModY(int y);
diff --git a/splash/SplashFont.cc b/splash/SplashFont.cc
index db168bf5..da81b523 100644
--- a/splash/SplashFont.cc
+++ b/splash/SplashFont.cc
@@ -42,7 +42,7 @@ struct SplashFontCacheTag {
// SplashFont
//------------------------------------------------------------------------
-SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA,
+SplashFont::SplashFont(SplashFontFile *fontFileA, const SplashCoord *matA,
const SplashCoord *textMatA, bool aaA) {
fontFile = fontFileA;
fontFile->incRefCnt();
diff --git a/splash/SplashFont.h b/splash/SplashFont.h
index 45875c9f..8677f017 100644
--- a/splash/SplashFont.h
+++ b/splash/SplashFont.h
@@ -46,7 +46,7 @@ class SplashPath;
class SplashFont {
public:
- SplashFont(SplashFontFile *fontFileA, SplashCoord *matA,
+ SplashFont(SplashFontFile *fontFileA, const SplashCoord *matA,
const SplashCoord *textMatA, bool aaA);
// This must be called after the constructor, so that the subclass
@@ -61,7 +61,7 @@ public:
SplashFontFile *getFontFile() { return fontFile; }
// Return true if <this> matches the specified font file and matrix.
- bool matches(SplashFontFile *fontFileA, SplashCoord *matA,
+ bool matches(SplashFontFile *fontFileA, const SplashCoord *matA,
const SplashCoord *textMatA) const {
return fontFileA == fontFile &&
matA[0] == mat[0] && matA[1] == mat[1] &&
diff --git a/splash/SplashTypes.h b/splash/SplashTypes.h
index b00693fe..0e41ade8 100644
--- a/splash/SplashTypes.h
+++ b/splash/SplashTypes.h
@@ -85,6 +85,7 @@ constexpr std::size_t splashMaxColorComps = SPOT_NCOMPS+4;
typedef unsigned char SplashColor[splashMaxColorComps];
typedef unsigned char *SplashColorPtr;
+typedef const unsigned char *SplashColorConstPtr;
// RGB8
static inline unsigned char splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
@@ -118,7 +119,7 @@ static inline void splashClearColor(SplashColorPtr dest) {
dest[i] = 0;
}
-static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
+static inline void splashColorCopy(SplashColorPtr dest, SplashColorConstPtr src) {
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
@@ -127,7 +128,7 @@ static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
dest[i] = src[i];
}
-static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
+static inline void splashColorXor(SplashColorPtr dest, SplashColorConstPtr src) {
dest[0] ^= src[0];
dest[1] ^= src[1];
dest[2] ^= src[2];