@@ -31,6 +31,13 @@ Original Source:
3131#include < cmath>
3232#include < list>
3333
34+ #ifdef min
35+ #undef min
36+ #endif
37+ #ifdef max
38+ #undef max
39+ #endif
40+
3441namespace lgfx
3542{
3643 inline namespace v1
@@ -1095,31 +1102,31 @@ namespace lgfx
10951102 result[5 ] = dst_y - src_x * result[3 ] - src_y * result[4 ];
10961103 }
10971104
1098- static bool make_invert_affine32 (int32_t * __restrict__ result, const float * __restrict__ matrix)
1105+ static bool make_invert_affine32 (int32_t * __restrict result, const float * __restrict matrix)
10991106 {
11001107 float det = matrix[0 ] * matrix[4 ] - matrix[1 ] * matrix[3 ];
11011108 if (det == 0 .0f ) return false ;
11021109 det = (1 << FP_SCALE) / det;
1103- result[0 ] = roundf (det * matrix[4 ]);
1104- result[1 ] = roundf (det * -matrix[1 ]);
1105- result[2 ] = roundf (det * (matrix[1 ] * matrix[5 ] - matrix[2 ] * matrix[4 ]));
1106- result[3 ] = roundf (det * -matrix[3 ]);
1107- result[4 ] = roundf (det * matrix[0 ]);
1108- result[5 ] = roundf (det * (matrix[2 ] * matrix[3 ] - matrix[0 ] * matrix[5 ]));
1110+ result[0 ] = ( int32_t ) roundf (det * matrix[4 ]);
1111+ result[1 ] = ( int32_t ) roundf (det * -matrix[1 ]);
1112+ result[2 ] = ( int32_t ) roundf (det * (matrix[1 ] * matrix[5 ] - matrix[2 ] * matrix[4 ]));
1113+ result[3 ] = ( int32_t ) roundf (det * -matrix[3 ]);
1114+ result[4 ] = ( int32_t ) roundf (det * matrix[0 ]);
1115+ result[5 ] = ( int32_t ) roundf (det * (matrix[2 ] * matrix[3 ] - matrix[0 ] * matrix[5 ]));
11091116 return true ;
11101117 }
11111118
11121119 void LGFXBase::push_image_rotate_zoom (float dst_x, float dst_y, float src_x, float src_y, float angle, float zoom_x, float zoom_y, int32_t w, int32_t h, pixelcopy_t * pc)
11131120 {
11141121 float matrix[6 ];
1115- make_rotation_matrix (matrix, dst_x + 0.5 , dst_y + 0.5 , src_x + 0.5 , src_y + 0.5 , angle, zoom_x, zoom_y);
1122+ make_rotation_matrix (matrix, dst_x + 0 .5f , dst_y + 0 .5f , src_x + 0 .5f , src_y + 0 .5f , angle, zoom_x, zoom_y);
11161123 push_image_affine (matrix, w, h, pc);
11171124 }
11181125
11191126 void LGFXBase::push_image_rotate_zoom_aa (float dst_x, float dst_y, float src_x, float src_y, float angle, float zoom_x, float zoom_y, int32_t w, int32_t h, pixelcopy_t * pc)
11201127 {
11211128 float matrix[6 ];
1122- make_rotation_matrix (matrix, dst_x + 0.5 , dst_y + 0.5 , src_x + 0.5 , src_y + 0.5 , angle, zoom_x, zoom_y);
1129+ make_rotation_matrix (matrix, dst_x + 0 .5f , dst_y + 0 .5f , src_x + 0 .5f , src_y + 0 .5f , angle, zoom_x, zoom_y);
11231130 push_image_affine_aa (matrix, w, h, pc);
11241131 }
11251132
@@ -1485,11 +1492,11 @@ namespace lgfx
14851492 p.src_bits = _read_conv.depth & color_depth_t ::bit_mask;
14861493 switch (_read_conv.depth )
14871494 {
1488- case color_depth_t ::rgb888_3Byte: p.fp_copy = pixelcopy_t ::compare_rgb_fast <bgr888_t >; break ;
1489- case color_depth_t ::rgb666_3Byte: p.fp_copy = pixelcopy_t ::compare_rgb_fast <bgr666_t >; break ;
1490- case color_depth_t ::rgb565_2Byte: p.fp_copy = pixelcopy_t ::compare_rgb_fast <swap565_t >; break ;
1491- case color_depth_t ::rgb332_1Byte: p.fp_copy = pixelcopy_t ::compare_rgb_fast <rgb332_t >; break ;
1492- default : p.fp_copy = pixelcopy_t ::compare_bit_fast ;
1495+ case color_depth_t ::rgb888_3Byte: p.fp_copy = pixelcopy_t ::compare_rgb_affine <bgr888_t >; break ;
1496+ case color_depth_t ::rgb666_3Byte: p.fp_copy = pixelcopy_t ::compare_rgb_affine <bgr666_t >; break ;
1497+ case color_depth_t ::rgb565_2Byte: p.fp_copy = pixelcopy_t ::compare_rgb_affine <swap565_t >; break ;
1498+ case color_depth_t ::rgb332_1Byte: p.fp_copy = pixelcopy_t ::compare_rgb_affine <rgb332_t >; break ;
1499+ default : p.fp_copy = pixelcopy_t ::compare_bit_affine ;
14931500 p.src_mask = (1 << p.src_bits ) - 1 ;
14941501 p.transp &= p.src_mask ;
14951502 break ;
@@ -1529,6 +1536,8 @@ namespace lgfx
15291536 it = points.begin ();
15301537
15311538 bufY[0 ] = it->y ;
1539+ p.src_x32_add = 1 << FP_SCALE;
1540+ p.src_y32_add = 0 ;
15321541 _panel->readRect (cl, it->y , w, 1 , linebufs[0 ], &p);
15331542 }
15341543 else
@@ -1569,6 +1578,8 @@ namespace lgfx
15691578 if (bidx == 3 ) {
15701579 for (bidx = 0 ; bidx < 2 && (abs (bufY[bidx] - ly) <= 1 ); ++bidx);
15711580 bufY[bidx] = newy;
1581+ p.src_x32_add = 1 << FP_SCALE;
1582+ p.src_y32_add = 0 ;
15721583 _panel->readRect (cl, newy, w, 1 , linebufs[bidx], &p);
15731584 }
15741585 auto linebuf = &linebufs[bidx][- cl];
@@ -1610,10 +1621,10 @@ namespace lgfx
16101621
16111622 static char * floatToStr (double number, char * buf, size_t /* buflen*/ , uint8_t digits)
16121623 {
1613- if (std::isnan (number)) { return strcpy ( buf, " nan" ); }
1614- if (std::isinf (number)) { return strcpy ( buf, " inf" ); }
1615- if (number > 4294967040.0 ) { return strcpy ( buf, " ovf" ); } // constant determined empirically
1616- if (number <-4294967040.0 ) { return strcpy ( buf, " ovf" ); } // constant determined empirically
1624+ if (std::isnan (number)) { return ( char *) memcpy ( buf, " nan\0 " , 4 ); }
1625+ if (std::isinf (number)) { return ( char *) memcpy ( buf, " inf\0 " , 4 ); }
1626+ if (number > 4294967040.0 ) { return ( char *) memcpy ( buf, " ovf\0 " , 4 ); } // constant determined empirically
1627+ if (number <-4294967040.0 ) { return ( char *) memcpy ( buf, " ovf\0 " , 4 ); } // constant determined empirically
16171628
16181629 char * dst = buf;
16191630 // Handle negative numbers
@@ -1996,7 +2007,7 @@ namespace lgfx
19962007 }
19972008
19982009#if !defined (ARDUINO)
1999- size_t LGFXBase::printf (const char * __restrict__ format, ...)
2010+ size_t LGFXBase::printf (const char * __restrict format, ...)
20002011 {
20012012 va_list arg;
20022013 va_start (arg, format);
@@ -2007,7 +2018,7 @@ namespace lgfx
20072018 }
20082019#endif
20092020
2010- size_t LGFXBase::vprintf (const char * __restrict__ format, va_list arg)
2021+ size_t LGFXBase::vprintf (const char * __restrict format, va_list arg)
20112022 {
20122023 char loc_buf[64 ];
20132024 char * temp = loc_buf;
@@ -2967,7 +2978,7 @@ namespace lgfx
29672978 uint_fast8_t panel_offsetrot = panel ()->config ().offset_rotation ;
29682979 uint_fast8_t touch_offsetrot = touch ()->config ().offset_rotation ;
29692980
2970- // 回転オフセットをキャンセルしてタッチデバイスのデフォルトの向きに合わせる
2981+ // 回転オフセットをキャンセルしてタッチデバイスのデフォルトの向きに合わせる;
29712982 setRotation (( (touch_offsetrot ^ panel_offsetrot) & 4 )
29722983 |(-(touch_offsetrot + panel_offsetrot) & 3 ));
29732984
0 commit comments