ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Texture.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Texture.pm (file contents):
Revision 1.23 by root, Tue Jul 24 01:24:27 2007 UTC vs.
Revision 1.24 by root, Sun Jul 29 03:58:26 2007 UTC

39 $self 39 $self
40} 40}
41 41
42sub new_from_image { 42sub new_from_image {
43 my ($class, $image, %arg) = @_; 43 my ($class, $image, %arg) = @_;
44
45 Carp::confess "tried to create texture from undefined image"
46 unless defined $image;
44 47
45 $class->new (image => $image, internalformat => undef, %arg) 48 $class->new (image => $image, internalformat => undef, %arg)
46} 49}
47 50
48sub new_from_file { 51sub new_from_file {
105 ($dw, $dh) = @$self{qw(w h)}; 108 ($dw, $dh) = @$self{qw(w h)};
106 109
107 } elsif (exists $self->{render_cb}) { 110 } elsif (exists $self->{render_cb}) {
108 ($dw, $dh) = @$self{qw(w h)}; 111 ($dw, $dh) = @$self{qw(w h)};
109 112
110 } else { 113 } elsif (exists $self->{image}) {
111 ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type}) 114 ($self->{w}, $self->{h}, $data, my $internalformat, $self->{format}, $self->{type})
112 = CFPlus::load_image_inline $self->{image}; 115 = CFPlus::load_image_inline $self->{image};
113 116
114 $self->{internalformat} ||= $internalformat; 117 $self->{internalformat} ||= $internalformat;
115 ($dw, $dh) = @$self{qw(w h)}; 118 ($dw, $dh) = @$self{qw(w h)};
119 } else {
120 Carp::confess "tried to create texture that is not data, render or image";
116 } 121 }
117 122
118 my ($tw, $th) = ($dw, $dh); 123 my ($tw, $th) = ($dw, $dh);
119 124
120 defined $data or $self->{render_cb} or die; # some sanity check 125 defined $data or $self->{render_cb} or die; # some sanity check

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines