mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +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;
|
||||
|
||||
unsigned char *src = font->img;
|
||||
unsigned char const *src = font->img;
|
||||
int d, h = font->img_h;
|
||||
|
||||
/* check top clipping */
|
||||
@ -110,11 +110,11 @@ class Chunky_canvas : public Canvas
|
||||
/* draw glyphs */
|
||||
for ( ; *str && (x <= _clip.x2()); str++) {
|
||||
|
||||
int w = font->wtab[*str];
|
||||
int start = max(0, _clip.x1() - x);
|
||||
int end = min(w - 1, _clip.x2() - x);
|
||||
PT *d = dst + x;
|
||||
unsigned char *s = src + font->otab[*str];
|
||||
int w = font->wtab[*str];
|
||||
int start = max(0, _clip.x1() - x);
|
||||
int end = min(w - 1, _clip.x2() - x);
|
||||
PT *d = dst + x;
|
||||
unsigned char const *s = src + font->otab[*str];
|
||||
|
||||
for (int j = 0; j < h; j++, s += font->img_w, d += _size.w())
|
||||
for (int i = start; i <= end; i++)
|
||||
|
@ -24,27 +24,29 @@ class Font
|
||||
|
||||
public:
|
||||
|
||||
unsigned char *img; /* font image */
|
||||
int img_w, img_h; /* size of font image */
|
||||
int32_t *wtab; /* width table */
|
||||
int32_t *otab; /* offset table */
|
||||
unsigned char const *img; /* font image */
|
||||
int const img_w, img_h; /* size of font image */
|
||||
int32_t const *otab; /* offset table */
|
||||
int32_t const *wtab; /* width table */
|
||||
|
||||
/**
|
||||
* Construct font from a TFF data block
|
||||
*/
|
||||
Font(const char *tff)
|
||||
{
|
||||
otab = (int32_t *)(tff);
|
||||
wtab = (int32_t *)(tff + 1024);
|
||||
img_w = *((int32_t *)(tff + 2048));
|
||||
img_h = *((int32_t *)(tff + 2052));
|
||||
img = (unsigned char *)(tff + 2056);
|
||||
}
|
||||
:
|
||||
img((unsigned char *)(tff + 2056)),
|
||||
|
||||
img_w(*((int32_t *)(tff + 2048))),
|
||||
img_h(*((int32_t *)(tff + 2052))),
|
||||
|
||||
otab((int32_t *)(tff)),
|
||||
wtab((int32_t *)(tff + 1024))
|
||||
{ }
|
||||
|
||||
/**
|
||||
* 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;
|
||||
int res = 0;
|
||||
@ -55,7 +57,7 @@ class 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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user