const correctness (#334)

This commit is contained in:
Michael Miller
2020-01-21 00:10:39 -08:00
committed by GitHub
parent cb72866555
commit 18b9982fc3
6 changed files with 75 additions and 44 deletions

View File

@ -389,6 +389,12 @@ protected:
return T_COLOR_FEATURE::pixels(_method.getData());
}
const uint8_t* _pixels() const
{
// get pixels data within the data stream
return T_COLOR_FEATURE::pixels(_method.getData());
}
void _rotateLeft(uint16_t rotationCount, uint16_t first, uint16_t last)
{
// store in temp

View File

@ -175,6 +175,11 @@ public:
{
return pData;
}
static const uint8_t* pixels(const uint8_t* pData)
{
return pData;
}
};
class DotStar4ElementsNoSettings : public DotStar4Elements
@ -191,6 +196,11 @@ public:
{
return pData;
}
static const uint8_t* pixels(const uint8_t* pData)
{
return pData;
}
};
class DotStarBgrFeature : public DotStar3ElementsNoSettings
@ -206,10 +216,10 @@ public:
*p = color.R;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
p++; // ignore the first byte
color.B = *p++;
@ -247,10 +257,10 @@ public:
*p = color.R;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = (*p++) & 0x1F; // mask out upper three bits
color.B = *p++;
@ -288,10 +298,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
p++; // ignore the first byte
color.G = *p++;
@ -329,10 +339,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = (*p++) & 0x1F; // mask out upper three bits
color.G = *p++;
@ -371,10 +381,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
p++; // ignore the first byte
color.R = *p++;
@ -412,10 +422,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = (*p++) & 0x1F; // mask out upper three bits
color.R = *p++;
@ -453,10 +463,10 @@ public:
*p = color.G;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
p++; // ignore the first byte
color.R = *p++;
@ -494,10 +504,10 @@ public:
*p = color.G;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = (*p++) & 0x1F; // mask out upper three bits
color.R = *p++;
@ -536,10 +546,10 @@ public:
*p = color.R;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
p++; // ignore the first byte
color.G = *p++;
@ -577,10 +587,10 @@ public:
*p = color.R;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = (*p++) & 0x1F; // mask out upper three bits
color.G = *p++;
@ -618,10 +628,10 @@ public:
*p = color.G;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
p++; // ignore the first byte
color.B = *p++;
@ -659,10 +669,10 @@ public:
*p = color.G;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = (*p++) & 0x1F; // mask out upper three bits
color.B = *p++;

View File

@ -101,10 +101,10 @@ public:
*p = (color.G >> 1) | 0x80;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.B = (*p++) << 1;
color.R = (*p++) << 1;
@ -139,10 +139,10 @@ public:
*p = (color.B >> 1) | 0x80;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.G = (*p++) << 1;
color.R = (*p++) << 1;

View File

@ -162,6 +162,11 @@ public:
{
return pData;
}
static const uint8_t* pixels(const uint8_t* pData)
{
return pData;
}
};
class Neo4ElementsNoSettings : public Neo4Elements
@ -178,6 +183,11 @@ public:
{
return pData;
}
static const uint8_t* pixels(const uint8_t* pData)
{
return pData;
}
};
class NeoGrbFeature : public Neo3ElementsNoSettings
@ -192,10 +202,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.G = *p++;
color.R = *p++;
@ -231,10 +241,10 @@ public:
*p = color.W;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.G = *p++;
color.R = *p++;
@ -273,10 +283,10 @@ public:
*p = color.W;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.R = *p++;
color.G = *p++;
@ -313,10 +323,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.R = *p++;
color.G = *p++;
@ -351,10 +361,10 @@ public:
*p = color.G;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.B = *p++;
color.R = *p++;
@ -389,10 +399,10 @@ public:
*p = color.G;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.R = *p++;
color.B = *p++;

View File

@ -98,10 +98,10 @@ public:
}
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
uint8_t commonSize = (PixelSize < color.SegmentCount) ? PixelSize : color.SegmentCount;
for (uint8_t iSegment = 0; iSegment < commonSize; iSegment++)

View File

@ -80,6 +80,11 @@ public:
{
return pData + SettingsSize;
}
static const uint8_t* pixels(const uint8_t* pData)
{
return pData;
}
};
@ -96,10 +101,10 @@ public:
*p = color.B;
}
static ColorObject retrievePixelColor(uint8_t* pPixels, uint16_t indexPixel)
static ColorObject retrievePixelColor(const uint8_t* pPixels, uint16_t indexPixel)
{
ColorObject color;
uint8_t* p = getPixelAddress(pPixels, indexPixel);
const uint8_t* p = getPixelAddress(pPixels, indexPixel);
color.W = *p++;
color.R = *p++;