89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/micro_cisc/vm/color_lcd_display.rb', line 89
def update_image_data
(0...@w).each do |x|
(0...@h).each do |y|
word_offset = y * @w + x
pixel_offset = word_offset * 3
word = read_mem(@id, word_offset, true)
if (@bit_mode == COLOR_MODE_16BIT)
r = (word & 0x0F00) >> 8
@image_data[pixel_offset] = r + (r >> 5)
g = (word & 0x07E0) >> 3
@image_data[pixel_offset + 1] = g + (g >> 5)
b = (word & 0x001F) << 3
@image_data[pixel_offset + 2] = b + (b >> 5)
elsif (@bit_mode == COLOR_MODE_12BIT)
r = (word & 0x0F00) >> 4
@image_data[pixel_offset] = r + (r >> 4)
g = word & 0x00F0
@image_data[pixel_offset + 1] = g + (g >> 4)
b = (word & 0x000F) << 4
@image_data[pixel_offset + 2] = b + (b >> 4)
end
end
end
end
|