@@ -220,7 +220,7 @@ __render_glyph_INT(int x, int y, FontSurface *surface, const FT_Bitmap *bitmap,
220
220
{
221
221
FT_Byte * dst = ((FT_Byte * )surface -> buffer + x * surface -> item_stride +
222
222
y * surface -> pitch );
223
- int item_size = PG_SURF_BytesPerPixel (surface );
223
+ int item_size = PG_FORMAT_BytesPerPixel (surface -> format );
224
224
int item_stride = surface -> item_stride ;
225
225
FT_Byte * dst_cpy ;
226
226
@@ -301,7 +301,7 @@ __render_glyph_MONO_as_INT(int x, int y, FontSurface *surface,
301
301
302
302
int i , j , shift ;
303
303
int item_stride = surface -> item_stride ;
304
- int item_size = PG_SURF_BytesPerPixel (surface );
304
+ int item_size = PG_FORMAT_BytesPerPixel (surface -> format );
305
305
unsigned char * src ;
306
306
unsigned char * dst ;
307
307
unsigned char * src_cpy ;
@@ -380,7 +380,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
380
380
{
381
381
int i , j ;
382
382
FT_Byte * dst ;
383
- int itemsize = PG_SURF_BytesPerPixel (surface );
383
+ int itemsize = PG_FORMAT_BytesPerPixel (surface -> format );
384
384
int item_stride = surface -> item_stride ;
385
385
int byteoffset = surface -> format -> Ashift / 8 ;
386
386
FT_Byte * dst_cpy ;
@@ -544,7 +544,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
544
544
POINTER_ASSERT (_dst ) \
545
545
\
546
546
if (_bpp == 1 ) { \
547
- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , bgB , \
547
+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , bgB , \
548
548
bgA ); \
549
549
} \
550
550
else { \
@@ -575,7 +575,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
575
575
POINTER_ASSERT (_dst ) \
576
576
\
577
577
if (_bpp == 1 ) { \
578
- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , bgB , \
578
+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , bgB , \
579
579
bgA ); \
580
580
} \
581
581
else { \
@@ -607,7 +607,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
607
607
POINTER_ASSERT (_dst ) \
608
608
\
609
609
if (_bpp == 1 ) { \
610
- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , bgB , \
610
+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , bgB , \
611
611
bgA ); \
612
612
} \
613
613
else { \
@@ -666,8 +666,9 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
666
666
dst = (unsigned char *)surface->buffer + (rx * _bpp) + \
667
667
(ry * surface->pitch); \
668
668
\
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); \
671
672
\
672
673
shift = off_x & 7; \
673
674
(void)full_color; \
@@ -679,7 +680,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
679
680
FT_UInt32 pixel = (FT_UInt32)_getp; \
680
681
\
681
682
if (_bpp == 1) { \
682
- GET_PALETTE_VALS(pixel, surface->format , bgR, bgG, bgB, \
683
+ GET_PALETTE_VALS(pixel, surface->palette , bgR, bgG, bgB, \
683
684
bgA); \
684
685
} \
685
686
else { \
@@ -743,7 +744,7 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
743
744
FT_UInt32 pixel = (FT_UInt32 )_getp ; \
744
745
\
745
746
if (_bpp == 1 ) { \
746
- GET_PALETTE_VALS (pixel , surface -> format , bgR , bgG , \
747
+ GET_PALETTE_VALS (pixel , surface -> palette , bgR , bgG , \
747
748
bgB , bgA ); \
748
749
} \
749
750
else { \
@@ -765,9 +766,10 @@ __fill_glyph_INT(FT_Fixed x, FT_Fixed y, FT_Fixed w, FT_Fixed h,
765
766
766
767
/* These macros removes a gcc unused variable warning for __render_glyph_RGB3
767
768
*/
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);
771
773
#define _DECLARE_full_color1 (s , c ) _DECLARE_full_color(s, c)
772
774
#define _DECLARE_full_color2 (s , c ) _DECLARE_full_color(s, c)
773
775
#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,
780
782
781
783
#define _SET_PIXEL (T ) *(T *)_dst = (T)full_color;
782
784
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))
794
799
795
800
#define _GET_PIXEL (T ) (*((T *)_dst))
796
801
0 commit comments