lib/psd/layer/info.rb in psd-1.4.3 vs lib/psd/layer/info.rb in psd-1.4.4

- old
+ new

@@ -42,56 +42,31 @@ @info_keys << key length = Util.pad2 @file.read_int pos = @file.tell - info_parsed = false + key_parseable = false LAYER_INFO.each do |name, info| next unless info.key == key PSD.logger.debug "Layer Info: key = #{key}, start = #{pos}, length = #{length}" - begin - i = info.new(self, length) - i.parse - - @adjustments[name] = i - info_parsed = true - rescue Exception => e - PSD.logger.error "Parsing error: key = #{key}, message = #{e.message}" - PSD.logger.error e.backtrace.join("\n") - end - - break + i = info.new(self, length) + @adjustments[name] = LazyExecute.new(i, @file).now(:skip).later(:parse) + key_parseable = true and break end - if !info_parsed - PSD.logger.debug "Skipping: layer = #{name}, key = #{key}, pos = #{@file.tell}, length = #{length}" - @file.seek pos + length + unless key_parseable + PSD.logger.debug "Skipping unknown layer info block: key = #{key}, length = #{length}" + @file.seek length, IO::SEEK_CUR end - - if @file.tell != (pos + length) - PSD.logger.warn "Layer info key #{key} ended at #{@file.tell}, expected #{pos + length}" - @file.seek pos + length - end end @extra_data_end = @file.tell end def vector_mask info[:vector_mask_2] || info[:vector_mask] - end - - def export_extra_data(outfile) - outfile.write @file.read(@extra_data_end - @extra_data_begin) - if @path_components && !@path_components.empty? - outfile.seek @vector_mask_begin - @file.seek @vector_mask_begin - - write_vector_mask(outfile) - @file.seek outfile.tell - end end end end end \ No newline at end of file