From e978895c427877e7acbeb4df0cf8093922fb0c97 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 21 May 2020 18:07:59 +0100 Subject: [PATCH] Move interpol tables inside Surface class --- surface.cc | 54 ++++++++++++++++++++++-------------------------------- surface.h | 12 ++++++++++++ 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/surface.cc b/surface.cc index 3322a87..9c17aa8 100644 --- a/surface.cc +++ b/surface.cc @@ -29,17 +29,28 @@ #include "teletxt/txtfont.h" #include "staticartwork.h" -unsigned int interpol_table_fac1[16][22]; -unsigned int interpol_table_fac2[16][22]; -unsigned int interpol_table_fac3[16][22]; -unsigned int interpol_table_fac4[16][22]; -int interpol_lowbit[16]; -int interpol_upbit[16]; -int interpol_lowline[22]; -int interpol_upline[22]; -bool pol_table_inited=false; - -void initpol_tables(){ +Surface* Surface::screen = NULL; + +#ifndef GRADIENT_DRAWING +osd_font_t* Surface::font = &font_helvB18; +#endif + +Surface::Surface(int id) +{ + if (id == SCREEN) screen = this; +} + +Surface::~Surface() +{ +} + +Surface* Surface::getScreen() +{ + return screen; +} + +void Surface::initpol_tables() +{ int charsizex; int charsizey; charsizex=16; @@ -68,31 +79,10 @@ void initpol_tables(){ interpol_table_fac2[px][py]=(unsigned int)(xinvweight*yweight*256.); interpol_table_fac3[px][py]=(unsigned int)(xweight*yinvweight*256.); interpol_table_fac4[px][py]=(unsigned int)(xinvweight*yinvweight*256.); - } } } - -Surface* Surface::screen = NULL; -#ifndef GRADIENT_DRAWING -osd_font_t* Surface::font = &font_helvB18; -#endif - -Surface::Surface(int id) -{ - if (id == SCREEN) screen = this; -} - -Surface::~Surface() -{ -} - -Surface* Surface::getScreen() -{ - return screen; -} - int Surface::drawText(const char* text, int x, int y, const DrawStyle& c) { return drawText(text, x, y, 2000, c); diff --git a/surface.h b/surface.h index ac75917..b0effd3 100644 --- a/surface.h +++ b/surface.h @@ -29,6 +29,7 @@ #ifndef GRADIENT_DRAWING // Font stuff +// FIXME does anything use this anymore? typedef struct bogl_font { char *name; /* Font name. */ int height; /* Height in pixels. */ @@ -114,6 +115,17 @@ public: virtual void drawPixel(int x, int y, unsigned int c, bool fastdraw=false)=0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation virtual void drawPixel(int x, int y, Colour& c, bool fastdraw=false)=0; // deprecated preparation for vector based drawing, only allowed to be called inside implementation + private: + void initpol_tables(); + unsigned int interpol_table_fac1[16][22]; + unsigned int interpol_table_fac2[16][22]; + unsigned int interpol_table_fac3[16][22]; + unsigned int interpol_table_fac4[16][22]; + int interpol_lowbit[16]; + int interpol_upbit[16]; + int interpol_lowline[22]; + int interpol_upline[22]; + bool pol_table_inited=false; }; #endif -- 2.39.2