blob: 56f471bce25c95919450ab09459fcecbe1593c6c [file] [log] [blame]
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Tao Bao0ecbd762017-01-16 21:16:58 -080017#include "graphics.h"
18
Luke Song846012f2017-09-13 15:56:16 -070019#include <stdint.h>
Tao Baoe8020f42017-02-03 09:30:07 -080020#include <stdio.h>
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080021#include <stdlib.h>
Elliott Hughescd3c55a2015-01-29 20:50:08 -080022#include <string.h>
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080023
Tao Bao557fa1f2017-02-07 12:51:00 -080024#include <memory>
25
Doug Zongker6fd59ac2013-03-06 15:01:11 -080026#include "font_10x18.h"
Tao Bao557fa1f2017-02-07 12:51:00 -080027#include "graphics_adf.h"
28#include "graphics_drm.h"
29#include "graphics_fbdev.h"
Tao Bao0ecbd762017-01-16 21:16:58 -080030#include "minui/minui.h"
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080031
Doug Zongker16f97c32014-03-06 16:16:05 -080032static GRFont* gr_font = NULL;
Tao Bao557fa1f2017-02-07 12:51:00 -080033static MinuiBackend* gr_backend = nullptr;
Doug Zongker16f97c32014-03-06 16:16:05 -080034
Doug Zongkerc560a672012-12-18 16:31:27 -080035static int overscan_percent = OVERSCAN_PERCENT;
36static int overscan_offset_x = 0;
37static int overscan_offset_y = 0;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080038
Luke Song846012f2017-09-13 15:56:16 -070039static uint32_t gr_current = ~0;
40static constexpr uint32_t alpha_mask = 0xff000000;
Doug Zongker16f97c32014-03-06 16:16:05 -080041
Doug Zongker5290f202014-03-11 13:22:04 -070042static GRSurface* gr_draw = NULL;
Luke Song846012f2017-09-13 15:56:16 -070043static GRRotation rotation = ROTATION_NONE;
Doug Zongker16f97c32014-03-06 16:16:05 -080044
Luke Song846012f2017-09-13 15:56:16 -070045static bool outside(int x, int y) {
46 return x < 0 || x >= (rotation % 2 ? gr_draw->height : gr_draw->width) || y < 0 ||
47 y >= (rotation % 2 ? gr_draw->width : gr_draw->height);
Doug Zongker16f97c32014-03-06 16:16:05 -080048}
49
Luke Song846012f2017-09-13 15:56:16 -070050const GRFont* gr_sys_font() {
51 return gr_font;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080052}
53
Luke Song846012f2017-09-13 15:56:16 -070054int gr_measure(const GRFont* font, const char* s) {
55 return font->char_width * strlen(s);
Damien Bargiacchi35fff612016-08-11 15:57:03 -070056}
57
Luke Song846012f2017-09-13 15:56:16 -070058void gr_font_size(const GRFont* font, int* x, int* y) {
59 *x = font->char_width;
60 *y = font->char_height;
Dima Zavin3c7f00e2011-08-30 11:58:24 -070061}
62
Luke Song846012f2017-09-13 15:56:16 -070063// Blends gr_current onto pix value, assumes alpha as most significant byte.
64static inline uint32_t pixel_blend(uint8_t alpha, uint32_t pix) {
65 if (alpha == 255) return gr_current;
66 if (alpha == 0) return pix;
67 uint32_t pix_r = pix & 0xff;
68 uint32_t pix_g = pix & 0xff00;
69 uint32_t pix_b = pix & 0xff0000;
70 uint32_t cur_r = gr_current & 0xff;
71 uint32_t cur_g = gr_current & 0xff00;
72 uint32_t cur_b = gr_current & 0xff0000;
73
74 uint32_t out_r = (pix_r * (255 - alpha) + cur_r * alpha) / 255;
75 uint32_t out_g = (pix_g * (255 - alpha) + cur_g * alpha) / 255;
76 uint32_t out_b = (pix_b * (255 - alpha) + cur_b * alpha) / 255;
77
78 return (out_r & 0xff) | (out_g & 0xff00) | (out_b & 0xff0000) | (gr_current & 0xff000000);
79}
80
81// increments pixel pointer right, with current rotation.
82static void incr_x(uint32_t** p, int row_pixels) {
83 if (rotation % 2) {
84 *p = *p + (rotation == 1 ? 1 : -1) * row_pixels;
85 } else {
86 *p = *p + (rotation ? -1 : 1);
87 }
88}
89
90// increments pixel pointer down, with current rotation.
91static void incr_y(uint32_t** p, int row_pixels) {
92 if (rotation % 2) {
93 *p = *p + (rotation == 1 ? -1 : 1);
94 } else {
95 *p = *p + (rotation ? -1 : 1) * row_pixels;
96 }
97}
98
99// returns pixel pointer at given coordinates with rotation adjustment.
100static uint32_t* pixel_at(GRSurface* surf, int x, int y, int row_pixels) {
101 switch (rotation) {
102 case ROTATION_NONE:
103 return reinterpret_cast<uint32_t*>(surf->data) + y * row_pixels + x;
104 case ROTATION_RIGHT:
105 return reinterpret_cast<uint32_t*>(surf->data) + x * row_pixels + (surf->width - y);
106 case ROTATION_DOWN:
107 return reinterpret_cast<uint32_t*>(surf->data) + (surf->height - 1 - y) * row_pixels +
108 (surf->width - 1 - x);
109 case ROTATION_LEFT:
110 return reinterpret_cast<uint32_t*>(surf->data) + (surf->height - 1 - x) * row_pixels + y;
111 default:
112 printf("invalid rotation %d", rotation);
113 }
114 return nullptr;
115}
116
117static void text_blend(uint8_t* src_p, int src_row_bytes, uint32_t* dst_p, int dst_row_pixels,
118 int width, int height) {
119 uint8_t alpha_current = static_cast<uint8_t>((alpha_mask & gr_current) >> 24);
120 for (int j = 0; j < height; ++j) {
121 uint8_t* sx = src_p;
122 uint32_t* px = dst_p;
123 for (int i = 0; i < width; ++i, incr_x(&px, dst_row_pixels)) {
124 uint8_t a = *sx++;
125 if (alpha_current < 255) a = (static_cast<uint32_t>(a) * alpha_current) / 255;
126 *px = pixel_blend(a, *px);
Doug Zongker16f97c32014-03-06 16:16:05 -0800127 }
Luke Song846012f2017-09-13 15:56:16 -0700128 src_p += src_row_bytes;
129 incr_y(&dst_p, dst_row_pixels);
130 }
Doug Zongker16f97c32014-03-06 16:16:05 -0800131}
132
Luke Song846012f2017-09-13 15:56:16 -0700133void gr_text(const GRFont* font, int x, int y, const char* s, bool bold) {
134 if (!font || !font->texture || (gr_current & alpha_mask) == 0) return;
Doug Zongker55a36ac2013-03-04 15:49:02 -0800135
Luke Song846012f2017-09-13 15:56:16 -0700136 if (font->texture->pixel_bytes != 1) {
137 printf("gr_text: font has wrong format\n");
138 return;
139 }
Doug Zongker6fd59ac2013-03-06 15:01:11 -0800140
Luke Song846012f2017-09-13 15:56:16 -0700141 bold = bold && (font->texture->height != font->char_height);
Doug Zongkerc560a672012-12-18 16:31:27 -0800142
Luke Song846012f2017-09-13 15:56:16 -0700143 x += overscan_offset_x;
144 y += overscan_offset_y;
Doug Zongker16f97c32014-03-06 16:16:05 -0800145
Luke Song846012f2017-09-13 15:56:16 -0700146 unsigned char ch;
147 while ((ch = *s++)) {
148 if (outside(x, y) || outside(x + font->char_width - 1, y + font->char_height - 1)) break;
Elliott Hughes01a4d082015-03-24 15:21:48 -0700149
Luke Song846012f2017-09-13 15:56:16 -0700150 if (ch < ' ' || ch > '~') {
151 ch = '?';
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800152 }
Luke Song846012f2017-09-13 15:56:16 -0700153
154 int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
155 uint8_t* src_p = font->texture->data + ((ch - ' ') * font->char_width) +
156 (bold ? font->char_height * font->texture->row_bytes : 0);
157 uint32_t* dst_p = pixel_at(gr_draw, x, y, row_pixels);
158
159 text_blend(src_p, font->texture->row_bytes, dst_p, row_pixels, font->char_width,
160 font->char_height);
161
162 x += font->char_width;
163 }
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800164}
165
Doug Zongker16f97c32014-03-06 16:16:05 -0800166void gr_texticon(int x, int y, GRSurface* icon) {
Luke Song846012f2017-09-13 15:56:16 -0700167 if (icon == NULL) return;
Doug Zongker16f97c32014-03-06 16:16:05 -0800168
Luke Song846012f2017-09-13 15:56:16 -0700169 if (icon->pixel_bytes != 1) {
170 printf("gr_texticon: source has wrong format\n");
171 return;
172 }
Doug Zongker02ec6b82012-08-22 17:26:40 -0700173
Luke Song846012f2017-09-13 15:56:16 -0700174 x += overscan_offset_x;
175 y += overscan_offset_y;
Doug Zongkerc560a672012-12-18 16:31:27 -0800176
Luke Song846012f2017-09-13 15:56:16 -0700177 if (outside(x, y) || outside(x + icon->width - 1, y + icon->height - 1)) return;
Doug Zongker02ec6b82012-08-22 17:26:40 -0700178
Luke Song846012f2017-09-13 15:56:16 -0700179 int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
180 uint8_t* src_p = icon->data;
181 uint32_t* dst_p = pixel_at(gr_draw, x, y, row_pixels);
Doug Zongker02ec6b82012-08-22 17:26:40 -0700182
Luke Song846012f2017-09-13 15:56:16 -0700183 text_blend(src_p, icon->row_bytes, dst_p, row_pixels, icon->width, icon->height);
Doug Zongker16f97c32014-03-06 16:16:05 -0800184}
185
Luke Song846012f2017-09-13 15:56:16 -0700186void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
187 uint32_t r32 = r, g32 = g, b32 = b, a32 = a;
Tony Kuofd778e32015-02-05 21:25:56 +0800188#if defined(RECOVERY_ABGR) || defined(RECOVERY_BGRA)
Luke Song846012f2017-09-13 15:56:16 -0700189 gr_current = (a32 << 24) | (r32 << 16) | (g32 << 8) | b32;
Tony Kuofd778e32015-02-05 21:25:56 +0800190#else
Luke Song846012f2017-09-13 15:56:16 -0700191 gr_current = (a32 << 24) | (b32 << 16) | (g32 << 8) | r32;
Tony Kuofd778e32015-02-05 21:25:56 +0800192#endif
Doug Zongker16f97c32014-03-06 16:16:05 -0800193}
194
Luke Song846012f2017-09-13 15:56:16 -0700195void gr_clear() {
196 if ((gr_current & 0xff) == ((gr_current >> 8) & 0xff) &&
197 (gr_current & 0xff) == ((gr_current >> 16) & 0xff) &&
198 (gr_current & 0xff) == ((gr_current >> 24) & 0xff) &&
199 gr_draw->row_bytes == gr_draw->width * gr_draw->pixel_bytes) {
200 memset(gr_draw->data, gr_current & 0xff, gr_draw->height * gr_draw->row_bytes);
201 } else {
202 uint32_t* px = reinterpret_cast<uint32_t*>(gr_draw->data);
203 int row_diff = gr_draw->row_bytes / gr_draw->pixel_bytes - gr_draw->width;
204 for (int y = 0; y < gr_draw->height; ++y) {
205 for (int x = 0; x < gr_draw->width; ++x) {
206 *px++ = gr_current;
207 }
208 px += row_diff;
Doug Zongker16f97c32014-03-06 16:16:05 -0800209 }
Luke Song846012f2017-09-13 15:56:16 -0700210 }
Doug Zongker02ec6b82012-08-22 17:26:40 -0700211}
212
Luke Song846012f2017-09-13 15:56:16 -0700213void gr_fill(int x1, int y1, int x2, int y2) {
214 x1 += overscan_offset_x;
215 y1 += overscan_offset_y;
Doug Zongkerc560a672012-12-18 16:31:27 -0800216
Luke Song846012f2017-09-13 15:56:16 -0700217 x2 += overscan_offset_x;
218 y2 += overscan_offset_y;
Doug Zongkerc560a672012-12-18 16:31:27 -0800219
Luke Song846012f2017-09-13 15:56:16 -0700220 if (outside(x1, y1) || outside(x2 - 1, y2 - 1)) return;
Doug Zongker16f97c32014-03-06 16:16:05 -0800221
Luke Song846012f2017-09-13 15:56:16 -0700222 int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
223 uint32_t* p = pixel_at(gr_draw, x1, y1, row_pixels);
224 uint8_t alpha = static_cast<uint8_t>(((gr_current & alpha_mask) >> 24));
225 if (alpha > 0) {
226 for (int y = y1; y < y2; ++y) {
227 uint32_t* px = p;
228 for (int x = x1; x < x2; ++x) {
229 *px = pixel_blend(alpha, *px);
230 incr_x(&px, row_pixels);
231 }
232 incr_y(&p, row_pixels);
Doug Zongker16f97c32014-03-06 16:16:05 -0800233 }
Luke Song846012f2017-09-13 15:56:16 -0700234 }
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800235}
236
Doug Zongker16f97c32014-03-06 16:16:05 -0800237void gr_blit(GRSurface* source, int sx, int sy, int w, int h, int dx, int dy) {
Luke Song846012f2017-09-13 15:56:16 -0700238 if (source == NULL) return;
Doug Zongker16f97c32014-03-06 16:16:05 -0800239
Luke Song846012f2017-09-13 15:56:16 -0700240 if (gr_draw->pixel_bytes != source->pixel_bytes) {
241 printf("gr_blit: source has wrong format\n");
242 return;
243 }
244
245 dx += overscan_offset_x;
246 dy += overscan_offset_y;
247
248 if (outside(dx, dy) || outside(dx + w - 1, dy + h - 1)) return;
249
250 if (rotation) {
251 int src_row_pixels = source->row_bytes / source->pixel_bytes;
252 int row_pixels = gr_draw->row_bytes / gr_draw->pixel_bytes;
253 uint32_t* src_py = reinterpret_cast<uint32_t*>(source->data) + sy * source->row_bytes / 4 + sx;
254 uint32_t* dst_py = pixel_at(gr_draw, dx, dy, row_pixels);
255
256 for (int y = 0; y < h; y += 1) {
257 uint32_t* src_px = src_py;
258 uint32_t* dst_px = dst_py;
259 for (int x = 0; x < w; x += 1) {
260 *dst_px = *src_px++;
261 incr_x(&dst_px, row_pixels);
262 }
263 src_py += src_row_pixels;
264 incr_y(&dst_py, row_pixels);
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800265 }
Luke Song846012f2017-09-13 15:56:16 -0700266 } else {
267 unsigned char* src_p = source->data + sy * source->row_bytes + sx * source->pixel_bytes;
268 unsigned char* dst_p = gr_draw->data + dy * gr_draw->row_bytes + dx * gr_draw->pixel_bytes;
Doug Zongker16f97c32014-03-06 16:16:05 -0800269
270 int i;
271 for (i = 0; i < h; ++i) {
Luke Song846012f2017-09-13 15:56:16 -0700272 memcpy(dst_p, src_p, w * source->pixel_bytes);
273 src_p += source->row_bytes;
274 dst_p += gr_draw->row_bytes;
Doug Zongker16f97c32014-03-06 16:16:05 -0800275 }
Luke Song846012f2017-09-13 15:56:16 -0700276 }
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800277}
278
Doug Zongker16f97c32014-03-06 16:16:05 -0800279unsigned int gr_get_width(GRSurface* surface) {
Luke Song846012f2017-09-13 15:56:16 -0700280 if (surface == NULL) {
281 return 0;
282 }
283 return surface->width;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800284}
285
Doug Zongker16f97c32014-03-06 16:16:05 -0800286unsigned int gr_get_height(GRSurface* surface) {
Luke Song846012f2017-09-13 15:56:16 -0700287 if (surface == NULL) {
288 return 0;
289 }
290 return surface->height;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800291}
292
Damien Bargiacchid00f5eb2016-09-09 07:14:08 -0700293int gr_init_font(const char* name, GRFont** dest) {
Luke Song846012f2017-09-13 15:56:16 -0700294 GRFont* font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
295 if (font == nullptr) {
296 return -1;
297 }
Damien Bargiacchid00f5eb2016-09-09 07:14:08 -0700298
Luke Song846012f2017-09-13 15:56:16 -0700299 int res = res_create_alpha_surface(name, &(font->texture));
300 if (res < 0) {
301 free(font);
302 return res;
303 }
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700304
Luke Song846012f2017-09-13 15:56:16 -0700305 // The font image should be a 96x2 array of character images. The
306 // columns are the printable ASCII characters 0x20 - 0x7f. The
307 // top row is regular text; the bottom row is bold.
308 font->char_width = font->texture->width / 96;
309 font->char_height = font->texture->height / 2;
Damien Bargiacchid00f5eb2016-09-09 07:14:08 -0700310
Luke Song846012f2017-09-13 15:56:16 -0700311 *dest = font;
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700312
Luke Song846012f2017-09-13 15:56:16 -0700313 return 0;
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700314}
315
Luke Song846012f2017-09-13 15:56:16 -0700316static void gr_init_font(void) {
317 int res = gr_init_font("font", &gr_font);
318 if (res == 0) {
319 return;
320 }
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700321
Luke Song846012f2017-09-13 15:56:16 -0700322 printf("failed to read font: res=%d\n", res);
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700323
Luke Song846012f2017-09-13 15:56:16 -0700324 // fall back to the compiled-in font.
325 gr_font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
326 gr_font->texture = static_cast<GRSurface*>(malloc(sizeof(*gr_font->texture)));
327 gr_font->texture->width = font.width;
328 gr_font->texture->height = font.height;
329 gr_font->texture->row_bytes = font.width;
330 gr_font->texture->pixel_bytes = 1;
Damien Bargiacchid00f5eb2016-09-09 07:14:08 -0700331
Luke Song846012f2017-09-13 15:56:16 -0700332 unsigned char* bits = static_cast<unsigned char*>(malloc(font.width * font.height));
333 gr_font->texture->data = bits;
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700334
Luke Song846012f2017-09-13 15:56:16 -0700335 unsigned char data;
336 unsigned char* in = font.rundata;
337 while ((data = *in++)) {
338 memset(bits, (data & 0x80) ? 255 : 0, data & 0x7f);
339 bits += (data & 0x7f);
340 }
Damien Bargiacchi35fff612016-08-11 15:57:03 -0700341
Luke Song846012f2017-09-13 15:56:16 -0700342 gr_font->char_width = font.char_width;
343 gr_font->char_height = font.char_height;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800344}
345
Doug Zongker5290f202014-03-11 13:22:04 -0700346void gr_flip() {
Tao Bao557fa1f2017-02-07 12:51:00 -0800347 gr_draw = gr_backend->Flip();
Doug Zongker5290f202014-03-11 13:22:04 -0700348}
349
Tao Bao557fa1f2017-02-07 12:51:00 -0800350int gr_init() {
351 gr_init_font();
Doug Zongker16f97c32014-03-06 16:16:05 -0800352
Tao Bao557fa1f2017-02-07 12:51:00 -0800353 auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendAdf>() };
354 gr_draw = backend->Init();
Greg Hackmann41909dd2014-04-25 10:39:50 -0700355
Tao Bao557fa1f2017-02-07 12:51:00 -0800356 if (!gr_draw) {
357 backend = std::make_unique<MinuiBackendDrm>();
358 gr_draw = backend->Init();
359 }
Stéphane Marchesin1a92c442015-06-29 20:05:48 -0700360
Tao Bao557fa1f2017-02-07 12:51:00 -0800361 if (!gr_draw) {
362 backend = std::make_unique<MinuiBackendFbdev>();
363 gr_draw = backend->Init();
364 }
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800365
Tao Bao557fa1f2017-02-07 12:51:00 -0800366 if (!gr_draw) {
367 return -1;
368 }
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800369
Tao Bao557fa1f2017-02-07 12:51:00 -0800370 gr_backend = backend.release();
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800371
Tao Bao557fa1f2017-02-07 12:51:00 -0800372 overscan_offset_x = gr_draw->width * overscan_percent / 100;
373 overscan_offset_y = gr_draw->height * overscan_percent / 100;
374
375 gr_flip();
376 gr_flip();
377
Luke Song846012f2017-09-13 15:56:16 -0700378 gr_rotate(DEFAULT_ROTATION);
379
380 if (gr_draw->pixel_bytes != 4) {
381 printf("gr_init: Only 4-byte pixel formats supported\n");
382 }
383
Tao Bao557fa1f2017-02-07 12:51:00 -0800384 return 0;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800385}
386
Tao Bao557fa1f2017-02-07 12:51:00 -0800387void gr_exit() {
388 delete gr_backend;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800389}
390
Tao Bao557fa1f2017-02-07 12:51:00 -0800391int gr_fb_width() {
Luke Song846012f2017-09-13 15:56:16 -0700392 return rotation % 2 ? gr_draw->height - 2 * overscan_offset_y
393 : gr_draw->width - 2 * overscan_offset_x;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800394}
395
Tao Bao557fa1f2017-02-07 12:51:00 -0800396int gr_fb_height() {
Luke Song846012f2017-09-13 15:56:16 -0700397 return rotation % 2 ? gr_draw->width - 2 * overscan_offset_x
398 : gr_draw->height - 2 * overscan_offset_y;
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -0800399}
Dima Zavin4daf48a2011-08-30 11:59:20 -0700400
Tao Bao557fa1f2017-02-07 12:51:00 -0800401void gr_fb_blank(bool blank) {
402 gr_backend->Blank(blank);
Dima Zavin4daf48a2011-08-30 11:59:20 -0700403}
Luke Song846012f2017-09-13 15:56:16 -0700404
405void gr_rotate(GRRotation rot) {
406 rotation = rot;
407}