lib/psd/layer/info.rb in psd-3.3.3 vs lib/psd/layer/info.rb in psd-3.4.0

- old
+ new

@@ -49,19 +49,29 @@ vector_stroke: VectorStroke, vector_stroke_content: VectorStrokeContent, gradient_fill: GradientFill }.freeze + BIG_LAYER_INFO_KEYS = %w{ LMsk Lr16 Lr32 Layr Mt16 Mt32 Mtrn Alph FMsk lnk2 FEid FXid PxSD } + attr_reader :adjustments alias :info :adjustments LAYER_INFO.keys.each do |key| define_method(key) { @adjustments[key] } end private + def parse_additional_layer_info_length(key) + if @header.big? && BIG_LAYER_INFO_KEYS.include?(key) + Util.pad2 @file.read_longlong + else + Util.pad2 @file.read_int + end + end + # This section is a bit tricky to parse because it represents all of the # extra data that describes this layer. def parse_layer_info @extra_data_begin = @file.tell @@ -71,10 +81,10 @@ # Key, very important key = @file.read_string(4) @info_keys << key - length = Util.pad2 @file.read_int + length = parse_additional_layer_info_length(key) pos = @file.tell key_parseable = false LAYER_INFO.each do |name, info| next unless info.should_parse?(key)