… | |
… | |
114 | $self->{internalformat} ||= $internalformat; |
114 | $self->{internalformat} ||= $internalformat; |
115 | ($dw, $dh) = @$self{qw(w h)}; |
115 | ($dw, $dh) = @$self{qw(w h)}; |
116 | } |
116 | } |
117 | |
117 | |
118 | my ($tw, $th) = ($dw, $dh); |
118 | my ($tw, $th) = ($dw, $dh); |
119 | my ($rw, $rh) = ($dw, $dh); |
|
|
120 | |
119 | |
121 | defined $data or $self->{render_cb} or die; # some sanity check |
120 | defined $data or $self->{render_cb} or die; # some sanity check |
122 | |
121 | |
123 | $self->{minified} ||= [CFPlus::average $dw, $dh, $data] |
122 | $self->{minified} ||= [CFPlus::average $dw, $dh, $data] |
124 | if $self->{minify}; |
123 | if $self->{minify}; |
… | |
… | |
139 | # quarter the texture size |
138 | # quarter the texture size |
140 | $tw >>= 1; |
139 | $tw >>= 1; |
141 | $th >>= 1; |
140 | $th >>= 1; |
142 | } |
141 | } |
143 | |
142 | |
|
|
143 | # decide the amount of space used in the texture |
|
|
144 | my ($rw, $rh); |
|
|
145 | |
144 | if ($self->{render_cb}) { |
146 | if ($self->{render_cb}) { |
145 | # use only part of the texture |
147 | # use only part of the texture |
146 | #$rw >>= 1 while $rw > $tw; |
148 | #$rw >>= 1 while $rw > $tw; |
147 | #$rh >>= 1 while $rh > $th; |
149 | #$rh >>= 1 while $rh > $th; |
148 | $rw = min $rw, $tw; |
150 | $rw = min $dw, $tw; |
149 | $rh = min $rh, $th; |
151 | $rh = min $dh, $th; |
150 | } else { |
152 | } else { |
151 | if ($self->{wrap} || $tw < $dw || $th < $dh) { |
153 | if ($self->{wrap} || $tw < $dw || $th < $dh) { |
152 | # scale to the full texture size |
154 | # scale to the full texture size |
153 | ($rw, $rh) = ($tw, $th); |
155 | ($rw, $rh) = ($tw, $th); |
154 | } else { |
156 | } else { |