Skip to content

Commit

Permalink
gdk_pixbuf2: improve the default row_stride
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed May 24, 2018
1 parent 7745806 commit 4688d7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gdk_pixbuf2/lib/gdk_pixbuf2/pixbuf.rb
Expand Up @@ -92,7 +92,7 @@ def initialize_with_hash(options)
has_alpha = options[:has_alpha]
has_alpha = false if has_alpha.nil?
bits_per_sample = options[:bits_per_sample] || 8
row_stride = options[:row_stride] || 0
row_stride = options[:row_stride]
data = options[:data]
bytes = options[:bytes]
xpm = options[:xpm]
Expand All @@ -119,9 +119,11 @@ def initialize_with_hash(options)
elsif resource && !scale
initialize_new_from_resource(resource)
elsif data && size
row_stride ||= data.bytesize / height
initialize_new_from_data(data, colorspace, has_alpha, bits_per_sample,
width, height, row_stride)
elsif bytes && size
row_stride ||= bytes.size / height
initialize_new_from_bytes(bytes, colorspace, has_alpha, bits_per_sample,
width, height, row_stride)

Expand Down

0 comments on commit 4688d7c

Please sign in to comment.