improved gray API
This commit is contained in:
parent
fc8d7794d5
commit
dc5b60df15
|
@ -11,39 +11,38 @@
|
|||
void gintctl_gint_gray(void)
|
||||
{
|
||||
uint32_t delays[2];
|
||||
gray_config(&delays[0], &delays[1]);
|
||||
dgray_getdelays(&delays[0], &delays[1]);
|
||||
|
||||
int g35pe2 = (gint[HWCALC] == HWCALC_G35PE2);
|
||||
|
||||
int key = 0, sel = 0;
|
||||
char str[20];
|
||||
|
||||
gray_start();
|
||||
dgray(DGRAY_ON);
|
||||
|
||||
while(key != KEY_EXIT)
|
||||
{
|
||||
gclear(C_WHITE);
|
||||
dclear(C_WHITE);
|
||||
|
||||
gtext(1, 0, "Gray engine tuning", C_BLACK, C_NONE);
|
||||
gtext(1, 8, g35pe2 ? "Graph 35+E II" : "fx-9860G-like",
|
||||
C_BLACK, C_NONE);
|
||||
dtext(1, 0, C_BLACK, "Gray engine tuning");
|
||||
dtext(1, 8, C_BLACK, g35pe2?"Graph 35+E II":"fx-9860G-like");
|
||||
|
||||
sprintf(str, "Light%5u", delays[0]);
|
||||
gtext(13, 24, str, C_BLACK, C_NONE);
|
||||
dtext(13, 24, C_BLACK, str);
|
||||
sprintf(str, "Dark %5u", delays[1]);
|
||||
gtext(13, 32, str, C_BLACK, C_NONE);
|
||||
dtext(13, 32, C_BLACK, str);
|
||||
|
||||
int y = 24 + (sel << 3);
|
||||
gtext(7, y, "<", C_BLACK, C_NONE);
|
||||
gtext(73, y, ">", C_BLACK, C_NONE);
|
||||
dtext(7, y, C_BLACK, "<");
|
||||
dtext(73, y, C_BLACK, ">");
|
||||
|
||||
grect(96, 16, 127, 31, C_LIGHT);
|
||||
grect(96, 32, 127, 47, C_DARK);
|
||||
drect(96, 16, 127, 31, C_LIGHT);
|
||||
drect(96, 32, 127, 47, C_DARK);
|
||||
|
||||
extern bopti_image_t img_opt_gint_gray;
|
||||
gimage(0, 56, &img_opt_gint_gray);
|
||||
dimage(0, 56, &img_opt_gint_gray);
|
||||
|
||||
gupdate();
|
||||
dupdate();
|
||||
key = getkey().key;
|
||||
|
||||
if(key == KEY_UP && sel) sel = 0;
|
||||
|
@ -77,9 +76,10 @@ void gintctl_gint_gray(void)
|
|||
|
||||
if(delays[sel] < 100) delays[sel] = 100;
|
||||
if(delays[sel] > 3000) delays[sel] = 3000;
|
||||
gray_delays(delays[0], delays[1]);
|
||||
dgray_setdelays(delays[0], delays[1]);
|
||||
}
|
||||
gray_stop();
|
||||
|
||||
dgray(DGRAY_OFF);
|
||||
}
|
||||
|
||||
/* gintctl_gint_grayrender(): Gray rendering functions */
|
||||
|
@ -87,34 +87,34 @@ void gintctl_gint_grayrender(void)
|
|||
{
|
||||
int x, y;
|
||||
|
||||
gray_start();
|
||||
gclear(C_WHITE);
|
||||
dgray(DGRAY_ON);
|
||||
dclear(C_WHITE);
|
||||
|
||||
gtext(1, 1, "Gray rendering", C_BLACK, C_NONE);
|
||||
dtext(1, 1, C_BLACK, "Gray rendering");
|
||||
|
||||
x = 6, y = 12;
|
||||
grect(x, y, x + 15, y + 15, C_WHITE);
|
||||
grect(x + 16, y, x + 31, y + 15, C_LIGHT);
|
||||
grect(x + 32, y, x + 47, y + 15, C_DARK);
|
||||
grect(x + 48, y, x + 63, y + 15, C_BLACK);
|
||||
grect(x, y, x + 63, y + 3, C_LIGHTEN);
|
||||
grect(x, y + 12, x + 63, y + 15, C_DARKEN);
|
||||
drect(x, y, x + 15, y + 15, C_WHITE);
|
||||
drect(x + 16, y, x + 31, y + 15, C_LIGHT);
|
||||
drect(x + 32, y, x + 47, y + 15, C_DARK);
|
||||
drect(x + 48, y, x + 63, y + 15, C_BLACK);
|
||||
drect(x, y, x + 63, y + 3, C_LIGHTEN);
|
||||
drect(x, y + 12, x + 63, y + 15, C_DARKEN);
|
||||
|
||||
x = 104, y = 0;
|
||||
grect(x, y, x + 23, y + 32, C_BLACK);
|
||||
gtext(x - 13, y + 1, "White", C_WHITE, C_NONE);
|
||||
gtext(x - 13, y + 9, "Light", C_LIGHT, C_NONE);
|
||||
gtext(x - 13, y + 17, "Dark", C_DARK, C_NONE);
|
||||
gtext(x - 13, y + 25, "Black", C_BLACK, C_NONE);
|
||||
drect(x, y, x + 23, y + 32, C_BLACK);
|
||||
dtext(x - 13, y + 1, C_WHITE, "White");
|
||||
dtext(x - 13, y + 9, C_LIGHT, "Light");
|
||||
dtext(x - 13, y + 17, C_DARK, "Dark");
|
||||
dtext(x - 13, y + 25, C_BLACK, "Black");
|
||||
|
||||
x = 76, y = 33;
|
||||
grect(x, y, x + 12, y + 24, C_WHITE);
|
||||
grect(x + 13, y, x + 25, y + 24, C_LIGHT);
|
||||
grect(x + 26, y, x + 38, y + 24, C_DARK);
|
||||
grect(x + 39, y, x + 51, y + 24, C_BLACK);
|
||||
gtext(x + 8, y + 1, "Lighten", C_LIGHTEN, C_NONE);
|
||||
gtext(x + 8, y + 9, "Darken", C_DARKEN, C_NONE);
|
||||
gtext(x + 8, y + 17, "Invert", C_INVERT, C_NONE);
|
||||
drect(x, y, x + 12, y + 24, C_WHITE);
|
||||
drect(x + 13, y, x + 25, y + 24, C_LIGHT);
|
||||
drect(x + 26, y, x + 38, y + 24, C_DARK);
|
||||
drect(x + 39, y, x + 51, y + 24, C_BLACK);
|
||||
dtext(x + 8, y + 1, C_LIGHTEN, "Lighten");
|
||||
dtext(x + 8, y + 9, C_DARKEN, "Darken");
|
||||
dtext(x + 8, y + 17, C_INVERT, "Invert");
|
||||
|
||||
extern bopti_image_t img_profile_mono;
|
||||
extern bopti_image_t img_profile_mono_alpha;
|
||||
|
@ -125,25 +125,28 @@ void gintctl_gint_grayrender(void)
|
|||
for(int c = 0; c < 8; c++)
|
||||
{
|
||||
int z = x + 8 * c + 3;
|
||||
gline(z, y, z + 3, y + 3, c);
|
||||
gline(z - 1, y + 1, z - 3, y + 3, c);
|
||||
gline(z + 2, y + 4, z, y + 6, c);
|
||||
gline(z - 2, y + 4, z - 1, y + 5, c);
|
||||
dline(z, y, z + 3, y + 3, c);
|
||||
dline(z - 1, y + 1, z - 3, y + 3, c);
|
||||
dline(z + 2, y + 4, z, y + 6, c);
|
||||
dline(z - 2, y + 4, z - 1, y + 5, c);
|
||||
|
||||
dline(75, y + c, 83, y + c, c);
|
||||
dline(75 + c, y - 12, 75 + c, y - 5, c);
|
||||
}
|
||||
|
||||
x = 2, y = 42;
|
||||
for(int j = 0; j < 20; j++)
|
||||
for(int i = 0; i < 74; i++)
|
||||
gpixel(x + i, y + j, (i ^ j) & 1 ? C_BLACK : C_WHITE);
|
||||
gimage(x + 2, y + 2, &img_profile_mono);
|
||||
gimage(x + 20, y + 2, &img_profile_mono_alpha);
|
||||
gimage(x + 38, y + 2, &img_profile_gray);
|
||||
gimage(x + 56, y + 2, &img_profile_gray_alpha);
|
||||
dpixel(x + i, y + j, (i ^ j) & 1 ? C_BLACK : C_WHITE);
|
||||
dimage(x + 2, y + 2, &img_profile_mono);
|
||||
dimage(x + 20, y + 2, &img_profile_mono_alpha);
|
||||
dimage(x + 38, y + 2, &img_profile_gray);
|
||||
dimage(x + 56, y + 2, &img_profile_gray_alpha);
|
||||
|
||||
gupdate();
|
||||
dupdate();
|
||||
getkey();
|
||||
|
||||
gray_stop();
|
||||
dgray(DGRAY_OFF);
|
||||
}
|
||||
|
||||
#endif /* FX9860G */
|
||||
|
|
|
@ -15,18 +15,18 @@ static void render(void)
|
|||
void gintctl_libs_libimg(void)
|
||||
{
|
||||
int key = 0;
|
||||
gray_start();
|
||||
dgray(DGRAY_ON);
|
||||
|
||||
while(key != KEY_EXIT)
|
||||
{
|
||||
gclear(C_WHITE);
|
||||
dclear(C_WHITE);
|
||||
render();
|
||||
gupdate();
|
||||
dupdate();
|
||||
|
||||
key = getkey().key;
|
||||
}
|
||||
|
||||
gray_stop();
|
||||
dgray(DGRAY_OFF);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ static int naive_memcmp(void const *_s1, void const *_s2, size_t len)
|
|||
// Testing functions
|
||||
//---
|
||||
|
||||
int test_memcpy(int off_dst, int off_src, size_t len)
|
||||
static int test_memcpy(int off_dst, int off_src, size_t len)
|
||||
{
|
||||
clear(dst);
|
||||
clear(sys);
|
||||
|
@ -112,7 +112,7 @@ int test_memcpy(int off_dst, int off_src, size_t len)
|
|||
return cmp(dst, sys);
|
||||
}
|
||||
|
||||
int test_memset(int off_dst, GUNUSED int off_src, size_t len)
|
||||
static int test_memset(int off_dst, GUNUSED int off_src, size_t len)
|
||||
{
|
||||
fill(dst, 0);
|
||||
fill(sys, 0);
|
||||
|
@ -123,7 +123,7 @@ int test_memset(int off_dst, GUNUSED int off_src, size_t len)
|
|||
return cmp(dst, sys);
|
||||
}
|
||||
|
||||
int test_memmove(int off_dst, int off_src, size_t len)
|
||||
static int test_memmove(int off_dst, int off_src, size_t len)
|
||||
{
|
||||
fill(dst, 0);
|
||||
fill(sys, 0);
|
||||
|
@ -134,7 +134,7 @@ int test_memmove(int off_dst, int off_src, size_t len)
|
|||
return cmp(dst, sys);
|
||||
}
|
||||
|
||||
int test_memcmp(int off_dst, int off_src, size_t len)
|
||||
static int test_memcmp(int off_dst, int off_src, size_t len)
|
||||
{
|
||||
/* Create data that matches at the provided offsets */
|
||||
fill(dst, -off_dst);
|
||||
|
@ -161,7 +161,7 @@ int test_memcmp(int off_dst, int off_src, size_t len)
|
|||
//---
|
||||
|
||||
/* exc(): Wrapper that accounts for exceptions */
|
||||
int exc(int (*func)(int of_dst, int off_src, size_t len), int off_dst,
|
||||
static int exc(int (*func)(int of_dst, int off_src, size_t len), int off_dst,
|
||||
int off_src, size_t len)
|
||||
{
|
||||
exception = 0;
|
||||
|
@ -183,7 +183,8 @@ int exc(int (*func)(int of_dst, int off_src, size_t len), int off_dst,
|
|||
@func Function to test, will be called with various sizes and alignments
|
||||
@count If non-null, set to number of tests performed
|
||||
Returns the number of failed tests; thus, non-zero indicates failure. */
|
||||
void test(int (*func)(int off_dst, int off_src, size_t len), uint8_t *results)
|
||||
static void test(int (*func)(int off_dst, int off_src, size_t len),
|
||||
uint8_t *results)
|
||||
{
|
||||
int current_test = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue