Whitespace cleanup on fb_viewport Rewrite

Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
This commit is contained in:
William Wilgus 2020-10-26 12:38:22 -04:00
parent 3237ae4a4f
commit 40e98a2e49
26 changed files with 348 additions and 348 deletions

View File

@ -64,13 +64,13 @@ enum
};
/* This is a table of semitone percentage values of the appropriate
/* This is a table of semitone percentage values of the appropriate
precision (based on PITCH_SPEED_PRECISION). Note that these are
all constant expressions, which will be evaluated at compile time,
so no need to worry about how complex the expressions look.
so no need to worry about how complex the expressions look.
That's just to get the precision right.
I calculated these values, starting from 50, as
I calculated these values, starting from 50, as
x(n) = 50 * 2^(n/12)
@ -81,7 +81,7 @@ enum
*/
#define TO_INT_WITH_PRECISION(x) \
( (unsigned short)(((x) * PITCH_SPEED_PRECISION * 10 + 5) / 10) )
static const unsigned short semitone_table[] =
{
TO_INT_WITH_PRECISION(50.00000000), /* Octave lower */
@ -115,12 +115,12 @@ static const unsigned short semitone_table[] =
#define SEMITONE_END (NUM_SEMITONES/2)
#define SEMITONE_START (-SEMITONE_END)
/* A table of values for approximating the cent curve with
/* A table of values for approximating the cent curve with
linear interpolation. Multipy the next lowest semitone
by this much to find the corresponding cent percentage.
These values were calculated as
x(n) = 100 * 2^(n * 20/1200)
by this much to find the corresponding cent percentage.
These values were calculated as
x(n) = 100 * 2^(n * 20/1200)
*/
static const unsigned short cent_interp[] =
@ -308,16 +308,16 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
{
snprintf(buf, sizeof(buf), "%s: %s%d.%02d", str(LANG_PITCH),
semitone >= 0 ? "+" : "-",
abs(semitone / PITCH_SPEED_PRECISION),
abs((semitone % PITCH_SPEED_PRECISION) /
abs(semitone / PITCH_SPEED_PRECISION),
abs((semitone % PITCH_SPEED_PRECISION) /
(PITCH_SPEED_PRECISION / 100))
);
}
else
{
snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_PITCH),
pitch / PITCH_SPEED_PRECISION,
(pitch % PITCH_SPEED_PRECISION) /
pitch / PITCH_SPEED_PRECISION,
(pitch % PITCH_SPEED_PRECISION) /
(PITCH_SPEED_PRECISION / 10));
}
}
@ -337,8 +337,8 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
/* "Speed:XXX%" */
if(global_settings.pitch_mode_timestretch)
{
snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED),
speed / PITCH_SPEED_PRECISION,
snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED),
speed / PITCH_SPEED_PRECISION,
(speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10));
}
else
@ -347,23 +347,23 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
{
snprintf(buf, sizeof(buf), "%s%d.%02d",
semitone >= 0 ? "+" : "-",
abs(semitone / PITCH_SPEED_PRECISION),
abs((semitone % PITCH_SPEED_PRECISION) /
abs(semitone / PITCH_SPEED_PRECISION),
abs((semitone % PITCH_SPEED_PRECISION) /
(PITCH_SPEED_PRECISION / 100))
);
}
else
{
snprintf(buf, sizeof(buf), "%ld.%ld%%",
pitch / PITCH_SPEED_PRECISION,
pitch / PITCH_SPEED_PRECISION,
(pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10));
}
}
display->getstringsize(buf, &w, &h);
display->putsxy((pitch_viewports[PITCH_MID].width / 2) - (w / 2),
show_lang_pitch ? (pitch_viewports[PITCH_MID].height / 2) :
(pitch_viewports[PITCH_MID].height / 2) - (h / 2),
show_lang_pitch ? (pitch_viewports[PITCH_MID].height / 2) :
(pitch_viewports[PITCH_MID].height / 2) - (h / 2),
buf);
if (w > width_used)
width_used = w;
@ -401,8 +401,8 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
{
display->putsxy(0, (pitch_viewports[PITCH_MID].height / 2) - (h / 2),
leftlabel);
display->putsxy((pitch_viewports[PITCH_MID].width - w),
(pitch_viewports[PITCH_MID].height / 2) - (h / 2),
display->putsxy((pitch_viewports[PITCH_MID].width - w),
(pitch_viewports[PITCH_MID].height / 2) - (h / 2),
rightlabel);
}
display->update_viewport();
@ -421,7 +421,7 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut
if (pitch_delta < 0)
{
/* for large jumps, snap up to whole numbers */
if(allow_cutoff && pitch_delta <= -PITCH_SPEED_PRECISION &&
if(allow_cutoff && pitch_delta <= -PITCH_SPEED_PRECISION &&
(pitch + pitch_delta) % PITCH_SPEED_PRECISION != 0)
{
pitch_delta += PITCH_SPEED_PRECISION - ((pitch + pitch_delta) % PITCH_SPEED_PRECISION);
@ -442,7 +442,7 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut
else if (pitch_delta > 0)
{
/* for large jumps, snap down to whole numbers */
if(allow_cutoff && pitch_delta >= PITCH_SPEED_PRECISION &&
if(allow_cutoff && pitch_delta >= PITCH_SPEED_PRECISION &&
(pitch + pitch_delta) % PITCH_SPEED_PRECISION != 0)
{
pitch_delta -= (pitch + pitch_delta) % PITCH_SPEED_PRECISION;
@ -480,7 +480,7 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut
new_pitch = GET_PITCH(speed, STRETCH_MAX);
}
if(new_stretch >= STRETCH_MAX ||
if(new_stretch >= STRETCH_MAX ||
new_stretch <= STRETCH_MIN)
{
at_limit = true;
@ -505,7 +505,7 @@ static int32_t get_semitone_from_pitch(int32_t pitch)
/* now find the fractional part */
while(pitch > (cent_interp[fractional_index + 1] *
while(pitch > (cent_interp[fractional_index + 1] *
semitone_table[semitone] / PITCH_SPEED_100))
{
/* Check to make sure fractional_index isn't too big */
@ -517,17 +517,17 @@ static int32_t get_semitone_from_pitch(int32_t pitch)
fractional_index++;
}
int32_t semitone_pitch_a = cent_interp[fractional_index] *
int32_t semitone_pitch_a = cent_interp[fractional_index] *
semitone_table[semitone] /
PITCH_SPEED_100;
int32_t semitone_pitch_b = cent_interp[fractional_index + 1] *
int32_t semitone_pitch_b = cent_interp[fractional_index + 1] *
semitone_table[semitone] /
PITCH_SPEED_100;
/* this will be the integer offset from the cent_interp entry */
int32_t semitone_frac_ofs = (pitch - semitone_pitch_a) * CENT_INTERP_INTERVAL /
(semitone_pitch_b - semitone_pitch_a);
semitone = (semitone + SEMITONE_START) * PITCH_SPEED_PRECISION +
fractional_index * CENT_INTERP_INTERVAL +
semitone = (semitone + SEMITONE_START) * PITCH_SPEED_PRECISION +
fractional_index * CENT_INTERP_INTERVAL +
semitone_frac_ofs;
return semitone;
@ -543,14 +543,14 @@ static int32_t get_pitch_from_semitone(int32_t semitone)
/* set pitch to the semitone's integer part value */
int32_t pitch = semitone_table[semitone_index];
/* get the range of the cent modification for future calculation */
int32_t pitch_mod_a =
cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) /
int32_t pitch_mod_a =
cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) /
CENT_INTERP_INTERVAL];
int32_t pitch_mod_b =
cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) /
int32_t pitch_mod_b =
cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) /
CENT_INTERP_INTERVAL + 1];
/* figure out the cent mod amount based on the semitone fractional value */
int32_t pitch_mod = pitch_mod_a + (pitch_mod_b - pitch_mod_a) *
int32_t pitch_mod = pitch_mod_a + (pitch_mod_b - pitch_mod_a) *
(adjusted_semitone % CENT_INTERP_INTERVAL) / CENT_INTERP_INTERVAL;
/* modify pitch based on the mod amount we just calculated */
@ -558,7 +558,7 @@ static int32_t get_pitch_from_semitone(int32_t semitone)
}
static int32_t pitch_increase_semitone(int32_t pitch,
int32_t current_semitone,
int32_t current_semitone,
int32_t semitone_delta
, int32_t speed
)
@ -618,7 +618,7 @@ static int32_t pitch_increase_semitone(int32_t pitch,
#ifdef HAVE_TOUCHSCREEN
/*
* Check for touchscreen presses as per sketch above in this file
*
*
* goes through each row of the, checks whether the touchscreen
* was pressed in it. Then it looks the columns of each row for specific actions
*/
@ -638,7 +638,7 @@ static int pitchscreen_do_touchscreen(struct viewport vps[])
if ((x < column || x > (2*column)) && (ret == BUTTON_REL))
return ACTION_PS_TOGGLE_MODE;
else if (x >= column && x <= (2*column))
{ /* center column pressed */
if (ret == BUTTON_REPEAT)
@ -828,7 +828,7 @@ int gui_syncpitchscreen_run(void)
updated = 0;
button = get_action(CONTEXT_PITCHSCREEN, HZ);
#ifdef HAVE_TOUCHSCREEN
if (button == ACTION_TOUCHSCREEN)
{
@ -841,7 +841,7 @@ int gui_syncpitchscreen_run(void)
case ACTION_PS_INC_SMALL:
if(global_settings.pitch_mode_semitone)
pitch_delta = SEMITONE_SMALL_DELTA;
else
else
pitch_delta = PITCH_SMALL_DELTA;
updated = 1;
break;
@ -849,7 +849,7 @@ int gui_syncpitchscreen_run(void)
case ACTION_PS_INC_BIG:
if(global_settings.pitch_mode_semitone)
pitch_delta = SEMITONE_BIG_DELTA;
else
else
pitch_delta = PITCH_BIG_DELTA;
updated = 1;
break;
@ -857,7 +857,7 @@ int gui_syncpitchscreen_run(void)
case ACTION_PS_DEC_SMALL:
if(global_settings.pitch_mode_semitone)
pitch_delta = -SEMITONE_SMALL_DELTA;
else
else
pitch_delta = -PITCH_SMALL_DELTA;
updated = 1;
break;
@ -865,7 +865,7 @@ int gui_syncpitchscreen_run(void)
case ACTION_PS_DEC_BIG:
if(global_settings.pitch_mode_semitone)
pitch_delta = -SEMITONE_BIG_DELTA;
else
else
pitch_delta = -PITCH_BIG_DELTA;
updated = 1;
break;
@ -1045,7 +1045,7 @@ int gui_syncpitchscreen_run(void)
}
new_stretch = GET_STRETCH(pitch, new_speed);
if(new_stretch >= STRETCH_MAX ||
if(new_stretch >= STRETCH_MAX ||
new_stretch <= STRETCH_MIN)
{
at_limit = true;

View File

@ -80,14 +80,14 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen,
unsigned int update_type)
{
struct gui_wps *gwps = skin_get_gwps(skin, screen);
/* This maybe shouldnt be here,
/* This maybe shouldnt be here,
* This is also safe for skined screen which dont use the id3 */
struct mp3entry *id3 = skin_get_global_state()->id3;
bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false);
if (cuesheet_update)
skin_request_full_update(skin);
skin_render(gwps, skin_do_full_update(skin, screen) ?
skin_render(gwps, skin_do_full_update(skin, screen) ?
SKIN_REFRESH_ALL : update_type);
}
@ -96,7 +96,7 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen,
#define DIRECTION_RIGHT 1
#define DIRECTION_LEFT -1
static int ab_calc_mark_x_pos(int mark, int capacity,
static int ab_calc_mark_x_pos(int mark, int capacity,
int offset, int size)
{
return offset + ( (size * mark) / capacity );
@ -124,7 +124,7 @@ static void ab_draw_arrow_mark(struct screen * screen,
}
}
void ab_draw_markers(struct screen * screen, int capacity,
void ab_draw_markers(struct screen * screen, int capacity,
int x, int y, int w, int h)
{
bool a_set, b_set;
@ -245,13 +245,13 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb)
length = 1;
end = 0;
}
if (!pb->horizontal)
{
/* we want to fill upwards which is technically inverted. */
flags = INVERTFILL;
}
if (pb->invert_fill_direction)
{
flags ^= INVERTFILL;
@ -421,7 +421,7 @@ void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
/* Evaluate the conditional that is at *token_index and return whether a skip
has ocurred. *token_index is updated with the new position.
*/
int evaluate_conditional(struct gui_wps *gwps, int offset,
int evaluate_conditional(struct gui_wps *gwps, int offset,
struct conditional *conditional, int num_options)
{
if (!gwps)
@ -641,7 +641,7 @@ bool skin_has_sbs(enum screen_type screen, struct wps_data *data)
}
/* do the button loop as often as required for the peak meters to update
* with a good refresh rate.
* with a good refresh rate.
*/
int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout)
{

View File

@ -60,17 +60,17 @@ struct skin_draw_info {
int line_number;
unsigned long refresh_type;
struct line_desc line_desc;
char* cur_align_start;
struct align_pos align;
bool no_line_break;
bool line_scrolls;
bool force_redraw;
bool viewport_change;
char *buf;
size_t buf_size;
int offset; /* used by the playlist viewer */
};
@ -102,7 +102,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
bool do_refresh = (element->tag->flags & info->refresh_type) > 0;
switch (token->type)
{
{
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
case SKIN_TOKEN_VIEWPORT_FGCOLOUR:
{
@ -161,7 +161,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
while (viewport)
{
struct skin_viewport *skinvp = SKINOFFSETTOPTR(skin_buffer, viewport->data);
char *vplabel = SKINOFFSETTOPTR(skin_buffer, skinvp->label);
if (skinvp->label == VP_DEFAULT_LABEL)
vplabel = VP_DEFAULT_LABEL_STRING;
@ -171,7 +171,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info,
if (skinvp->hidden_flags&VP_DRAW_HIDDEN)
{
temp |= VP_DRAW_WASHIDDEN;
}
}
skinvp->hidden_flags = temp;
}
viewport = SKINOFFSETTOPTR(skin_buffer, viewport->next);
@ -351,7 +351,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch,
struct wps_data *data = gwps->data;
struct viewport *last_vp;
/* Tags here are ones which need to be "turned off" or cleared
/* Tags here are ones which need to be "turned off" or cleared
* if they are in a conditional branch which isnt being used */
if (branch->type == LINE_ALTERNATOR)
{
@ -387,7 +387,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch,
if (token->type == SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY)
{
struct image_display *id = SKINOFFSETTOPTR(skin_buffer, token->value.data);
struct gui_img *img = skin_find_item(SKINOFFSETTOPTR(skin_buffer, id->label),
struct gui_img *img = skin_find_item(SKINOFFSETTOPTR(skin_buffer, id->label),
SKIN_FIND_IMAGE, data);
clear_image_pos(gwps, img);
}
@ -455,7 +455,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch,
}
}
}
static void fix_line_alignment(struct skin_draw_info *info, struct skin_element *element)
{
struct align_pos *align = &info->align;
@ -497,16 +497,16 @@ static void fix_line_alignment(struct skin_draw_info *info, struct skin_element
break;
}
}
/* Draw a LINE element onto the display */
static bool skin_render_line(struct skin_element* line, struct skin_draw_info *info)
{
bool needs_update = false;
int last_value, value;
if (line->children_count == 0)
return false; /* empty line, do nothing */
struct skin_element *child = get_child(line->children, 0);
struct conditional *conditional;
skin_render_func func = skin_render_line;
@ -518,14 +518,14 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
case CONDITIONAL:
conditional = SKINOFFSETTOPTR(skin_buffer, child->data);
last_value = conditional->last_value;
value = evaluate_conditional(info->gwps, info->offset,
value = evaluate_conditional(info->gwps, info->offset,
conditional, child->children_count);
conditional->last_value = value;
if (child->children_count == 1)
{
/* special handling so
/* special handling so
* %?aa<true> and %?<true|false> need special handlng here */
if (value == -1) /* tag is false */
{
/* we are in a false branch of a %?aa<true> conditional */
@ -545,18 +545,18 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
}
else if (get_child(child->children, value)->type == LINE)
func = skin_render_line;
if (value != last_value)
{
info->refresh_type = SKIN_REFRESH_ALL;
info->force_redraw = true;
}
if (func(get_child(child->children, value), info))
needs_update = true;
else
needs_update = needs_update || (last_value != value);
info->refresh_type = old_refresh_mode;
break;
case TAG:
@ -564,9 +564,9 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
info->no_line_break = true;
if (child->tag->type == SKIN_TOKEN_SUBLINE_SCROLL)
info->line_scrolls = true;
fix_line_alignment(info, child);
if (!SKINOFFSETTOPTR(skin_buffer, child->data))
{
break;
@ -583,17 +583,17 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i
if (child->tag->flags&SKIN_RTC_REFRESH)
needs_update = needs_update || info->refresh_type&SKIN_REFRESH_DYNAMIC;
#endif
needs_update = needs_update ||
needs_update = needs_update ||
((child->tag->flags&info->refresh_type)!=0);
strlcat(info->cur_align_start, valuestr,
strlcat(info->cur_align_start, valuestr,
info->buf_size - (info->cur_align_start-info->buf));
}
}
break;
case TEXT:
strlcat(info->cur_align_start, SKINOFFSETTOPTR(skin_buffer, child->data),
strlcat(info->cur_align_start, SKINOFFSETTOPTR(skin_buffer, child->data),
info->buf_size - (info->cur_align_start-info->buf));
needs_update = needs_update ||
needs_update = needs_update ||
(info->refresh_type&SKIN_REFRESH_STATIC) != 0;
break;
case COMMENT:
@ -664,7 +664,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
int try_line = start;
bool suitable = false;
int rettimeout = DEFAULT_SUBLINE_TIME_MULTIPLIER*TIMEOUT_UNIT;
/* find a subline which has at least one token in it,
* and that line doesnt have a timeout set to 0 through conditionals */
do {
@ -674,7 +674,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
if (get_child(element->children, try_line)->children_count != 0)
{
current_line = get_child(element->children, try_line);
rettimeout = get_subline_timeout(info->gwps,
rettimeout = get_subline_timeout(info->gwps,
get_child(current_line->children, 0));
if (rettimeout > 0)
{
@ -683,7 +683,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info
}
}
while (try_line != start && !suitable);
if (suitable)
{
alternator->current_line = try_line;
@ -749,14 +749,14 @@ void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
if (++info.line_desc.line > info.line_desc.nlines)
info.line_desc.style = STYLE_DEFAULT;
}
#endif
#endif
#endif
info.cur_align_start = info.buf;
align->left = info.buf;
align->center = NULL;
align->right = NULL;
if (line->type == LINE_ALTERNATOR)
func = skin_render_alternator;
else if (line->type == LINE)
@ -798,11 +798,11 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
const int vp_is_appearing = (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE);
struct wps_data *data = gwps->data;
struct screen *display = gwps->display;
struct skin_element* viewport;
struct skin_viewport* skin_viewport;
char *label;
int old_refresh_mode = refresh_mode;
skin_buffer = get_skin_buffer(gwps->data);
@ -828,7 +828,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
if (label && SKINOFFSETTOPTR(skin_buffer, viewport->next) &&
!strcmp(label,VP_DEFAULT_LABEL_STRING))
refresh_mode = 0;
for (viewport = SKINOFFSETTOPTR(skin_buffer, data->tree);
viewport;
viewport = SKINOFFSETTOPTR(skin_buffer, viewport->next))
@ -848,7 +848,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
skin_backdrop_show(data->backdrop_id);
}
#endif
/* dont redraw the viewport if its disabled */
if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE)
{ /* don't draw anything into this one */
@ -864,7 +864,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
vp_refresh_mode = SKIN_REFRESH_ALL;
skin_viewport->hidden_flags = VP_DRAW_HIDEABLE;
}
display->set_viewport_ex(&skin_viewport->vp, VP_FLAG_VP_SET_CLEAN);
if ((vp_refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL)
@ -929,17 +929,17 @@ void skin_render_playlistviewer(struct playlistviewer* viewer,
else
#endif
{
struct cuesheet *cue = skin_get_global_state()->id3 ?
struct cuesheet *cue = skin_get_global_state()->id3 ?
skin_get_global_state()->id3->cuesheet : NULL;
cur_pos = playlist_get_display_index();
max = playlist_amount()+1;
if (cue)
max += cue->track_count;
start_item = MAX(0, cur_pos + viewer->start_offset);
start_item = MAX(0, cur_pos + viewer->start_offset);
}
if (max-start_item > nb_lines)
max = start_item + nb_lines;
line = SKINOFFSETTOPTR(skin_buffer, viewer->line);
while (start_item < max)
{
@ -947,20 +947,20 @@ void skin_render_playlistviewer(struct playlistviewer* viewer,
info.no_line_break = false;
info.line_scrolls = false;
info.force_redraw = false;
info.cur_align_start = info.buf;
align->left = info.buf;
align->center = NULL;
align->right = NULL;
if (line->type == LINE_ALTERNATOR)
func = skin_render_alternator;
else if (line->type == LINE)
func = skin_render_line;
needs_update = func(line, &info);
/* only update if the line needs to be, and there is something to write */
if (refresh_type && needs_update)
{

View File

@ -21,7 +21,7 @@
/* This stuff is for the wps engine only.. anyone caught using this outside
* of apps/gui/wps_engine will be shot on site! */
#ifndef _WPS_ENGINE_INTERNALS_
#define _WPS_ENGINE_INTERNALS_
@ -114,9 +114,9 @@ struct progressbar {
short width;
short height;
bool follow_lang_direction;
OFFSETTYPE(struct gui_img *) image;
bool invert_fill_direction;
bool nofill;
bool noborder;
@ -125,7 +125,7 @@ struct progressbar {
bool horizontal;
OFFSETTYPE(struct gui_img *) backdrop;
int setting_id; /* for the setting bar type */
};
struct draw_rectangle {
@ -207,7 +207,7 @@ struct touchregion {
PRESS, /* quick press only */
LONG_PRESS, /* Long press without repeat */
REPEAT, /* long press allowing repeats */
} press_length;
} press_length;
int action; /* action this button will return */
bool armed; /* A region is armed on press. Only armed regions are triggered
on repeat or release. */
@ -264,12 +264,12 @@ struct skin_albumart {
unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
OFFSETTYPE(struct viewport *) vp;
int draw_handle;
};
#endif
struct line {
unsigned update_mode;

View File

@ -120,7 +120,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap)
vp.y += (vp.height - height) / 2;
vp.width = width;
vp.height = height;
vp.flags |= VP_FLAG_ALIGN_CENTER;
#if LCD_DEPTH > 1
if (screen->depth > 1)

View File

@ -207,7 +207,7 @@ void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw)
int top = --theme_stack_top[screen];
if (top < 0)
panicf("Stack underflow... viewportmanager");
toggle_theme(screen, force_redraw);
}

View File

@ -55,7 +55,7 @@ void viewportmanager_init(void) INIT_ATTR;
void viewportmanager_theme_enable(enum screen_type screen, bool enable,
struct viewport *viewport);
/* Force will cause a redraw even if the theme was previously and
/* Force will cause a redraw even if the theme was previously and
* currently enabled (i,e the undo doing nothing).
* Should almost always be set to false except coming out of fully skinned screens */
void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw);

View File

@ -34,7 +34,7 @@ struct gui_yesno
{
const struct text_message * main_message;
const struct text_message * result_message[2];
struct viewport *vp;
struct screen * display;
};
@ -63,12 +63,12 @@ static int put_message(struct screen *display,
int i;
for(i=0; i<message->nb_lines && i+start<max_y; i++)
{
display->puts_scroll(0, i+start,
display->puts_scroll(0, i+start,
P2STR((unsigned char *)message->message_lines[i]));
}
return i;
}
/*
* Draws the yesno
* - yn : the yesno structure
@ -87,7 +87,7 @@ static void gui_yesno_draw(struct gui_yesno * yn)
if(nb_lines+3< vp_lines)
line_shift=1;
line_shift += put_message(display, yn->main_message,
line_shift, vp_lines);
#ifdef HAVE_TOUCHSCREEN
@ -216,7 +216,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
if (global_settings.talk_menu)
{
talk_text_message((result == YESNO_YES) ? yes_message
talk_text_message((result == YESNO_YES) ? yes_message
: no_message, false);
talk_force_enqueue_next();
}

View File

@ -356,10 +356,10 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
fb_data *dst;
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clipping */
if (x < 0)
{
@ -426,10 +426,10 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
fb_data *dst;
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clipping */
if (x < 0)
{

View File

@ -74,7 +74,7 @@ void xlcd_scroll_right(int count)
length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
rb->memmove(lcd_fb + LCD_HEIGHT*count,
rb->memmove(lcd_fb + LCD_HEIGHT*count,
lcd_fb, length * sizeof(fb_data));
oldmode = rb->lcd_get_drawmode();
@ -92,7 +92,7 @@ void xlcd_scroll_up(int count)
int width, length, oldmode;
fb_data *data;
if ((unsigned)count >= LCD_HEIGHT)
@ -102,10 +102,10 @@ void xlcd_scroll_up(int count)
}
length = LCD_HEIGHT - count;
width = LCD_WIDTH-1;
data = lcd_fb;
do {
rb->memmove(data,data + count,length * sizeof(fb_data));
data += LCD_HEIGHT;
@ -126,7 +126,7 @@ void xlcd_scroll_down(int count)
int width, length, oldmode;
fb_data *data;
if ((unsigned)count >= LCD_HEIGHT)
@ -139,7 +139,7 @@ void xlcd_scroll_down(int count)
width = LCD_WIDTH-1;
data = lcd_fb;
do {
rb->memmove(data + count, data, length * sizeof(fb_data));
data += LCD_HEIGHT;
@ -408,7 +408,7 @@ void xlcd_scroll_down(int count)
rb->lcd_set_drawmode(oldmode);
}
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING,
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING,
LCD_PIXELFORMAT == VERTICAL_INTERLEAVED */
/* Scroll up */
@ -426,7 +426,7 @@ void xlcd_scroll_up(int count)
rb->lcd_clear_display();
return;
}
#if (LCD_DEPTH == 1) \
|| (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
blockcount = count >> 3;
@ -554,7 +554,7 @@ void xlcd_scroll_down(int count)
rb->lcd_clear_display();
return;
}
#if (LCD_DEPTH == 1) \
|| (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
blockcount = count >> 3;
@ -638,7 +638,7 @@ void xlcd_scroll_down(int count)
int x, by;
fb_data *addr = lcd_fb + blockcount * LCD_FBWIDTH;
unsigned fill, mask;
fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount);
mask = (0xFFu >> bitcount) << bitcount;
mask |= mask << 8;

View File

@ -1400,7 +1400,7 @@ RB_WRAP(lcd_setfont)
static void checkint_arr(lua_State *L, int *val, int narg, int elems)
{
/* fills passed array of integers with lua integers from stack */
for (int i = 0; i < elems; i++)
for (int i = 0; i < elems; i++)
val[i] = luaL_checkint(L, narg + i);
}
@ -1538,7 +1538,7 @@ RB_WRAP(lcd_bitmap_transparent_part)
int v[eCNT];
checkint_arr(L, v, 2, eCNT);
RB_SCREENS(L, 9, transparent_bitmap_part, src->data,
RB_SCREENS(L, 9, transparent_bitmap_part, src->data,
v[src_x], v[src_y], v[stride], v[x], v[y], v[w], v[h]);
return 0;
}

View File

@ -236,7 +236,7 @@ struct screen screens[NB_SCREENS] =
.backdrop_load=&backdrop_load,
.backdrop_show=&backdrop_show,
#endif
#if defined(HAVE_LCD_COLOR)
#if defined(HAVE_LCD_COLOR)
.gradient_fillrect = lcd_gradient_fillrect,
.gradient_fillrect_part = lcd_gradient_fillrect_part,
#endif

View File

@ -130,7 +130,7 @@ struct screen
bool (*backdrop_load)(const char *filename, char* backdrop_buffer);
void (*backdrop_show)(char* backdrop_buffer);
#endif
#if defined(HAVE_LCD_COLOR)
#if defined(HAVE_LCD_COLOR)
void (*gradient_fillrect)(int x, int y, int width, int height,
unsigned start, unsigned end);
void (*gradient_fillrect_part)(int x, int y, int width, int height,

View File

@ -367,7 +367,7 @@ static const int id3_headers[]=
{
LANG_ID3_TITLE,
LANG_ID3_ARTIST,
LANG_ID3_COMPOSER,
LANG_ID3_COMPOSER,
LANG_ID3_ALBUM,
LANG_ID3_ALBUMARTIST,
LANG_ID3_GROUPING,
@ -766,7 +766,7 @@ int view_runtime(void)
while(1)
{
global_status.runtime += ((current_tick - lasttime) / HZ);
lasttime = current_tick;
if (say_runtime)
{
@ -841,13 +841,13 @@ int calibrate(void)
enum touchscreen_mode old_mode = touchscreen_get_mode();
struct touchscreen_calibration cal;
int i, ret = 0;
/* hide the statusbar */
viewportmanager_theme_enable(SCREEN_MAIN, false, NULL);
touchscreen_disable_mapping(); /* set raw mode */
touchscreen_set_mode(TOUCHSCREEN_POINT);
for(i=0; i<3; i++)
{
screen->clear_display();

View File

@ -145,7 +145,7 @@ int load_raw_firmware(unsigned char* buf, char* firmware, int buffer_size)
}
len = filesize(fd);
if (len > buffer_size)
return EFILE_TOO_BIG;
@ -180,11 +180,11 @@ void display_logf(void) /* Doesn't return! */
int touch, prev_y=0;
#endif
char buffer[COLUMNS+1];
while(1)
{
index = logfindex + user_index;
lcd_clear_display();
for(i = LINES-1; i>=0; i--)
{
@ -195,19 +195,19 @@ void display_logf(void) /* Doesn't return! */
else
break; /* done */
}
memcpy(buffer, logfbuffer[index], COLUMNS);
if (logfbuffer[index][MAX_LOGF_ENTRY] == LOGF_TERMINATE_CONTINUE_LINE)
buffer[MAX_LOGF_ENTRY-1] = '>';
else if (logfbuffer[index][MAX_LOGF_ENTRY] == LOGF_TERMINATE_MULTI_LINE)
buffer[MAX_LOGF_ENTRY-1] = '\0';
buffer[COLUMNS] = '\0';
lcd_puts(0, i, buffer);
}
button = button_get(false);
if(button == SYS_USB_CONNECTED)
usb_acknowledge(SYS_USB_CONNECTED_ACK);
@ -223,16 +223,16 @@ void display_logf(void) /* Doesn't return! */
else if(button & BUTTON_TOUCHSCREEN)
{
touch = button_get_data();
if(button & BUTTON_REL)
prev_y = 0;
if(prev_y != 0)
user_index += (prev_y - (touch & 0xFFFF)) / SYSFONT_HEIGHT;
prev_y = touch & 0xFFFF;
}
#endif
lcd_update();
sleep(HZ/16);
}

View File

@ -84,19 +84,19 @@ void lcd_hline(int x1, int x2, int y)
x1 = 0;
if (x2 >= lcd_current_viewport->width)
x2 = lcd_current_viewport->width-1;
/* Adjust x1 and y to viewport */
x1 += lcd_current_viewport->x;
x2 += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -143,19 +143,19 @@ void lcd_vline(int x, int y1, int y2)
y1 = 0;
if (y2 >= lcd_current_viewport->height)
y2 = lcd_current_viewport->height-1;
/* adjust for viewport */
x += lcd_current_viewport->x;
y1 += lcd_current_viewport->y;
y2 += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
@ -224,7 +224,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -237,23 +237,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
src_y -= y;
y = 0;
}
if (x + width > lcd_current_viewport->width)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -294,13 +294,13 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
{
fb_data *dst, *dst_end;
int stride_dst;
/******************** Image in viewport clipping **********************/
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -313,23 +313,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
src_y -= y;
y = 0;
}
if (x + width > lcd_current_viewport->width)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{

View File

@ -74,11 +74,11 @@ void lcd_hline(int x1, int x2, int y)
/******************** In viewport clipping **********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) ||
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) ||
(x1 >= lcd_current_viewport->width) ||
(x2 < 0))
return;
if (x1 < 0)
x1 = 0;
if (x2 >= lcd_current_viewport->width)
@ -88,14 +88,14 @@ void lcd_hline(int x1, int x2, int y)
x1 += lcd_current_viewport->x;
x2 += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -179,19 +179,19 @@ void lcd_vline(int x, int y1, int y2)
y1 = 0;
if (y2 >= lcd_current_viewport->height)
y2 = lcd_current_viewport->height-1;
/* adjust for viewport */
x += lcd_current_viewport->x;
y1 += lcd_current_viewport->y;
y2 += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
@ -224,7 +224,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -237,23 +237,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
src_y -= y;
y = 0;
}
if (x + width > lcd_current_viewport->width)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -272,7 +272,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
#endif
src += stride * src_y + src_x; /* move starting point */
dst = FBADDR(x, y);
stride_dst = lcd_current_viewport->buffer->stride;
@ -300,7 +300,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -313,23 +313,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
src_y -= y;
y = 0;
}
if (x + width > lcd_current_viewport->width)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{

View File

@ -219,7 +219,7 @@ static void ICODE_ATTR solidinvblock(FBFN(data) *address, unsigned mask,
unsigned bits)
{
unsigned data = *(char *)address;
bits = ~bits ^ data;
*address = data ^ (bits & mask);
}
@ -255,7 +255,7 @@ void LCDFN(clear_viewport)(void)
oldmode = CURRENT_VP->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) |
CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height);
@ -271,7 +271,7 @@ void LCDFN(clear_viewport)(void)
/* Set a single pixel */
void LCDFN(drawpixel)(int x, int y)
{
if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
&& ((unsigned)y < (unsigned)CURRENT_VP->height)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCDM(WIDTH))
@ -385,30 +385,30 @@ void LCDFN(hline)(int x1, int x2, int y)
x1 = x2;
x2 = x;
}
/******************** In viewport clipping **********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width)
|| (x2 < 0))
return;
return;
if (x1 < 0)
x1 = 0;
if (x2 >= CURRENT_VP->width)
x2 = CURRENT_VP->width-1;
/* adjust to viewport */
x1 += CURRENT_VP->x;
x2 += CURRENT_VP->x;
y += CURRENT_VP->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH))
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -449,25 +449,25 @@ void LCDFN(vline)(int x, int y1, int y2)
/* nothing to draw? */
if (((unsigned)x >= (unsigned)CURRENT_VP->width) || (y1 >= CURRENT_VP->height)
|| (y2 < 0))
return;
return;
if (y1 < 0)
y1 = 0;
if (y2 >= CURRENT_VP->height)
y2 = CURRENT_VP->height-1;
/* adjust for viewport */
y1 += CURRENT_VP->y;
y2 += CURRENT_VP->y;
x += CURRENT_VP->x;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT))
if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT))
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
@ -538,18 +538,18 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
width = CURRENT_VP->width - x;
if (y + height > CURRENT_VP->height)
height = CURRENT_VP->height - y;
/* adjust for viewport */
x += CURRENT_VP->x;
y += CURRENT_VP->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -646,7 +646,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width)
|| (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport */
if (x < 0)
{
@ -668,14 +668,14 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
/* adjust for viewport */
x += CURRENT_VP->x;
y += CURRENT_VP->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -706,7 +706,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode];
mask = 0xFFu << (shift + src_y);
mask_bottom = 0xFFu >> (~ny & 7);
if (shift == 0)
{
bool copyopt = (CURRENT_VP->drawmode == DRMODE_SOLID);
@ -719,9 +719,9 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
{
const unsigned char *src_row = src;
FBFN(data) *dst_row = dst;
dst_end = dst_row + width;
do
do
bfunc(dst_row++, mask, *src_row++);
while (dst_row < dst_end);
}
@ -751,7 +751,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
FBFN(data) *dst_col = dst++;
unsigned mask_col = mask;
unsigned data = 0;
for (y = ny; y >= 8; y -= 8)
{
data |= *src_col << shift;

View File

@ -869,11 +869,11 @@ void lcd_hline(int x1, int x2, int y)
/******************** In viewport clipping **********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) ||
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) ||
(x1 >= lcd_current_viewport->width) ||
(x2 < 0))
return;
if (x1 < 0)
x1 = 0;
if (x2 >= lcd_current_viewport->width)
@ -883,14 +883,14 @@ void lcd_hline(int x1, int x2, int y)
x1 += lcd_current_viewport->x;
x2 += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -935,19 +935,19 @@ void lcd_vline(int x, int y1, int y2)
y1 = 0;
if (y2 >= lcd_current_viewport->height)
y2 = lcd_current_viewport->height-1;
/* adjust for viewport */
x += lcd_current_viewport->x;
y1 += lcd_current_viewport->y;
y2 += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
@ -978,7 +978,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -991,23 +991,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
src_y -= y;
y = 0;
}
if (x + width > lcd_current_viewport->width)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -1026,7 +1026,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
#endif
src += stride * src_y + src_x; /* move starting point */
dst = FBADDR(x, y);
@ -1052,7 +1052,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -1065,23 +1065,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x,
src_y -= y;
y = 0;
}
if (x + width > lcd_current_viewport->width)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{

View File

@ -8,7 +8,7 @@
* $Id$
*
* LCD driver for horizontally-packed 2bpp greyscale display
*
*
* Based on code from the rockbox lcd's driver
*
* Copyright (c) 2006 Seven Le Mesle (sevlm@free.fr)
@ -199,7 +199,7 @@ static void flippixel(int x, int y)
{
unsigned mask = pixmask[x & 3];
fb_data *address = FBADDR(x>>2,y);
*address ^= mask;
}
@ -362,7 +362,7 @@ fb_data* lcd_get_backdrop(void)
static inline void setblock(fb_data *address, unsigned mask, unsigned bits)
{
unsigned data = *address;
bits ^= data;
*address = data ^ (bits & mask);
}
@ -402,7 +402,7 @@ void lcd_clear_viewport(void)
lastmode = lcd_current_viewport->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
lcd_current_viewport->drawmode = (~lastmode & DRMODE_INVERSEVID) |
lcd_current_viewport->drawmode = (~lastmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
lcd_fillrect(0, 0, lcd_current_viewport->width, lcd_current_viewport->height);
@ -492,7 +492,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
for (i = 0; i < numpixels; i++)
{
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
&& ((unsigned)y < (unsigned)lcd_current_viewport->height)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCD_WIDTH)
@ -531,13 +531,13 @@ void lcd_hline(int x1, int x2, int y)
x1 = x2;
x2 = nx;
}
/******************** In viewport clipping **********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width)
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width)
|| (x2 < 0))
return;
return;
if (x1 < 0)
x1 = 0;
if (x2 >= lcd_current_viewport->width)
@ -547,14 +547,14 @@ void lcd_hline(int x1, int x2, int y)
x1 += lcd_current_viewport->x;
x2 += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -567,7 +567,7 @@ void lcd_hline(int x1, int x2, int y)
nx = x2 - (x1 & ~3);
mask = 0xFFu >> (2 * (x1 & 3));
mask_right = 0xFFu << (2 * (~nx & 3));
for (; nx >= 4; nx -= 4)
{
bfunc(dst++, mask, 0xFFu);
@ -598,8 +598,8 @@ void lcd_vline(int x, int y1, int y2)
/* nothing to draw? */
if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height)
|| (y2 < 0))
return;
return;
if (y1 < 0)
y1 = 0;
if (y2 >= lcd_current_viewport->height)
@ -609,26 +609,26 @@ void lcd_vline(int x, int y1, int y2)
y1 += lcd_current_viewport->y;
y2 += lcd_current_viewport->y;
x += lcd_current_viewport->x;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
if (y2 >= LCD_HEIGHT)
y2 = LCD_HEIGHT-1;
#endif
bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode];
dst = FBADDR(x>>2,y1);
stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0);
mask = pixmask[x & 3];
dst_end = dst + (y2 - y1) * stride_dst;
do
{
@ -686,14 +686,14 @@ void lcd_fillrect(int x, int y, int width, int height)
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -717,7 +717,7 @@ void lcd_fillrect(int x, int y, int width, int height)
nx = width - 1 + (x & 3);
mask = 0xFFu >> (2 * (x & 3));
mask_right = 0xFFu << (2 * (~nx & 3));
for (; nx >= 4; nx -= 4)
{
unsigned char *dst_col = dst;
@ -770,7 +770,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -787,17 +787,17 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
x += lcd_current_viewport->x; /* adjust for viewport */
y += lcd_current_viewport->y; /* adjust for viewport */
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -820,7 +820,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
src_end = src + width;
dst = FBADDR(x >> 2,y);
stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0);
dst_end = dst + height * stride_dst;
@ -835,7 +835,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
do
{
const unsigned char *src_col = src++;
unsigned data = (*src_col ^ dmask) >> src_y;
unsigned data = (*src_col ^ dmask) >> src_y;
fb_data *dst_col = dst;
int fg, bg;
long bo;
@ -847,7 +847,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
data = *src_col ^ dmask; \
} \
} while (0)
switch (drmode)
{
case DRMODE_COMPLEMENT:
@ -861,7 +861,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
}
while (dst_col < dst_end);
break;
case DRMODE_BG:
if (lcd_backdrop)
{
@ -919,7 +919,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
do
{
unsigned block = *dst_col;
*dst_col = block ^ ((block ^ ((data & 0x01) ?
*dst_col = block ^ ((block ^ ((data & 0x01) ?
fg : *(dst_col + bo))) & dst_mask);
dst_col += stride_dst;
@ -981,10 +981,10 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
/******************** Image in viewport clipping **********************/
/* nothing to draw? */
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) ||
(y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -1005,14 +1005,14 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -1044,7 +1044,7 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
mask = 0xFF00u >> (2 * (shift + src_x));
mask_right = 0xFFu << (2 * (~nx & 3));
shift *= 2;
dst_end = dst + height * stride_dst;
do
@ -1053,11 +1053,11 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x,
unsigned char *dst_row = dst;
unsigned mask_row = mask >> 8;
unsigned data = 0;
for (x = nx; x >= 4; x -= 4)
{
data = (data << 8) | *src_row++;
if (mask_row & 0xFF)
{
setblock(dst_row, mask_row, data >> shift);

View File

@ -260,7 +260,7 @@ static void ICODE_ATTR solidblock(fb_data *address, unsigned mask,
{
unsigned data = *address;
unsigned bgp = bg_pattern;
bits = bgp ^ ((bgp ^ fg_pattern) & bits);
*address = data ^ ((data ^ bits) & mask);
}
@ -270,7 +270,7 @@ static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask,
{
unsigned data = *address;
unsigned bgp = *(address + lcd_backdrop_offset);
bits = bgp ^ ((bgp ^ fg_pattern) & bits);
*address = data ^ ((data ^ bits) & mask);
}
@ -310,7 +310,7 @@ static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask,
{
unsigned data = *address;
unsigned fgp = fg_pattern;
bits = fgp ^ ((fgp ^ bg_pattern) & bits);
*address = data ^ ((data ^ bits) & mask);
}
@ -320,7 +320,7 @@ static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask,
{
unsigned data = *address;
unsigned fgp = fg_pattern;
bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits);
*address = data ^ ((data ^ bits) & mask);
}
@ -347,7 +347,7 @@ void lcd_set_backdrop(fb_data* backdrop)
lcd_pixelfuncs = lcd_pixelfuncs_backdrop;
lcd_blockfuncs = lcd_blockfuncs_backdrop;
}
else
else
{
lcd_backdrop_offset = 0;
lcd_pixelfuncs = lcd_pixelfuncs_bgcolor;
@ -419,7 +419,7 @@ void lcd_clear_viewport(void)
/* Set a single pixel */
void lcd_drawpixel(int x, int y)
{
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
&& ((unsigned)y < (unsigned)lcd_current_viewport->height)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCD_WIDTH)
@ -494,7 +494,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
for (i = 0; i < numpixels; i++)
{
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
&& ((unsigned)y < (unsigned)lcd_current_viewport->height)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCD_WIDTH)
@ -534,12 +534,12 @@ void lcd_hline(int x1, int x2, int y)
x1 = x2;
x2 = x;
}
/******************** In viewport clipping **********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width)
|| (x2 < 0))
return;
return;
if (x1 < 0)
x1 = 0;
@ -550,14 +550,14 @@ void lcd_hline(int x1, int x2, int y)
x1 += lcd_current_viewport->x;
x2 += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH)
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -598,25 +598,25 @@ void lcd_vline(int x, int y1, int y2)
/* nothing to draw? */
if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height)
|| (y2 < 0))
return;
return;
if (y1 < 0)
y1 = 0;
if (y2 >= lcd_current_viewport->height)
y2 = lcd_current_viewport->height-1;
/* adjust for viewport */
y1 += lcd_current_viewport->y;
y2 += lcd_current_viewport->y;
x += lcd_current_viewport->x;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT)
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
@ -687,18 +687,18 @@ void lcd_fillrect(int x, int y, int width, int height)
width = lcd_current_viewport->width - x;
if (y + height > lcd_current_viewport->height)
height = lcd_current_viewport->height - y;
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -817,14 +817,14 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -856,7 +856,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
mask_bottom = 0xFFFFu >> (2 * (~ny & 7));
bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode];
if (shift == 0)
{
unsigned dmask1, dmask2, data;
@ -868,7 +868,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
{
const unsigned char *src_row = src;
fb_data *dst_row = dst + stride_dst;
dst_end = dst_row + width;
if (dmask1 != 0)
@ -895,7 +895,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
/* & 0xFFu is unnecessary here - dmask1 can't exceed that*/
dmask2 &= (mask_bottom >> 8);
dst_end = dst + width;
if (dmask1 != 0)
{
if (dmask2 != 0)
@ -931,8 +931,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
fb_data *dst_col = dst++;
unsigned mask_col = mask;
unsigned data = 0;
for (y = ny; y >= 8; y -= 8)
for (y = ny; y >= 8; y -= 8)
{
data |= *src_col << shift;
@ -995,7 +995,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width)
|| (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -1016,14 +1016,14 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
/* adjust for viewport */
x += lcd_current_viewport->x;
y += lcd_current_viewport->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -1052,7 +1052,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
mask = 0xFFu << (2 * (shift + src_y));
mask_bottom = 0xFFu >> (2 * (~ny & 3));
if (shift == 0)
{
for (; ny >= 4; ny -= 4)
@ -1063,9 +1063,9 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
{
const fb_data *src_row = src;
fb_data *dst_row = dst;
dst_end = dst_row + width;
do
do
setblock(dst_row++, mask, *src_row++);
while (dst_row < dst_end);
}
@ -1095,7 +1095,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
fb_data *dst_col = dst++;
unsigned mask_col = mask;
unsigned data = 0;
for (y = ny; y >= 4; y -= 4)
{
data |= *src_col << shift;

View File

@ -437,7 +437,7 @@ void LCDFN(clear_viewport)(void)
lastmode = CURRENT_VP->drawmode;
/* Invert the INVERSEVID bit and set basic mode to SOLID */
CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) |
CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) |
DRMODE_SOLID;
LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height);
@ -452,7 +452,7 @@ void LCDFN(clear_viewport)(void)
/* Set a single pixel */
void LCDFN(drawpixel)(int x, int y)
{
if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
&& ((unsigned)y < (unsigned)CURRENT_VP->height)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCDM(WIDTH))
@ -527,7 +527,7 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2)
for (i = 0; i < numpixels; i++)
{
if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
if ( ((unsigned)x < (unsigned)CURRENT_VP->width)
&& ((unsigned)y < (unsigned)CURRENT_VP->height)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCDM(WIDTH))
@ -567,13 +567,13 @@ void LCDFN(hline)(int x1, int x2, int y)
x1 = x2;
x2 = x;
}
/******************** In viewport clipping **********************/
/* nothing to draw? */
if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width)
|| (x2 < 0))
return;
if (x1 < 0)
x1 = 0;
if (x2 >= CURRENT_VP->width)
@ -589,8 +589,8 @@ void LCDFN(hline)(int x1, int x2, int y)
/* nothing to draw? */
if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH))
|| (x2 < 0))
return;
return;
/* clipping */
if (x1 < 0)
x1 = 0;
@ -642,14 +642,14 @@ void LCDFN(vline)(int x, int y1, int y2)
y1 += CURRENT_VP->y;
y2 += CURRENT_VP->y;
x += CURRENT_VP->x;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT))
if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT))
|| (y2 < 0))
return;
/* clipping */
if (y1 < 0)
y1 = 0;
@ -707,7 +707,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width)
|| (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0))
return;
if (x < 0)
{
width += x;
@ -726,14 +726,14 @@ void LCDFN(fillrect)(int x, int y, int width, int height)
/* adjust for viewport */
x += CURRENT_VP->x;
y += CURRENT_VP->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -855,14 +855,14 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x,
/* adjust for viewport */
x += CURRENT_VP->x;
y += CURRENT_VP->y;
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{
@ -1029,10 +1029,10 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x,
#if defined(HAVE_VIEWPORT_CLIP)
/********************* Viewport on screen clipping ********************/
/* nothing to draw? */
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|| (x + width <= 0) || (y + height <= 0))
return;
/* clip image in viewport in screen */
if (x < 0)
{

View File

@ -613,7 +613,7 @@ void LCDFN(nine_segment_bmp)(const struct bitmap* bm, int x, int y,
LCDFN(bmp_part)(bm, src_x, src_y_top, dst_x, dst_y_top, w, seg_h);
LCDFN(bmp_part)(bm, src_x, src_y_btm, dst_x, dst_y_btm, w, seg_h);
}
/* left & right in a single loop */
src_y = corner_h;
dst_y = corner_h;

View File

@ -586,7 +586,7 @@ void lcd_gradient_fillrect_part(int x, int y, int width, int height,
int x1, x2;
x1 = x;
x2 = x + width;
if (height == 0) return;
step_mul = (1 << 16) / src_height;

View File

@ -81,7 +81,7 @@
#define _RESOLUTION _LCD_RES_VGA
#define _ORIENTATION _LCD_LANDSCAPE
#if _RESOLUTION == _LCD_RES_VGA
#if _RESOLUTION == _LCD_RES_VGA
#define LCD_NATIVE_WIDTH 480
#define LCD_NATIVE_HEIGHT 640
#define LCD_DPI 216

View File

@ -34,7 +34,7 @@
* Stride describes the amount that you need to increment to get to the next
* line. For screens that have the pixels in contiguous horizontal strips
* stride should be equal to the image width.
*
*
* For example, if the screen pixels are layed out as follows:
*
* width0 width1 width2 widthX-1
@ -57,9 +57,9 @@
* height2 | pixel2
* | | |
* \|/ | \|/
* heightY-1 | pixelY-1
* heightY-1 | pixelY-1
*
* then you would need to add Y pixels to get to the next line (the next
* then you would need to add Y pixels to get to the next line (the next
* line in this case is from width0 to width1).
*
* The remote might have a different stride than the main screen so the screen