changeset 1950:a3983da9b8b9

Constify.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 30 Jun 2018 00:45:42 +0300
parents f8e2728c1b7f
children ebcb7713bb6a
files src/dmtext.h src/dmtext_bm.c
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/dmtext.h	Fri Jun 29 22:16:51 2018 +0300
+++ b/src/dmtext.h	Sat Jun 30 00:45:42 2018 +0300
@@ -47,10 +47,10 @@
 } DMBitmapFont;
 
 
-DMBitmapFont *dmNewBitmapFont(int nglyphs, int width, int height);
+DMBitmapFont *dmNewBitmapFont(const int nglyphs, const int width, const int height);
 int dmFreeBitmapFont(DMBitmapFont *font);
 int dmLoadBitmapFont(DMResource *res, DMBitmapFont **pfont);
-int dmSetBitmapFontPalette(DMBitmapFont *font, SDL_Color *pal, int start, int size);
+int dmSetBitmapFontPalette(DMBitmapFont *font, const SDL_Color *pal, const int start, const int size);
 
 
 void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, BOOL condensed, int mode, int xc, int yc, const char *str);
@@ -71,9 +71,9 @@
 /* TTF text drawing
  */
 #ifdef DM_GFX_TTF_TEXT
-void dmDrawTTFTextConst(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt);
-void dmDrawTTFTextVA(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt, va_list ap);
-void dmDrawTTFText(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int x, int y, const char *fmt, ...);
+void dmDrawTTFTextConst(SDL_Surface *screen, TTF_Font *font, SDL_Color col, const int xc, const int yc, const char *fmt);
+void dmDrawTTFTextVA(SDL_Surface *screen, TTF_Font *font, SDL_Color col, const int xc, const int yc, const char *fmt, va_list ap);
+void dmDrawTTFText(SDL_Surface *screen, TTF_Font *font, SDL_Color col, const int xc, const int yc, const char *fmt, ...);
 #endif
 
 
--- a/src/dmtext_bm.c	Fri Jun 29 22:16:51 2018 +0300
+++ b/src/dmtext_bm.c	Sat Jun 30 00:45:42 2018 +0300
@@ -53,7 +53,7 @@
 }
 
 
-DMBitmapFont *dmNewBitmapFont(int nglyphs, int width, int height)
+DMBitmapFont *dmNewBitmapFont(const int nglyphs, const int width, const int height)
 {
     DMBitmapFont *font = dmMalloc0(sizeof(DMBitmapFont));
     if (font == NULL)
@@ -98,7 +98,7 @@
  * specify 'start' and 'end' indices and palette array freely, you should
  * typically use DMFONT_NPALETTE size palette starting at index 0.
  */
-int dmSetBitmapFontPalette(DMBitmapFont *font, SDL_Color *pal, int start, int size)
+int dmSetBitmapFontPalette(DMBitmapFont *font, const SDL_Color *pal, const int start, const int size)
 {
     int i;
 
@@ -120,6 +120,7 @@
     return DMERR_OK;
 }
 
+
 //#define FN_DEBUG
 
 int dmLoadBitmapFont(DMResource *res, DMBitmapFont **pfont)