few more accessors
PATCH 1/1 few more accessors
This patch introduces few more DisplayState accessors in hw/sm501.c.
Added the declaration of ds_get_bytes_per_pixel that was missing last time.
Signed-off-by Stefano Stabellini <[email protected]>
console.h +5 -0
@@ -139,6 +139,11 @@return ds->depth; } +static inline int ds_get_bytes_per_pixel (DisplayState *ds) +{ +return (ds->depth /8 ); +} +typedef unsigned long console_ch_t ;static inline void console_write_ch (console_ch_t *dest,uint32_t ch) {
hw/sm501.c +3 -3
@@ -940,7 +940,7 @@static inline int get_depth_index (DisplayState *s) { -switch (s->depth) { +switch (ds_get_bits_per_pixel (s)) {default :case 8 :return 0 ;
@@ -970,7 +970,7 @@uint8_t * src = s->local_mem;int src_bpp =0 ; -int dst_bpp = s->ds->depth /8 + (s->ds->depth %8 ?1 :0 ); +int dst_bpp =ds_get_bytes_per_pixel (s->ds) + (ds_get_bits_per_pixel (s->ds) %8 ?1 :0 );uint32_t * palette = (uint32_t *)&s->dc_palette[SM501_DC_CRT_PALETTE -SM501_DC_PANEL_PALETTE ];int ds_depth_index =get_depth_index (s->ds);
@@ -1024,7 +1024,7 @@/* draw line and change status */ if (update) { -draw_line (&s->ds->data[y * width * dst_bpp], src, width, palette); +draw_line (&(ds_get_data (s->ds)[y * width * dst_bpp]), src, width, palette);if (y_start <0 ) y_start = y;if (page0 < page_min)