@@ -124,7 +124,7 @@ surf_colorspace(PyObject *self, PyObject *arg)
124124 "Surfaces not the same width and height." );
125125
126126 /* check to see if the format of the surface is the same. */
127- if (surf -> format -> BitsPerPixel != newsurf -> format -> BitsPerPixel )
127+ if (PG_SURF_BitsPerPixel ( surf ) != PG_SURF_BitsPerPixel ( newsurf ) )
128128 return RAISE (PyExc_ValueError , "Surfaces not the same depth" );
129129
130130 SDL_LockSurface (newsurf );
@@ -505,7 +505,7 @@ rgb24_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
505505 gloss = format -> Gloss ;
506506 bloss = format -> Bloss ;
507507
508- switch (format -> BytesPerPixel ) {
508+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
509509 case 1 :
510510 d8 = (Uint8 * )dst ;
511511 while (length -- ) {
@@ -567,7 +567,7 @@ bgr32_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
567567 gloss = format -> Gloss ;
568568 bloss = format -> Bloss ;
569569
570- switch (format -> BytesPerPixel ) {
570+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
571571 case 1 :
572572 d8 = (Uint8 * )dst ;
573573 while (length -- ) {
@@ -681,7 +681,7 @@ rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
681681 h = 170 + 43 * (r - g ) / delta ;
682682 }
683683 }
684- switch (format -> BytesPerPixel ) {
684+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
685685 case 1 :
686686 * d8 ++ = ((h >> rloss ) << rshift ) |
687687 ((s >> gloss ) << gshift ) |
@@ -707,7 +707,7 @@ rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
707707 }
708708 else { /* for use as stage 2 in yuv or bayer to hsv, r and b switched */
709709 while (length -- ) {
710- switch (format -> BytesPerPixel ) {
710+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
711711 case 1 :
712712 r = * s8 >> rshift << rloss ;
713713 g = * s8 >> gshift << gloss ;
@@ -749,7 +749,7 @@ rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
749749 h = 170 + 43 * (r - g ) / delta ;
750750 }
751751 }
752- switch (format -> BytesPerPixel ) {
752+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
753753 case 1 :
754754 * d8 ++ = ((h >> rloss ) << rshift ) |
755755 ((s >> gloss ) << gshift ) |
@@ -826,7 +826,7 @@ rgb_to_yuv(const void *src, void *dst, int length, unsigned long source,
826826 v = ((112 * r - 94 * g - 18 * b + 128 ) >> 8 ) + 128 ; /* V */
827827 u = ((-38 * r - 74 * g + 112 * b + 128 ) >> 8 ) + 128 ; /* U */
828828 y = (77 * r + 150 * g + 29 * b + 128 ) >> 8 ; /* Y */
829- switch (format -> BytesPerPixel ) {
829+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
830830 case 1 :
831831 * d8 ++ = ((y >> rloss ) << rshift ) |
832832 ((u >> gloss ) << gshift ) |
@@ -851,7 +851,7 @@ rgb_to_yuv(const void *src, void *dst, int length, unsigned long source,
851851 }
852852 }
853853 else { /* for use as stage 2 in bayer to yuv, r and b switched */
854- switch (format -> BytesPerPixel ) {
854+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
855855 case 1 :
856856 while (length -- ) {
857857 r = * s8 >> rshift << rloss ;
@@ -932,7 +932,7 @@ rgb444_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
932932 gloss = format -> Gloss ;
933933 bloss = format -> Bloss ;
934934
935- switch (format -> BytesPerPixel ) {
935+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
936936 case 1 :
937937 d8 = (Uint8 * )dst ;
938938 while (length -- ) {
@@ -1026,7 +1026,7 @@ yuyv_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
10261026 b2 = SAT2 (y2 + u1 );
10271027
10281028 /* choose the right pixel packing for the destination surface depth */
1029- switch (format -> BytesPerPixel ) {
1029+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
10301030 case 1 :
10311031 * d8 ++ = ((r1 >> rloss ) << rshift ) | ((g1 >> gloss ) << gshift ) |
10321032 ((b1 >> bloss ) << bshift );
@@ -1076,7 +1076,7 @@ yuyv_to_yuv(const void *src, void *dst, int length, SDL_PixelFormat *format)
10761076 bloss = format -> Bloss ;
10771077 s = (Uint8 * )src ;
10781078
1079- switch (format -> BytesPerPixel ) {
1079+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
10801080 case 1 :
10811081 d8 = (Uint8 * )dst ;
10821082 while (i -- ) {
@@ -1180,7 +1180,7 @@ uyvy_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
11801180 b2 = SAT2 (y2 + u1 );
11811181
11821182 /* choose the right pixel packing for the destination surface depth */
1183- switch (format -> BytesPerPixel ) {
1183+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
11841184 case 1 :
11851185 * d8 ++ = ((r1 >> rloss ) << rshift ) | ((g1 >> gloss ) << gshift ) |
11861186 ((b1 >> bloss ) << bshift );
@@ -1229,7 +1229,7 @@ uyvy_to_yuv(const void *src, void *dst, int length, SDL_PixelFormat *format)
12291229 bloss = format -> Bloss ;
12301230 s = (Uint8 * )src ;
12311231
1232- switch (format -> BytesPerPixel ) {
1232+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
12331233 case 1 :
12341234 d8 = (Uint8 * )dst ;
12351235 while (i -- ) {
@@ -1405,7 +1405,7 @@ sbggr8_to_rgb(const void *src, void *dst, int width, int height,
14051405 }
14061406 }
14071407 rawpt ++ ;
1408- switch (format -> BytesPerPixel ) {
1408+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
14091409 case 1 :
14101410 * d8 ++ = ((r >> rloss ) << rshift ) | ((g >> gloss ) << gshift ) |
14111411 ((b >> bloss ) << bshift );
@@ -1456,15 +1456,15 @@ yuv420_to_rgb(const void *src, void *dst, int width, int height,
14561456 /* prepare the destination pointers for different surface depths. */
14571457 d8_1 = (Uint8 * )dst ;
14581458 /* the following is because d8 used for both 8 and 24 bit surfaces */
1459- d8_2 = d8_1 + (format -> BytesPerPixel == 3 ? width * 3 : 3 );
1459+ d8_2 = d8_1 + (PG_FORMAT_BytesPerPixel ( format ) == 3 ? width * 3 : 3 );
14601460 d16_1 = (Uint16 * )dst ;
14611461 d16_2 = d16_1 + width ;
14621462 d32_1 = (Uint32 * )dst ;
14631463 d32_2 = d32_1 + width ;
14641464
14651465 /* for the sake of speed, the nested while loops are inside of the switch
14661466 statement for the different surface bit depths */
1467- switch (format -> BytesPerPixel ) {
1467+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
14681468 case 1 :
14691469 while (j -- ) {
14701470 i = width / 2 ;
@@ -1648,7 +1648,7 @@ yuv420_to_yuv(const void *src, void *dst, int width, int height,
16481648 bloss = format -> Bloss ;
16491649
16501650 d8_1 = (Uint8 * )dst ;
1651- d8_2 = d8_1 + (format -> BytesPerPixel == 3 ? width * 3 : 3 );
1651+ d8_2 = d8_1 + (PG_FORMAT_BytesPerPixel ( format ) == 3 ? width * 3 : 3 );
16521652 d16_1 = (Uint16 * )dst ;
16531653 d16_2 = d16_1 + width ;
16541654 d32_1 = (Uint32 * )dst ;
@@ -1659,7 +1659,7 @@ yuv420_to_yuv(const void *src, void *dst, int width, int height,
16591659 v = u + (width * height ) / 4 ;
16601660 j = height / 2 ;
16611661
1662- switch (format -> BytesPerPixel ) {
1662+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
16631663 case 1 :
16641664 while (j -- ) {
16651665 i = width / 2 ;
0 commit comments