mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Mark more data arrays as constexpr instead of just const.
This commit is contained in:
parent
db1b394336
commit
5c5ca3ad9e
@ -31,7 +31,7 @@ namespace rendering
|
||||
// Arrays for Liberation Sans 2.0,
|
||||
// available under the OFL (SIL Open Font License)
|
||||
|
||||
static const int Liberation2Sans_charmetrics[][8] = {
|
||||
static constexpr int Liberation2Sans_charmetrics[][8] = {
|
||||
{ 32, -16, 14, 1, 84, 32, 28, 31 }, { 33, -7, 91, 34, 7, 44, 105, 29 },
|
||||
{ 34, -12, 91, 79, 7, 64, 52, 40 }, { 35, -16, 91, 144, 7, 94, 105, 62 },
|
||||
{ 36, -15, 97, 239, 1, 92, 119, 62 }, { 37, -12, 92, 332, 6, 124, 107, 100 },
|
||||
@ -82,7 +82,7 @@ static const int Liberation2Sans_charmetrics[][8] = {
|
||||
{ 126, -11, 58, 923, 913, 87, 42, 65 },
|
||||
};
|
||||
|
||||
static const char* Liberation2Sans_charids[] = {
|
||||
static const std::string Liberation2Sans_charids[] = {
|
||||
" ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2",
|
||||
"3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E",
|
||||
"F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
|
||||
@ -90,7 +90,7 @@ static const char* Liberation2Sans_charids[] = {
|
||||
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~"
|
||||
};
|
||||
|
||||
static const unsigned char Liberation2Sans_rawimage[] = {
|
||||
static constexpr unsigned char Liberation2Sans_rawimage[] = {
|
||||
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
|
||||
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x06, 0x00, 0x00, 0x00, 0x7f, 0x1d, 0x2b,
|
||||
0x83, 0x00, 0x00, 0x00, 0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64,
|
||||
@ -5992,11 +5992,14 @@ vtkm::rendering::BitmapFont BitmapFontFactory::CreateLiberation2Sans()
|
||||
font.RawImageFileData.insert(font.RawImageFileData.begin(),
|
||||
Liberation2Sans_rawimage,
|
||||
Liberation2Sans_rawimage + Liberation2Sans_imagelength);
|
||||
for (int i = 0; i < 95; i++)
|
||||
|
||||
int i = 0;
|
||||
font.Chars.resize(95);
|
||||
for (auto&& character : font.Chars)
|
||||
{
|
||||
font.Chars.push_back(
|
||||
BitmapFont::Character(Liberation2Sans_charids[i], Liberation2Sans_charmetrics[i]));
|
||||
character = BitmapFont::Character(Liberation2Sans_charids[i], Liberation2Sans_charmetrics[i]);
|
||||
font.ShortMap[Liberation2Sans_charmetrics[i][0]] = i;
|
||||
++i;
|
||||
}
|
||||
|
||||
// Character
|
||||
|
@ -100,19 +100,19 @@ int DecodePNG(std::vector<unsigned char>& out_image,
|
||||
// is available: LodePNG (lodepng.c(pp)), which is a single source and header file.
|
||||
// Apologies for the compact code style, it's to make this tiny.
|
||||
|
||||
static const unsigned long LENBASE[29] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
|
||||
15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258 };
|
||||
static const unsigned long LENEXTRA[29] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
|
||||
2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 };
|
||||
static const unsigned long DISTBASE[30] = { 1, 2, 3, 4, 5, 7, 9, 13,
|
||||
17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||
4097, 6145, 8193, 12289, 16385, 24577 };
|
||||
static const unsigned long DISTEXTRA[30] = {
|
||||
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
|
||||
};
|
||||
static const unsigned long CLCL[19] = {
|
||||
static constexpr unsigned long LENBASE[29] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
|
||||
15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
|
||||
67, 83, 99, 115, 131, 163, 195, 227, 258 };
|
||||
static constexpr unsigned long LENEXTRA[29] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
|
||||
2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 };
|
||||
static constexpr unsigned long DISTBASE[30] = { 1, 2, 3, 4, 5, 7, 9, 13,
|
||||
17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||
4097, 6145, 8193, 12289, 16385, 24577 };
|
||||
static constexpr unsigned long DISTEXTRA[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
|
||||
4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
|
||||
9, 9, 10, 10, 11, 11, 12, 12, 13, 13 };
|
||||
static constexpr unsigned long CLCL[19] = {
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
}; //code length code lengths
|
||||
struct Zlib //nested functions for zlib decompression
|
||||
@ -654,7 +654,8 @@ int DecodePNG(std::vector<unsigned char>& out_image,
|
||||
: 0; //use a regular pointer to the std::vector for faster code if compiled without optimization
|
||||
if (info.interlaceMethod == 0) //no interlace, just filter
|
||||
{
|
||||
std::size_t linestart = 0, linelength = (info.width * bpp + 7) /
|
||||
std::size_t linestart = 0,
|
||||
linelength = (info.width * bpp + 7) /
|
||||
8; //length in bytes of a scanline, excluding the filtertype byte
|
||||
if (bpp >= 8) //byte per byte
|
||||
for (unsigned long y = 0; y < info.height; y++)
|
||||
|
Loading…
Reference in New Issue
Block a user