… | |
… | |
115 | |
115 | |
116 | $self |
116 | $self |
117 | } |
117 | } |
118 | |
118 | |
119 | sub new_from_image { |
119 | sub new_from_image { |
120 | my ($class, $image) = @_; |
120 | my ($class, $image, %arg) = @_; |
121 | |
121 | |
122 | $class->new (image => $image) |
122 | $class->new (image => $image, %arg) |
123 | } |
123 | } |
124 | |
124 | |
125 | sub new_from_file { |
125 | sub new_from_file { |
126 | my ($class, $path) = @_; |
126 | my ($class, $path) = @_; |
127 | |
127 | |
… | |
… | |
197 | |
197 | |
198 | unless ($tw && $th) { |
198 | unless ($tw && $th) { |
199 | $tw = $th = 1; |
199 | $tw = $th = 1; |
200 | $data = "\x00" x 64; |
200 | $data = "\x00" x 64; |
201 | } |
201 | } |
|
|
202 | |
|
|
203 | $self->{minified} = [CFClient::average $tw, $th, $data] |
|
|
204 | if $self->{minify}; |
202 | |
205 | |
203 | unless ($GL_NPOT) { |
206 | unless ($GL_NPOT) { |
204 | # TODO: does not work for zero-sized textures |
207 | # TODO: does not work for zero-sized textures |
205 | $tw = topot $tw; |
208 | $tw = topot $tw; |
206 | $th = topot $th; |
209 | $th = topot $th; |