diff options
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/gray_core.c | 79 |
1 files changed, 77 insertions, 2 deletions
diff --git a/apps/plugins/lib/gray_core.c b/apps/plugins/lib/gray_core.c index c162349f76..89d12ca58b 100644 --- a/apps/plugins/lib/gray_core.c +++ b/apps/plugins/lib/gray_core.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #ifdef HAVE_LCD_BITMAP | 29 | #ifdef HAVE_LCD_BITMAP |
30 | #include "gray.h" | 30 | #include "gray.h" |
31 | 31 | ||
32 | #ifdef CPU_PP | 32 | #if defined(CPU_PP) && defined(HAVE_ADJUSTABLE_CPU_FREQ) |
33 | #define NEED_BOOST | 33 | #define NEED_BOOST |
34 | #endif | 34 | #endif |
35 | 35 | ||
@@ -1469,11 +1469,16 @@ static const unsigned char bmpheader[] = | |||
1469 | static void gray_screendump_hook(int fd) | 1469 | static void gray_screendump_hook(int fd) |
1470 | { | 1470 | { |
1471 | int i; | 1471 | int i; |
1472 | int x, y, by; | 1472 | int x, y; |
1473 | int gx, gy, mask; | 1473 | int gx, gy, mask; |
1474 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | ||
1475 | unsigned data; | ||
1476 | #else | ||
1477 | int by; | ||
1474 | #if LCD_DEPTH == 2 | 1478 | #if LCD_DEPTH == 2 |
1475 | int shift; | 1479 | int shift; |
1476 | #endif | 1480 | #endif |
1481 | #endif | ||
1477 | unsigned char *clut_entry; | 1482 | unsigned char *clut_entry; |
1478 | unsigned char *lcdptr; | 1483 | unsigned char *lcdptr; |
1479 | unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; | 1484 | unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; |
@@ -1499,6 +1504,75 @@ static void gray_screendump_hook(int fd) | |||
1499 | _gray_rb->memset(linebuf, 0, BMP_LINESIZE); | 1504 | _gray_rb->memset(linebuf, 0, BMP_LINESIZE); |
1500 | 1505 | ||
1501 | gy = y - _gray_info.y; | 1506 | gy = y - _gray_info.y; |
1507 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | ||
1508 | #if LCD_DEPTH == 2 | ||
1509 | lcdptr = _gray_rb->lcd_framebuffer + MULU16(LCD_FBWIDTH, y); | ||
1510 | |||
1511 | if ((unsigned) gy < (unsigned) _gray_info.height) | ||
1512 | { | ||
1513 | /* line contains greyscale (and maybe b&w) graphics */ | ||
1514 | #ifndef SIMULATOR | ||
1515 | unsigned char *grayptr = _gray_info.plane_data | ||
1516 | + MULU16(_gray_info.bwidth, gy); | ||
1517 | #endif | ||
1518 | |||
1519 | for (x = 0; x < LCD_WIDTH; x += 4) | ||
1520 | { | ||
1521 | gx = x - _gray_info.x; | ||
1522 | |||
1523 | if ((unsigned)gx < (unsigned)_gray_info.width) | ||
1524 | { | ||
1525 | #ifdef SIMULATOR | ||
1526 | data = MULU16(gy, _gray_info.width) + gx; | ||
1527 | |||
1528 | for (i = 0; i < 4; i++) | ||
1529 | linebuf[x + i] = BMP_FIXEDCOLORS + _gray_info.depth | ||
1530 | - _gray_info.cur_buffer[data + i]; | ||
1531 | #else | ||
1532 | mask = 0x80 >> (gx & 7); | ||
1533 | |||
1534 | for (i = 0; i < 4; i++) | ||
1535 | { | ||
1536 | int j; | ||
1537 | int idx = BMP_FIXEDCOLORS; | ||
1538 | unsigned char *grayptr2 = grayptr + (gx >> 3); | ||
1539 | |||
1540 | for (j = _gray_info.depth; j > 0; j--) | ||
1541 | { | ||
1542 | if (*grayptr2 & mask) | ||
1543 | idx++; | ||
1544 | grayptr2 += _gray_info.plane_size; | ||
1545 | } | ||
1546 | linebuf[x + i] = idx; | ||
1547 | mask >>= 1; | ||
1548 | } | ||
1549 | #endif | ||
1550 | } | ||
1551 | else | ||
1552 | { | ||
1553 | data = *lcdptr; | ||
1554 | linebuf[x] = (data >> 6) & 3; | ||
1555 | linebuf[x + 1] = (data >> 4) & 3; | ||
1556 | linebuf[x + 2] = (data >> 2) & 3; | ||
1557 | linebuf[x + 3] = data & 3; | ||
1558 | } | ||
1559 | lcdptr++; | ||
1560 | } | ||
1561 | } | ||
1562 | else | ||
1563 | { | ||
1564 | /* line contains only b&w graphics */ | ||
1565 | for (x = 0; x < LCD_WIDTH; x += 4) | ||
1566 | { | ||
1567 | data = *lcdptr++; | ||
1568 | linebuf[x] = (data >> 6) & 3; | ||
1569 | linebuf[x + 1] = (data >> 4) & 3; | ||
1570 | linebuf[x + 2] = (data >> 2) & 3; | ||
1571 | linebuf[x + 3] = data & 3; | ||
1572 | } | ||
1573 | } | ||
1574 | #endif /* LCD_DEPTH */ | ||
1575 | #else /* LCD_PIXELFORMAT == VERTICAL_PACKING */ | ||
1502 | #if LCD_DEPTH == 1 | 1576 | #if LCD_DEPTH == 1 |
1503 | mask = 1 << (y & 7); | 1577 | mask = 1 << (y & 7); |
1504 | by = y >> 3; | 1578 | by = y >> 3; |
@@ -1599,6 +1673,7 @@ static void gray_screendump_hook(int fd) | |||
1599 | linebuf[x] = (*lcdptr++ >> shift) & 3; | 1673 | linebuf[x] = (*lcdptr++ >> shift) & 3; |
1600 | } | 1674 | } |
1601 | #endif /* LCD_DEPTH */ | 1675 | #endif /* LCD_DEPTH */ |
1676 | #endif /* LCD_PIXELFORMAT */ | ||
1602 | 1677 | ||
1603 | _gray_rb->write(fd, linebuf, BMP_LINESIZE); | 1678 | _gray_rb->write(fd, linebuf, BMP_LINESIZE); |
1604 | } | 1679 | } |