@@ -220,7 +220,7 @@ __render_glyph_INT(int x, int y, FontSurface *surface, const FT_Bitmap *bitmap,
220220{
221221 FT_Byte * dst = ((FT_Byte * )surface -> buffer + x * surface -> item_stride +
222222 y * surface -> pitch );
223- int item_size = PG_SURF_BytesPerPixel (surface );
223+ int item_size = PG_FORMAT_BytesPerPixel (surface -> format );
224224 int item_stride = surface -> item_stride ;
225225 FT_Byte * dst_cpy ;
226226
@@ -301,7 +301,7 @@ __render_glyph_MONO_as_INT(int x, int y, FontSurface *surface,
301301
302302 int i , j , shift ;
303303 int item_stride = surface -> item_stride ;
304- int item_size = PG_SURF_BytesPerPixel (surface );
304+ int item_size = PG_FORMAT_BytesPerPixel (surface -> format );
305305 unsigned char * src ;
306306 unsigned char * dst ;
307307 unsigned char * src_cpy ;
@@ -380,7 +380,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
380380{
381381 int i , j ;
382382 FT_Byte * dst ;
383- int itemsize = PG_SURF_BytesPerPixel (surface );
383+ int itemsize = PG_FORMAT_BytesPerPixel (surface -> format );
384384 int item_stride = surface -> item_stride ;
385385 int byteoffset = surface -> format -> Ashift / 8 ;
386386 FT_Byte * dst_cpy ;
@@ -544,7 +544,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
544544 POINTER_ASSERT (_dst ) \
545545 \
546546 if (_bpp == 1 ) { \
547- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , bgB , \
547+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , bgB , \
548548 bgA ); \
549549 } \
550550 else { \
@@ -575,7 +575,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
575575 POINTER_ASSERT (_dst ) \
576576 \
577577 if (_bpp == 1 ) { \
578- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , bgB , \
578+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , bgB , \
579579 bgA ); \
580580 } \
581581 else { \
@@ -607,7 +607,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
607607 POINTER_ASSERT (_dst ) \
608608 \
609609 if (_bpp == 1 ) { \
610- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , bgB , \
610+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , bgB , \
611611 bgA ); \
612612 } \
613613 else { \
@@ -666,8 +666,9 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
666666 dst = (unsigned char *)surface->buffer + (rx * _bpp) + \
667667 (ry * surface->pitch); \
668668 \
669- full_color = SDL_MapRGBA(surface->format, (FT_Byte)color->r, \
670- (FT_Byte)color->g, (FT_Byte)color->b, 255); \
669+ full_color = \
670+ PG_MapRGBA(surface->format, surface->palette, (FT_Byte)color->r, \
671+ (FT_Byte)color->g, (FT_Byte)color->b, 255); \
671672 \
672673 shift = off_x & 7; \
673674 (void)full_color; \
@@ -679,7 +680,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
679680 FT_UInt32 pixel = (FT_UInt32)_getp; \
680681 \
681682 if (_bpp == 1) { \
682- GET_PALETTE_VALS(pixel, surface->format , bgR, bgG, bgB, \
683+ GET_PALETTE_VALS(pixel, surface->palette , bgR, bgG, bgB, \
683684 bgA); \
684685 } \
685686 else { \
@@ -743,7 +744,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
743744 FT_UInt32 pixel = (FT_UInt32 )_getp ; \
744745 \
745746 if (_bpp == 1 ) { \
746- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , \
747+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , \
747748 bgB , bgA ); \
748749 } \
749750 else { \
@@ -765,9 +766,10 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
765766
766767/* These macros removes a gcc unused variable warning for __render_glyph_RGB3
767768 */
768- #define _DECLARE_full_color (s , c ) \
769- const FT_UInt32 full_color = SDL_MapRGBA( \
770- (s)->format, (FT_Byte)(c)->r, (FT_Byte)(c)->g, (FT_Byte)(c)->b, 255);
769+ #define _DECLARE_full_color (s , c ) \
770+ const FT_UInt32 full_color = \
771+ PG_MapRGBA((s)->format, (s)->palette, (FT_Byte)(c)->r, \
772+ (FT_Byte)(c)->g, (FT_Byte)(c)->b, 255);
771773#define _DECLARE_full_color1 (s , c ) _DECLARE_full_color(s, c)
772774#define _DECLARE_full_color2 (s , c ) _DECLARE_full_color(s, c)
773775#define _DECLARE_full_color3 (s , c )
@@ -780,17 +782,20 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
780782
781783#define _SET_PIXEL (T ) *(T *)_dst = (T)full_color;
782784
783- #define _BLEND_PIXEL (T ) \
784- *((T *)_dst) = \
785- (T)(((bgR >> surface->format->Rloss) << surface->format->Rshift) | \
786- ((bgG >> surface->format->Gloss) << surface->format->Gshift) | \
787- ((bgB >> surface->format->Bloss) << surface->format->Bshift) | \
788- ((bgA >> surface->format->Aloss) << surface->format->Ashift & \
789- surface->format->Amask))
790-
791- #define _BLEND_PIXEL_GENERIC (T ) \
792- *(T *)_dst = (T)(SDL_MapRGB(surface->format, (FT_Byte)bgR, (FT_Byte)bgG, \
793- (FT_Byte)bgB))
785+ #define _BLEND_PIXEL (T ) \
786+ *((T *)_dst) = (T)(((bgR >> PG_FORMAT_R_LOSS(surface->format)) \
787+ << surface->format->Rshift) | \
788+ ((bgG >> PG_FORMAT_G_LOSS(surface->format)) \
789+ << surface->format->Gshift) | \
790+ ((bgB >> PG_FORMAT_B_LOSS(surface->format)) \
791+ << surface->format->Bshift) | \
792+ ((bgA >> PG_FORMAT_A_LOSS(surface->format)) \
793+ << surface->format->Ashift & \
794+ surface->format->Amask))
795+
796+ #define _BLEND_PIXEL_GENERIC (T ) \
797+ *(T *)_dst = (T)(PG_MapRGB(surface->format, surface->palette, \
798+ (FT_Byte)bgR, (FT_Byte)bgG, (FT_Byte)bgB))
794799
795800#define _GET_PIXEL (T ) (*((T *)_dst))
796801
0 commit comments