mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-04 09:43:06 +00:00
Add const qualifiers
This commit is contained in:
parent
1389b63050
commit
fb452ce6ba
@ -82,7 +82,7 @@ class Chunky_canvas : public Canvas
|
|||||||
|
|
||||||
if (!str || !font) return;
|
if (!str || !font) return;
|
||||||
|
|
||||||
unsigned char *src = font->img;
|
unsigned char const *src = font->img;
|
||||||
int d, h = font->img_h;
|
int d, h = font->img_h;
|
||||||
|
|
||||||
/* check top clipping */
|
/* check top clipping */
|
||||||
@ -114,7 +114,7 @@ class Chunky_canvas : public Canvas
|
|||||||
int start = max(0, _clip.x1() - x);
|
int start = max(0, _clip.x1() - x);
|
||||||
int end = min(w - 1, _clip.x2() - x);
|
int end = min(w - 1, _clip.x2() - x);
|
||||||
PT *d = dst + x;
|
PT *d = dst + x;
|
||||||
unsigned char *s = src + font->otab[*str];
|
unsigned char const *s = src + font->otab[*str];
|
||||||
|
|
||||||
for (int j = 0; j < h; j++, s += font->img_w, d += _size.w())
|
for (int j = 0; j < h; j++, s += font->img_w, d += _size.w())
|
||||||
for (int i = start; i <= end; i++)
|
for (int i = start; i <= end; i++)
|
||||||
|
@ -24,27 +24,29 @@ class Font
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
unsigned char *img; /* font image */
|
unsigned char const *img; /* font image */
|
||||||
int img_w, img_h; /* size of font image */
|
int const img_w, img_h; /* size of font image */
|
||||||
int32_t *wtab; /* width table */
|
int32_t const *otab; /* offset table */
|
||||||
int32_t *otab; /* offset table */
|
int32_t const *wtab; /* width table */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct font from a TFF data block
|
* Construct font from a TFF data block
|
||||||
*/
|
*/
|
||||||
Font(const char *tff)
|
Font(const char *tff)
|
||||||
{
|
:
|
||||||
otab = (int32_t *)(tff);
|
img((unsigned char *)(tff + 2056)),
|
||||||
wtab = (int32_t *)(tff + 1024);
|
|
||||||
img_w = *((int32_t *)(tff + 2048));
|
img_w(*((int32_t *)(tff + 2048))),
|
||||||
img_h = *((int32_t *)(tff + 2052));
|
img_h(*((int32_t *)(tff + 2052))),
|
||||||
img = (unsigned char *)(tff + 2056);
|
|
||||||
}
|
otab((int32_t *)(tff)),
|
||||||
|
wtab((int32_t *)(tff + 1024))
|
||||||
|
{ }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate width of string when printed with the font
|
* Calculate width of string when printed with the font
|
||||||
*/
|
*/
|
||||||
int str_w(const char *sstr)
|
int str_w(const char *sstr) const
|
||||||
{
|
{
|
||||||
const unsigned char *str = (const unsigned char *)sstr;
|
const unsigned char *str = (const unsigned char *)sstr;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@ -55,7 +57,7 @@ class Font
|
|||||||
/**
|
/**
|
||||||
* Calculate height of string when printed with the font
|
* Calculate height of string when printed with the font
|
||||||
*/
|
*/
|
||||||
int str_h(const char *str) { return img_h; }
|
int str_h(const char *str) const { return img_h; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__NITPICKER_GFX__FONT_H_ */
|
#endif /* _INCLUDE__NITPICKER_GFX__FONT_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user