@@ -124,7 +124,7 @@ surf_colorspace(PyObject *self, PyObject *arg)
124
124
"Surfaces not the same width and height." );
125
125
126
126
/* 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 ) )
128
128
return RAISE (PyExc_ValueError , "Surfaces not the same depth" );
129
129
130
130
SDL_LockSurface (newsurf );
@@ -505,7 +505,7 @@ rgb24_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
505
505
gloss = format -> Gloss ;
506
506
bloss = format -> Bloss ;
507
507
508
- switch (format -> BytesPerPixel ) {
508
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
509
509
case 1 :
510
510
d8 = (Uint8 * )dst ;
511
511
while (length -- ) {
@@ -567,7 +567,7 @@ bgr32_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
567
567
gloss = format -> Gloss ;
568
568
bloss = format -> Bloss ;
569
569
570
- switch (format -> BytesPerPixel ) {
570
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
571
571
case 1 :
572
572
d8 = (Uint8 * )dst ;
573
573
while (length -- ) {
@@ -681,7 +681,7 @@ rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
681
681
h = 170 + 43 * (r - g ) / delta ;
682
682
}
683
683
}
684
- switch (format -> BytesPerPixel ) {
684
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
685
685
case 1 :
686
686
* d8 ++ = ((h >> rloss ) << rshift ) |
687
687
((s >> gloss ) << gshift ) |
@@ -707,7 +707,7 @@ rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
707
707
}
708
708
else { /* for use as stage 2 in yuv or bayer to hsv, r and b switched */
709
709
while (length -- ) {
710
- switch (format -> BytesPerPixel ) {
710
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
711
711
case 1 :
712
712
r = * s8 >> rshift << rloss ;
713
713
g = * s8 >> gshift << gloss ;
@@ -749,7 +749,7 @@ rgb_to_hsv(const void *src, void *dst, int length, unsigned long source,
749
749
h = 170 + 43 * (r - g ) / delta ;
750
750
}
751
751
}
752
- switch (format -> BytesPerPixel ) {
752
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
753
753
case 1 :
754
754
* d8 ++ = ((h >> rloss ) << rshift ) |
755
755
((s >> gloss ) << gshift ) |
@@ -826,7 +826,7 @@ rgb_to_yuv(const void *src, void *dst, int length, unsigned long source,
826
826
v = ((112 * r - 94 * g - 18 * b + 128 ) >> 8 ) + 128 ; /* V */
827
827
u = ((-38 * r - 74 * g + 112 * b + 128 ) >> 8 ) + 128 ; /* U */
828
828
y = (77 * r + 150 * g + 29 * b + 128 ) >> 8 ; /* Y */
829
- switch (format -> BytesPerPixel ) {
829
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
830
830
case 1 :
831
831
* d8 ++ = ((y >> rloss ) << rshift ) |
832
832
((u >> gloss ) << gshift ) |
@@ -851,7 +851,7 @@ rgb_to_yuv(const void *src, void *dst, int length, unsigned long source,
851
851
}
852
852
}
853
853
else { /* for use as stage 2 in bayer to yuv, r and b switched */
854
- switch (format -> BytesPerPixel ) {
854
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
855
855
case 1 :
856
856
while (length -- ) {
857
857
r = * s8 >> rshift << rloss ;
@@ -932,7 +932,7 @@ rgb444_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
932
932
gloss = format -> Gloss ;
933
933
bloss = format -> Bloss ;
934
934
935
- switch (format -> BytesPerPixel ) {
935
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
936
936
case 1 :
937
937
d8 = (Uint8 * )dst ;
938
938
while (length -- ) {
@@ -1026,7 +1026,7 @@ yuyv_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
1026
1026
b2 = SAT2 (y2 + u1 );
1027
1027
1028
1028
/* choose the right pixel packing for the destination surface depth */
1029
- switch (format -> BytesPerPixel ) {
1029
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1030
1030
case 1 :
1031
1031
* d8 ++ = ((r1 >> rloss ) << rshift ) | ((g1 >> gloss ) << gshift ) |
1032
1032
((b1 >> bloss ) << bshift );
@@ -1076,7 +1076,7 @@ yuyv_to_yuv(const void *src, void *dst, int length, SDL_PixelFormat *format)
1076
1076
bloss = format -> Bloss ;
1077
1077
s = (Uint8 * )src ;
1078
1078
1079
- switch (format -> BytesPerPixel ) {
1079
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1080
1080
case 1 :
1081
1081
d8 = (Uint8 * )dst ;
1082
1082
while (i -- ) {
@@ -1180,7 +1180,7 @@ uyvy_to_rgb(const void *src, void *dst, int length, SDL_PixelFormat *format)
1180
1180
b2 = SAT2 (y2 + u1 );
1181
1181
1182
1182
/* choose the right pixel packing for the destination surface depth */
1183
- switch (format -> BytesPerPixel ) {
1183
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1184
1184
case 1 :
1185
1185
* d8 ++ = ((r1 >> rloss ) << rshift ) | ((g1 >> gloss ) << gshift ) |
1186
1186
((b1 >> bloss ) << bshift );
@@ -1229,7 +1229,7 @@ uyvy_to_yuv(const void *src, void *dst, int length, SDL_PixelFormat *format)
1229
1229
bloss = format -> Bloss ;
1230
1230
s = (Uint8 * )src ;
1231
1231
1232
- switch (format -> BytesPerPixel ) {
1232
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1233
1233
case 1 :
1234
1234
d8 = (Uint8 * )dst ;
1235
1235
while (i -- ) {
@@ -1405,7 +1405,7 @@ sbggr8_to_rgb(const void *src, void *dst, int width, int height,
1405
1405
}
1406
1406
}
1407
1407
rawpt ++ ;
1408
- switch (format -> BytesPerPixel ) {
1408
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1409
1409
case 1 :
1410
1410
* d8 ++ = ((r >> rloss ) << rshift ) | ((g >> gloss ) << gshift ) |
1411
1411
((b >> bloss ) << bshift );
@@ -1456,15 +1456,15 @@ yuv420_to_rgb(const void *src, void *dst, int width, int height,
1456
1456
/* prepare the destination pointers for different surface depths. */
1457
1457
d8_1 = (Uint8 * )dst ;
1458
1458
/* 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 );
1460
1460
d16_1 = (Uint16 * )dst ;
1461
1461
d16_2 = d16_1 + width ;
1462
1462
d32_1 = (Uint32 * )dst ;
1463
1463
d32_2 = d32_1 + width ;
1464
1464
1465
1465
/* for the sake of speed, the nested while loops are inside of the switch
1466
1466
statement for the different surface bit depths */
1467
- switch (format -> BytesPerPixel ) {
1467
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1468
1468
case 1 :
1469
1469
while (j -- ) {
1470
1470
i = width / 2 ;
@@ -1648,7 +1648,7 @@ yuv420_to_yuv(const void *src, void *dst, int width, int height,
1648
1648
bloss = format -> Bloss ;
1649
1649
1650
1650
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 );
1652
1652
d16_1 = (Uint16 * )dst ;
1653
1653
d16_2 = d16_1 + width ;
1654
1654
d32_1 = (Uint32 * )dst ;
@@ -1659,7 +1659,7 @@ yuv420_to_yuv(const void *src, void *dst, int width, int height,
1659
1659
v = u + (width * height ) / 4 ;
1660
1660
j = height / 2 ;
1661
1661
1662
- switch (format -> BytesPerPixel ) {
1662
+ switch (PG_FORMAT_BytesPerPixel ( format ) ) {
1663
1663
case 1 :
1664
1664
while (j -- ) {
1665
1665
i = width / 2 ;
0 commit comments