| 304 | //########################################################################## |
| 305 | |
| 306 | class FrameFiller { |
| 307 | |
| 308 | public $width; |
| 309 | public $frame; |
| 310 | public $x; |
| 311 | public $y; |
| 312 | public $dir; |
| 313 | public $bit; |
| 314 | |
| 315 | //---------------------------------------------------------------------- |
| 316 | public function __construct($width, &$frame) |
| 317 | { |
| 318 | $this->width = $width; |
| 319 | $this->frame = $frame; |
| 320 | $this->x = $width - 1; |
| 321 | $this->y = $width - 1; |
| 322 | $this->dir = -1; |
| 323 | $this->bit = -1; |
| 324 | } |
| 325 | |
| 326 | //---------------------------------------------------------------------- |
| 327 | public function setFrameAt($at, $val) |
| 328 | { |
| 329 | $this->frame[$at['y']][$at['x']] = chr($val); |
| 330 | } |
| 331 | |
| 332 | //---------------------------------------------------------------------- |
| 333 | public function getFrameAt($at) |
| 334 | { |
| 335 | return ord($this->frame[$at['y']][$at['x']]); |
| 336 | } |
| 337 | |
| 338 | //---------------------------------------------------------------------- |
| 339 | public function next() |
| 340 | { |
| 341 | do { |
| 342 | |
| 343 | if($this->bit == -1) { |
| 344 | $this->bit = 0; |
| 345 | return array('x'=>$this->x, 'y'=>$this->y); |
| 346 | } |
| 347 | |
| 348 | $x = $this->x; |
| 349 | $y = $this->y; |
| 350 | $w = $this->width; |
| 351 | |
| 352 | if($this->bit == 0) { |
| 353 | $x--; |
| 354 | $this->bit++; |
| 355 | } else { |
| 356 | $x++; |
| 357 | $y += $this->dir; |
| 358 | $this->bit--; |
| 359 | } |
| 360 | |
| 361 | if($this->dir < 0) { |
| 362 | if($y < 0) { |
| 363 | $y = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected