@@ -92,7 +92,6 @@ def cfactory(func, argtypes, restype):
92
92
93
93
uint32 = ctypes .c_uint32
94
94
void = ctypes .c_void_p
95
- size_t = ctypes .c_size_t
96
95
pointer = ctypes .POINTER
97
96
98
97
cfactory (
@@ -109,14 +108,14 @@ def cfactory(func, argtypes, restype):
109
108
argtypes = [CGRect , uint32 , uint32 , uint32 ],
110
109
restype = void ,
111
110
)
112
- cfactory (func = "CGImageGetWidth" , argtypes = [void ], restype = size_t )
113
- cfactory (func = "CGImageGetHeight" , argtypes = [void ], restype = size_t )
111
+ cfactory (func = "CGImageGetWidth" , argtypes = [void ], restype = int )
112
+ cfactory (func = "CGImageGetHeight" , argtypes = [void ], restype = int )
114
113
cfactory (func = "CGImageGetDataProvider" , argtypes = [void ], restype = void )
115
114
cfactory (func = "CGDataProviderCopyData" , argtypes = [void ], restype = void )
116
115
cfactory (func = "CFDataGetBytePtr" , argtypes = [void ], restype = void )
117
116
cfactory (func = "CFDataGetLength" , argtypes = [void ], restype = ctypes .c_uint64 )
118
- cfactory (func = "CGImageGetBytesPerRow" , argtypes = [void ], restype = size_t )
119
- cfactory (func = "CGImageGetBitsPerPixel" , argtypes = [void ], restype = size_t )
117
+ cfactory (func = "CGImageGetBytesPerRow" , argtypes = [void ], restype = int )
118
+ cfactory (func = "CGImageGetBitsPerPixel" , argtypes = [void ], restype = int )
120
119
cfactory (func = "CGDataProviderRelease" , argtypes = [void ], restype = void )
121
120
cfactory (func = "CFRelease" , argtypes = [void ], restype = void )
122
121
@@ -183,8 +182,8 @@ def _grab_impl(self, monitor):
183
182
if not image_ref :
184
183
raise ScreenShotError ("CoreGraphics.CGWindowListCreateImage() failed." )
185
184
186
- width = int ( core .CGImageGetWidth (image_ref ) )
187
- height = int ( core .CGImageGetHeight (image_ref ) )
185
+ width = core .CGImageGetWidth (image_ref )
186
+ height = core .CGImageGetHeight (image_ref )
188
187
prov = copy_data = None
189
188
try :
190
189
prov = core .CGImageGetDataProvider (image_ref )
@@ -195,8 +194,8 @@ def _grab_impl(self, monitor):
195
194
data = bytearray (raw .contents )
196
195
197
196
# Remove padding per row
198
- bytes_per_row = int ( core .CGImageGetBytesPerRow (image_ref ) )
199
- bytes_per_pixel = int ( core .CGImageGetBitsPerPixel (image_ref ) )
197
+ bytes_per_row = core .CGImageGetBytesPerRow (image_ref )
198
+ bytes_per_pixel = core .CGImageGetBitsPerPixel (image_ref )
200
199
bytes_per_pixel = (bytes_per_pixel + 7 ) // 8
201
200
202
201
if bytes_per_pixel * width != bytes_per_row :
0 commit comments