Skip to content

Commit 3d78a0c

Browse files
committed
Helper file for GD functions
Remove test helper from root Initial progress on converting GD to use objects Removal of unnecessary tests, removal of image pointer validation Moved object defs out of magical header file Removed check on image free, fixed evaluating zval offset, fixed ce flags, tabs Switched posix test to use curl instead of gd as it is no longer a resource GdImage cannot be cloned gd image object handlers in standalone file
1 parent 962a9cd commit 3d78a0c

38 files changed

+705
-1189
lines changed

ext/gd/gd.c

Lines changed: 383 additions & 367 deletions
Large diffs are not rendered by default.

ext/gd/gd.stub.php

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,39 @@ function imagesetstyle($im, array $styles): bool {}
1010
/** @return resource|false */
1111
function imagecreatetruecolor(int $x_size, int $y_size) {}
1212

13-
function imageistruecolor($im): bool {}
13+
function imageistruecolor(GdImage $im): bool {}
1414

15-
function imagetruecolortopalette($im, bool $ditherFlag, int $colorWanted): bool {}
15+
function imagetruecolortopalette(GdImage $im, bool $ditherFlag, int $colorWanted): bool {}
1616

17-
function imagepalettetotruecolor($im): bool {}
17+
function imagepalettetotruecolor(GdImage $im): bool {}
1818

1919
function imagecolormatch($im1, $im2): bool {}
2020

21-
function imagesetthickness($im, int $thickness): bool {}
21+
function imagesetthickness(GdImage $im, int $thickness): bool {}
2222

23-
function imagefilledellipse($im, int $cx, int $cy, int $w, int $h, int $color): bool {}
23+
function imagefilledellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
2424

25-
function imagefilledarc($im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col, int $style): bool {}
25+
function imagefilledarc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col, int $style): bool {}
2626

27-
function imagealphablending($im, bool $blend): bool {}
27+
function imagealphablending(GdImage $im, bool $blend): bool {}
2828

29-
function imagesavealpha($im, bool $save): bool {}
29+
function imagesavealpha(GdImage $im, bool $save): bool {}
3030

31-
function imagelayereffect($im, int $effect): bool {}
31+
function imagelayereffect(GdImage $im, int $effect): bool {}
3232

3333
/** @return int|false */
34-
function imagecolorallocatealpha($im, int $red, int $green, int $blue, int $alpha) {}
34+
function imagecolorallocatealpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
3535

3636
/** @return int|false */
37-
function imagecolorresolvealpha($im, int $red, int $green, int $blue, int $alpha) {}
37+
function imagecolorresolvealpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
3838

3939
/** @return int|false */
40-
function imagecolorclosestalpha($im, int $red, int $green, int $blue, int $alpha) {}
40+
function imagecolorclosestalpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
4141

4242
/** @return int|false */
43-
function imagecolorexactalpha($im, int $red, int $green, int $blue, int $alpha) {}
43+
function imagecolorexactalpha(GdImage $im, int $red, int $green, int $blue, int $alpha) {}
4444

45-
function imagecopyresampled($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
45+
function imagecopyresampled(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
4646

4747
#ifdef PHP_WIN32
4848

@@ -55,11 +55,11 @@ function imagegrabscreen() {}
5555
#endif
5656

5757
/** @return resource|false */
58-
function imagerotate($im, float $angle, int $bgdcolor, int $ignoretransparent = 0) {}
58+
function imagerotate(GdImage $im, float $angle, int $bgdcolor, int $ignoretransparent = 0) {}
5959

60-
function imagesettile($im, $tile): bool {}
60+
function imagesettile(GdImage $im, $tile): bool {}
6161

62-
function imagesetbrush($im, $brush): bool {}
62+
function imagesetbrush(GdImage $im, $brush): bool {}
6363

6464
/** @return resource|false */
6565
function imagecreate(int $x_size, int $y_size) {}
@@ -117,160 +117,160 @@ function imagecreatefrombmp(string $filename) {}
117117
function imagecreatefromtga(string $filename) {}
118118
#endif
119119

120-
function imagexbm($im, ?string $filename, int $foreground = UNKNOWN): bool {}
120+
function imagexbm(GdImage $im, ?string $filename, int $foreground = UNKNOWN): bool {}
121121

122-
function imagegif($im, $to = NULL): bool {}
122+
function imagegif(GdImage $im, $to = NULL): bool {}
123123

124124
#ifdef HAVE_GD_PNG
125-
function imagepng($im, $to = NULL, int $quality = UNKNOWN, int $filters = UNKNOWN): bool {}
125+
function imagepng(GdImage $im, $to = NULL, int $quality = UNKNOWN, int $filters = UNKNOWN): bool {}
126126
#endif
127127

128128
#ifdef HAVE_GD_WEBP
129-
function imagewebp($im, $to = NULL, int $quality = UNKNOWN): bool {}
129+
function imagewebp(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
130130
#endif
131131

132132
#ifdef HAVE_GD_JPG
133-
function imagejpeg($im, $to = NULL, int $quality = UNKNOWN): bool {}
133+
function imagejpeg(GdImage $im, $to = NULL, int $quality = UNKNOWN): bool {}
134134
#endif
135135

136-
function imagewbmp($im, $to = NULL, int $foreground = UNKNOWN): bool {}
136+
function imagewbmp(GdImage $im, $to = NULL, int $foreground = UNKNOWN): bool {}
137137

138-
function imagegd($im, $to = UNKNOWN): bool {}
138+
function imagegd(GdImage $im, $to = UNKNOWN): bool {}
139139

140-
function imagegd2($im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
140+
function imagegd2(GdImage $im, $to = UNKNOWN, int $chunk_size = UNKNOWN, int $type = UNKNOWN): bool {}
141141

142142
#ifdef HAVE_GD_BMP
143-
function imagebmp($im, $to = NULL, int $compressed = 1): bool {}
143+
function imagebmp(GdImage $im, $to = NULL, int $compressed = 1): bool {}
144144
#endif
145145

146-
function imagedestroy($im): bool {}
146+
function imagedestroy(GdImage $im): bool {}
147147

148148
/** @return int|false */
149-
function imagecolorallocate($im, int $red, int $green, int $blue) {}
149+
function imagecolorallocate(GdImage $im, int $red, int $green, int $blue) {}
150150

151-
function imagepalettecopy($dst, $src): void {}
151+
function imagepalettecopy(GdImage $dst, GdImage $src): void {}
152152

153153
/** @return int|false */
154-
function imagecolorat($im, int $x, int $y) {}
154+
function imagecolorat(GdImage $im, int $x, int $y) {}
155155

156156
/** @return int|false */
157-
function imagecolorclosest($im, int $red, int $green, int $blue) {}
157+
function imagecolorclosest(GdImage $im, int $red, int $green, int $blue) {}
158158

159159
/** @return int|false */
160-
function imagecolorclosesthwb($im, int $red, int $green, int $blue) {}
160+
function imagecolorclosesthwb(GdImage $im, int $red, int $green, int $blue) {}
161161

162-
function imagecolordeallocate($im, int $index): bool {}
162+
function imagecolordeallocate(GdImage $im, int $index): bool {}
163163

164164
/** @return int|false */
165-
function imagecolorresolve($im, int $red, int $green, int $blue) {}
165+
function imagecolorresolve(GdImage $im, int $red, int $green, int $blue) {}
166166

167167
/** @return int|false */
168-
function imagecolorexact($im, int $red, int $green, int $blue) {}
168+
function imagecolorexact(GdImage $im, int $red, int $green, int $blue) {}
169169

170170
/** @return ?false */
171-
function imagecolorset($im, int $color, int $red, int $green, int $blue, int $alpha = 0) {}
171+
function imagecolorset(GdImage $im, int $color, int $red, int $green, int $blue, int $alpha = 0) {}
172172

173173
/** @return array|false */
174-
function imagecolorsforindex($im, int $index) {}
174+
function imagecolorsforindex(GdImage $im, int $index) {}
175175

176-
function imagegammacorrect($im, float $inputgamma, float $outputgamma): bool {}
176+
function imagegammacorrect(GdImage $im, float $inputgamma, float $outputgamma): bool {}
177177

178-
function imagesetpixel($im, int $x, int $y, int $col): bool {}
178+
function imagesetpixel(GdImage $im, int $x, int $y, int $col): bool {}
179179

180-
function imageline($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
180+
function imageline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
181181

182-
function imagedashedline($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
182+
function imagedashedline(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
183183

184-
function imagerectangle($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
184+
function imagerectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
185185

186-
function imagefilledrectangle($im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
186+
function imagefilledrectangle(GdImage $im, int $x1, int $y1, int $x2, int $y2, int $col): bool {}
187187

188-
function imagearc($im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col): bool {}
188+
function imagearc(GdImage $im, int $cx, int $cy, int $w, int $h, int $s, int $e, int $col): bool {}
189189

190-
function imageellipse($im, int $cx, int $cy, int $w, int $h, int $color): bool {}
190+
function imageellipse(GdImage $im, int $cx, int $cy, int $w, int $h, int $color): bool {}
191191

192-
function imagefilltoborder($im, int $x, int $y, int $border, int $col): bool {}
192+
function imagefilltoborder(GdImage $im, int $x, int $y, int $border, int $col): bool {}
193193

194-
function imagefill($im, int $x, int $y, int $col): bool {}
194+
function imagefill(GdImage $im, int $x, int $y, int $col): bool {}
195195

196-
function imagecolorstotal($im): int {}
196+
function imagecolorstotal(GdImage $im): int {}
197197

198-
function imagecolortransparent($im, int $col = UNKNOWN): ?int {}
198+
function imagecolortransparent(GdImage $im, int $col = UNKNOWN): ?int {}
199199

200-
function imageinterlace($im, int $interlace = UNKNOWN): ?int {}
200+
function imageinterlace(GdImage $im, int $interlace = UNKNOWN): ?int {}
201201

202-
function imagepolygon($im, array $points, int $num_pos, int $col): bool {}
202+
function imagepolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
203203

204-
function imageopenpolygon($im, array $points, int $num_pos, int $col): bool {}
204+
function imageopenpolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
205205

206-
function imagefilledpolygon($im, array $points, int $num_pos, int $col): bool {}
206+
function imagefilledpolygon(GdImage $im, array $points, int $num_pos, int $col): bool {}
207207

208208
function imagefontwidth(int $font): int {}
209209

210210
function imagefontheight(int $font): int {}
211211

212-
function imagechar($im, int $font, int $x, int $y, string $c, int $col): bool {}
212+
function imagechar(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
213213

214-
function imagecharup($im, int $font, int $x, int $y, string $c, int $col): bool {}
214+
function imagecharup(GdImage $im, int $font, int $x, int $y, string $c, int $col): bool {}
215215

216-
function imagestring($im, int $font, int $x, int $y, string $str, int $col): bool {}
216+
function imagestring(GdImage $im, int $font, int $x, int $y, string $str, int $col): bool {}
217217

218218
function imagestringup($im, int $font, int $x, int $y, string $str, int $col): bool {}
219219

220-
function imagecopy($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): bool {}
220+
function imagecopy(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h): bool {}
221221

222-
function imagecopymerge($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
222+
function imagecopymerge(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
223223

224-
function imagecopymergegray($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
224+
function imagecopymergegray(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct): bool {}
225225

226-
function imagecopyresized($dst_im, $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
226+
function imagecopyresized(GdImage $dst_im, GdImage $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h): bool {}
227227

228-
function imagesx($im): int {}
228+
function imagesx(GdImage $im): int {}
229229

230-
function imagesy($im): int {}
230+
function imagesy(GdImage $im): int {}
231231

232-
function imagesetclip($im, int $x1, int $x2, int $y1, int $y2): bool {}
232+
function imagesetclip(GdImage $im, int $x1, int $x2, int $y1, int $y2): bool {}
233233

234-
function imagegetclip($im): array {}
234+
function imagegetclip(GdImage $im): array {}
235235

236236
#ifdef HAVE_GD_FREETYPE
237237
/** @return array|false */
238238
function imageftbbox(float $size, float $angle, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
239239

240-
function imagefttext($im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
240+
function imagefttext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text, array $extrainfo = UNKNOWN) {}
241241

242242
function imagettfbbox(float $size, float $angle, string $font_file, string $text) {}
243243

244-
function imagettftext($im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text) {}
244+
function imagettftext(GdImage $im, float $size, float $angle, int $x, int $y, int $col, string $font_file, string $text) {}
245245
#endif
246246

247-
function imagefilter($im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
247+
function imagefilter(GdImage $im, int $filtertype, $arg1 = UNKNOWN, $arg2 = UNKNOWN, $arg3 = UNKNOWN, $arg4 = UNKNOWN): bool {}
248248

249-
function imageconvolution($im, array $matrix3x3, float $div, float $offset): bool {}
249+
function imageconvolution(GdImage $im, array $matrix3x3, float $div, float $offset): bool {}
250250

251-
function imageflip($im, int $mode): bool {}
251+
function imageflip(GdImage $im, int $mode): bool {}
252252

253-
function imageantialias($im, bool $on): bool {}
253+
function imageantialias(GdImage $im, bool $on): bool {}
254254

255255
/** @return resource|false */
256-
function imagecrop($im, array $rect) {}
256+
function imagecrop(GdImage $im, array $rect) {}
257257

258258
/** @return resource|false */
259-
function imagecropauto($im, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1) {}
259+
function imagecropauto(GdImage $im, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1) {}
260260

261261
/** @return resource|false */
262-
function imagescale($im, int $new_width, int $new_height = UNKNOWN, int $mode = IMG_BILINEAR_FIXED) {}
262+
function imagescale(GdImage $im, int $new_width, int $new_height = UNKNOWN, int $mode = IMG_BILINEAR_FIXED) {}
263263

264264
/** @return resource|false */
265-
function imageaffine($im, array $affine, array $clip = UNKNOWN) {}
265+
function imageaffine(GdImage $im, array $affine, array $clip = UNKNOWN) {}
266266

267267
/** @return array|false */
268268
function imageaffinematrixget(int $type, $options = UNKNOWN) {}
269269

270270
/** @return array|false */
271271
function imageaffinematrixconcat(array $m1, array $m2) {}
272272

273-
function imagesetinterpolation($im, int $method = IMG_BILENEAR_FIXED): bool {}
273+
function imagesetinterpolation(GdImage $im, int $method = IMG_BILENEAR_FIXED): bool {}
274274

275275
/** @return array|true */
276-
function imageresolution($im, int $res_x = UNKNOWN, int $res_y = UNKNOWN) {}
276+
function imageresolution(GdImage $im, int $res_x = UNKNOWN, int $res_y = UNKNOWN) {}

0 commit comments

Comments
 (0)