Skip to content

Commit

Permalink
fixed a reference mistake of variable in raise message
Browse files Browse the repository at this point in the history
  • Loading branch information
lobin-z0x50 committed Nov 8, 2018
1 parent 02f0b8c commit e362748
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/net/rfb/frame_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,22 @@ def rgba_pixel_data
# @return [Array<Integer>] array of 32bit pixel data
def self.convert_raw_pixel_data_to_rgba(px, pix_fmt)
# see https://github.com/d-theus/vncrec-ruby/blob/master/lib/vncrec/constants.rb
case pix_fmt
case pix_fmt.to_s
when 'bgra'
# convert 32bit BGRA -> 32bit RGBA
px = px.unpack("V*")
px.map! { |p| (p << 8) + 0xff }
px.map! { |p| (p << 8) | 0xff }
when 'bgr8'
# convert 8bit BGR -> 32bit RGBA
px = px.unpack("C*")
px.map! do |p|
r = (p & 0b00000111)
g = (p & 0b00111000) >> 3
b = (p & 0b11000000) >> 6
((r * 36) << 24) + ((g * 36) << 16) + ((b * 85) << 8) + 0xff
((r * 36) << 24) | ((g * 36) << 16) | ((b * 85) << 8) | 0xff
end
else
raise "unsupported pixel format #{@vnc_rec_pix_fmt[:string].inspect}"
raise "unknown pixel format #{pix_fmt.inspect}"
end
end

Expand Down

0 comments on commit e362748

Please sign in to comment.