| 3112 | //########################################################################## |
| 3113 | |
| 3114 | class FrameFiller { |
| 3115 | |
| 3116 | public $width; |
| 3117 | public $frame; |
| 3118 | public $x; |
| 3119 | public $y; |
| 3120 | public $dir; |
| 3121 | public $bit; |
| 3122 | |
| 3123 | //---------------------------------------------------------------------- |
| 3124 | public function __construct($width, &$frame) |
| 3125 | { |
| 3126 | $this->width = $width; |
| 3127 | $this->frame = $frame; |
| 3128 | $this->x = $width - 1; |
| 3129 | $this->y = $width - 1; |
| 3130 | $this->dir = -1; |
| 3131 | $this->bit = -1; |
| 3132 | } |
| 3133 | |
| 3134 | //---------------------------------------------------------------------- |
| 3135 | public function setFrameAt($at, $val) |
| 3136 | { |
| 3137 | $this->frame[$at['y']][$at['x']] = chr($val); |
| 3138 | } |
| 3139 | |
| 3140 | //---------------------------------------------------------------------- |
| 3141 | public function getFrameAt($at) |
| 3142 | { |
| 3143 | return ord($this->frame[$at['y']][$at['x']]); |
| 3144 | } |
| 3145 | |
| 3146 | //---------------------------------------------------------------------- |
| 3147 | public function next() |
| 3148 | { |
| 3149 | do { |
| 3150 | |
| 3151 | if($this->bit == -1) { |
| 3152 | $this->bit = 0; |
| 3153 | return array('x'=>$this->x, 'y'=>$this->y); |
| 3154 | } |
| 3155 | |
| 3156 | $x = $this->x; |
| 3157 | $y = $this->y; |
| 3158 | $w = $this->width; |
| 3159 | |
| 3160 | if($this->bit == 0) { |
| 3161 | $x--; |
| 3162 | $this->bit++; |
| 3163 | } else { |
| 3164 | $x++; |
| 3165 | $y += $this->dir; |
| 3166 | $this->bit--; |
| 3167 | } |
| 3168 | |
| 3169 | if($this->dir < 0) { |
| 3170 | if($y < 0) { |
| 3171 | $y = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected