… | |
… | |
2118 | my $self = $class->SUPER::new ( |
2118 | my $self = $class->SUPER::new ( |
2119 | can_events => 0, |
2119 | can_events => 0, |
2120 | @_, |
2120 | @_, |
2121 | ); |
2121 | ); |
2122 | |
2122 | |
2123 | $self->{path} |
2123 | $self->{path} || $self->{tex} |
2124 | or Carp::croak "required attribute 'path' not set"; |
2124 | or Carp::croak "'path' or 'tex' attributes required"; |
2125 | |
2125 | |
2126 | $self->{tex} = $texture_cache{$self->{path}} ||= |
2126 | $self->{tex} ||= $texture_cache{$self->{path}} ||= |
2127 | new_from_file CFClient::Texture CFClient::find_rcfile $self->{path}, mipmap => 1; |
2127 | new_from_file CFClient::Texture CFClient::find_rcfile $self->{path}, mipmap => 1; |
2128 | |
2128 | |
2129 | Scalar::Util::weaken $texture_cache{$self->{path}}; |
2129 | Scalar::Util::weaken $texture_cache{$self->{path}}; |
2130 | |
2130 | |
2131 | $self->{aspect} ||= $self->{tex}{w} / $self->{tex}{h}; |
2131 | $self->{aspect} ||= $self->{tex}{w} / $self->{tex}{h}; |