summaryrefslogtreecommitdiff
path: root/apps/plugins/rockpaint.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/rockpaint.c')
-rw-r--r--apps/plugins/rockpaint.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 458f6b552a..2a848c2049 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -312,16 +312,11 @@ static void goto_menu(void);
312static int load_bitmap( const char *filename ); 312static int load_bitmap( const char *filename );
313static int save_bitmap( char *filename ); 313static int save_bitmap( char *filename );
314static void draw_rect_full( int x1, int y1, int x2, int y2 ); 314static void draw_rect_full( int x1, int y1, int x2, int y2 );
315extern int errno;
316 315
317/*********************************************************************** 316/***********************************************************************
318 * Global variables 317 * Global variables
319 ***********************************************************************/ 318 ***********************************************************************/
320 319
321#if !defined(SIMULATOR) || defined(__MINGW32__) || defined(__CYGWIN__)
322int errno;
323#endif
324
325static int drawcolor=0; /* Current color (in palette) */ 320static int drawcolor=0; /* Current color (in palette) */
326static int bgdrawcolor=9; /* Current background color (in palette) */ 321static int bgdrawcolor=9; /* Current background color (in palette) */
327bool isbg = false; /* gruik ugly hack alert */ 322bool isbg = false; /* gruik ugly hack alert */
@@ -518,7 +513,8 @@ static void buffer_putsxyofs( fb_data *buf, int buf_width, int buf_height,
518 513
519 bits = rb->font_get_bits( pf, ch ); 514 bits = rb->font_get_bits( pf, ch );
520 515
521 buffer_mono_bitmap_part( buf, buf_width, buf_height, bits, ofs, 0, width, x, y, width - ofs, pf->height); 516 buffer_mono_bitmap_part( buf, buf_width, buf_height, bits, ofs, 0,
517 width, x, y, width - ofs, pf->height);
522 518
523 x += width - ofs; 519 x += width - ofs;
524 ofs = 0; 520 ofs = 0;
@@ -539,9 +535,9 @@ enum {
539 }; 535 };
540enum { 536enum {
541 /* Select action menu */ 537 /* Select action menu */
542 SELECT_MENU_CUT, SELECT_MENU_COPY, SELECT_MENU_INVERT, 538 SELECT_MENU_CUT, SELECT_MENU_COPY,
543 SELECT_MENU_HFLIP, SELECT_MENU_VFLIP, SELECT_MENU_ROTATE90, 539 SELECT_MENU_INVERT, SELECT_MENU_HFLIP, SELECT_MENU_VFLIP,
544 SELECT_MENU_ROTATE180, SELECT_MENU_ROTATE270, 540 SELECT_MENU_ROTATE90, SELECT_MENU_ROTATE180, SELECT_MENU_ROTATE270,
545 SELECT_MENU_CANCEL, 541 SELECT_MENU_CANCEL,
546 }; 542 };
547enum { 543enum {
@@ -562,9 +558,10 @@ MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
562MENUITEM_STRINGLIST(gridsize_menu, "Grid Size", NULL, 558MENUITEM_STRINGLIST(gridsize_menu, "Grid Size", NULL,
563 "No grid", "5px", "10px", "20px"); 559 "No grid", "5px", "10px", "20px");
564MENUITEM_STRINGLIST(select_menu, "Select...", NULL, 560MENUITEM_STRINGLIST(select_menu, "Select...", NULL,
565 "Cut", "Copy", "Invert", "Horizontal Flip" , 561 "Cut", "Copy",
566 "Vertical Flip", "Rotate 90°", 562 "Invert", "Horizontal Flip", "Vertical Flip",
567 "Rotate 180°", "Rotate 270°", "Cancel"); 563 "Rotate 90°", "Rotate 180°", "Rotate 270°",
564 "Cancel");
568MENUITEM_STRINGLIST(text_menu, "Text", NULL, 565MENUITEM_STRINGLIST(text_menu, "Text", NULL,
569 "Set Text", "Change Font", 566 "Set Text", "Change Font",
570 "Preview", "Apply", "Cancel"); 567 "Preview", "Apply", "Cancel");
@@ -1574,20 +1571,20 @@ static void draw_line( int x1, int y1, int x2, int y2 )
1574 int deltax = x2 - x1; 1571 int deltax = x2 - x1;
1575 int deltay = y2 - y1; 1572 int deltay = y2 - y1;
1576 int i; 1573 int i;
1577 1574
1578 int xerr = abs(deltax); 1575 int xerr = abs(deltax);
1579 int yerr = abs(deltay); 1576 int yerr = abs(deltay);
1580 int xstep = deltax > 0 ? 1 : -1; 1577 int xstep = deltax > 0 ? 1 : -1;
1581 int ystep = deltay > 0 ? 1 : -1; 1578 int ystep = deltay > 0 ? 1 : -1;
1582 int err; 1579 int err;
1583 1580
1584 if (yerr > xerr) 1581 if (yerr > xerr)
1585 { 1582 {
1586 /* more vertical */ 1583 /* more vertical */
1587 err = yerr; 1584 err = yerr;
1588 xerr <<= 1; 1585 xerr <<= 1;
1589 yerr <<= 1; 1586 yerr <<= 1;
1590 1587
1591 /* to leave off the last pixel of the line, leave off the "+ 1" */ 1588 /* to leave off the last pixel of the line, leave off the "+ 1" */
1592 for (i = abs(deltay) + 1; i; --i) 1589 for (i = abs(deltay) + 1; i; --i)
1593 { 1590 {
@@ -1606,7 +1603,7 @@ static void draw_line( int x1, int y1, int x2, int y2 )
1606 err = xerr; 1603 err = xerr;
1607 xerr <<= 1; 1604 xerr <<= 1;
1608 yerr <<= 1; 1605 yerr <<= 1;
1609 1606
1610 for (i = abs(deltax) + 1; i; --i) 1607 for (i = abs(deltax) + 1; i; --i)
1611 { 1608 {
1612 draw_pixel(x, y); 1609 draw_pixel(x, y);
@@ -1702,7 +1699,7 @@ static void draw_curve( int x1, int y1, int x2, int y2,
1702 draw_line( ((xl1>>3)+1)>>1, ((yl1>>3)+1)>>1, 1699 draw_line( ((xl1>>3)+1)>>1, ((yl1>>3)+1)>>1,
1703 ((xr3>>3)+1)>>1, ((yr3>>3)+1)>>1 ); 1700 ((xr3>>3)+1)>>1, ((yr3>>3)+1)>>1 );
1704 } 1701 }
1705 } 1702 }
1706#undef PUSH 1703#undef PUSH
1707#undef POP 1704#undef POP
1708 } 1705 }
@@ -2090,8 +2087,8 @@ static void linear_gradient( int x1, int y1, int x2, int y2 )
2090 rgb2hsv( r2, g2, b2, &h2, &s2, &v2 ); 2087 rgb2hsv( r2, g2, b2, &h2, &s2, &v2 );
2091 2088
2092#define PUSH( x0, y0 ) \ 2089#define PUSH( x0, y0 ) \
2093 buffer.coord[i].x = (short)(x0); \ 2090 buffer.coord[i].x = (short)(x0); \
2094 buffer.coord[i].y = (short)(y0); \ 2091 buffer.coord[i].y = (short)(y0); \
2095 i++; 2092 i++;
2096#define POP( a, b ) \ 2093#define POP( a, b ) \
2097 i--; \ 2094 i--; \
@@ -2186,8 +2183,8 @@ static void radial_gradient( int x1, int y1, int x2, int y2 )
2186 rgb2hsv( r2, g2, b2, &h2, &s2, &v2 ); 2183 rgb2hsv( r2, g2, b2, &h2, &s2, &v2 );
2187 2184
2188#define PUSH( x0, y0 ) \ 2185#define PUSH( x0, y0 ) \
2189 buffer.coord[i].x = (short)(x0); \ 2186 buffer.coord[i].x = (short)(x0); \
2190 buffer.coord[i].y = (short)(y0); \ 2187 buffer.coord[i].y = (short)(y0); \
2191 i++; 2188 i++;
2192#define POP( a, b ) \ 2189#define POP( a, b ) \
2193 i--; \ 2190 i--; \
@@ -2564,7 +2561,9 @@ static bool rockpaint_loop( void )
2564 int button=0,i,j; 2561 int button=0,i,j;
2565 int accelaration; 2562 int accelaration;
2566 2563
2564 x = 10;
2567 toolbar(); 2565 toolbar();
2566 x = 0; y = 0;
2568 restore_screen(); 2567 restore_screen();
2569 inv_cursor(true); 2568 inv_cursor(true);
2570 2569