summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-bitmap-common.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-03-26 23:15:56 +0100
committerThomas Martitz <kugel@rockbox.org>2013-12-14 23:11:30 +0100
commit47c8d3c14d8fdaf4749ef5e0380fb0c52140b5fb (patch)
tree1e34394f6367ee4f8e937ee3f610236acaefad6f /firmware/drivers/lcd-bitmap-common.c
parent87c6df98a34154b77c522196c61d89c6f3797416 (diff)
downloadrockbox-47c8d3c14d8fdaf4749ef5e0380fb0c52140b5fb.tar.gz
rockbox-47c8d3c14d8fdaf4749ef5e0380fb0c52140b5fb.zip
lcd-*: Merge common viewport operations into lcd-bitmap-common.c
Change-Id: Ibec2d039ac0ba1214c9bd1b667bc8a9538a0d3d7
Diffstat (limited to 'firmware/drivers/lcd-bitmap-common.c')
-rw-r--r--firmware/drivers/lcd-bitmap-common.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index a149e8aaa9..a17ac51006 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -141,6 +141,54 @@ void LCDFN(fill_viewport)(void)
141 LCDFN(fillrect)(0, 0, current_vp->width, current_vp->height); 141 LCDFN(fillrect)(0, 0, current_vp->width, current_vp->height);
142} 142}
143 143
144
145/*** Viewports ***/
146
147void LCDFN(set_viewport)(struct viewport* vp)
148{
149 if (vp == NULL)
150 current_vp = &default_vp;
151 else
152 current_vp = vp;
153
154#if LCDM(DEPTH) > 1
155 LCDFN(set_foreground)(current_vp->fg_pattern);
156 LCDFN(set_background)(current_vp->bg_pattern);
157#endif
158
159#if defined(SIMULATOR)
160 /* Force the viewport to be within bounds. If this happens it should
161 * be considered an error - the viewport will not draw as it might be
162 * expected.
163 */
164 if((unsigned) current_vp->x > (unsigned) LCDM(WIDTH)
165 || (unsigned) current_vp->y > (unsigned) LCDM(HEIGHT)
166 || current_vp->x + current_vp->width > LCDM(WIDTH)
167 || current_vp->y + current_vp->height > LCDM(HEIGHT))
168 {
169#if !defined(HAVE_VIEWPORT_CLIP)
170 DEBUGF("ERROR: "
171#else
172 DEBUGF("NOTE: "
173#endif
174 "set_viewport out of bounds: x: %d y: %d width: %d height:%d\n",
175 current_vp->x, current_vp->y,
176 current_vp->width, current_vp->height);
177 }
178#endif
179}
180
181void LCDFN(update_viewport)(void)
182{
183 LCDFN(update_rect)(current_vp->x, current_vp->y,
184 current_vp->width, current_vp->height);
185}
186
187void LCDFN(update_viewport_rect)(int x, int y, int width, int height)
188{
189 LCDFN(update_rect)(current_vp->x + x, current_vp->y + y, width, height);
190}
191
144/* put a string at a given pixel position, skipping first ofs pixel columns */ 192/* put a string at a given pixel position, skipping first ofs pixel columns */
145static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str) 193static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
146{ 194{