@@ -202,11 +202,10 @@ void
202
202
Ili9341<Interface, Reset, Backlight, BufferSize>::drawHorizontalLine(
203
203
glcd::Point start, uint16_t length)
204
204
{
205
- auto const fgColor { foregroundColor.getValue () };
205
+ uint16_t const pixelValue { modm::toBigEndian ( foregroundColor.getValue () ) };
206
206
auto minLength { std::min (std::size_t (length), BufferSize) };
207
207
uint16_t *buffer16 { reinterpret_cast <uint16_t *>(buffer) };
208
- for (std::size_t i = 0 ; i < minLength; ++i)
209
- buffer16[i] = modm::toBigEndian (fgColor);
208
+ std::fill (buffer16, buffer16+minLength, pixelValue);
210
209
211
210
BatchHandle h (*this );
212
211
@@ -224,11 +223,10 @@ void
224
223
Ili9341<Interface, Reset, Backlight, BufferSize>::drawVerticalLine(
225
224
glcd::Point start, uint16_t length)
226
225
{
227
- auto const fgColor { foregroundColor.getValue () };
226
+ uint16_t const pixelValue { modm::toBigEndian ( foregroundColor.getValue () ) };
228
227
auto minLength { std::min (std::size_t (length), BufferSize) };
229
228
uint16_t *buffer16 { reinterpret_cast <uint16_t *>(buffer) };
230
- for (std::size_t i = 0 ; i < minLength; ++i)
231
- buffer16[i] = modm::toBigEndian (fgColor);
229
+ std::fill (buffer16, buffer16+minLength, pixelValue);
232
230
233
231
BatchHandle h (*this );
234
232
@@ -250,11 +248,10 @@ Ili9341<Interface, Reset, Backlight, BufferSize>::fillRectangle(
250
248
auto const y { upperLeft.getY () };
251
249
std::size_t pixelCount { std::size_t (width) * std::size_t (height) };
252
250
253
- auto const fgColor { foregroundColor.getValue () };
251
+ uint16_t const pixelValue { modm::toBigEndian ( foregroundColor.getValue () ) };
254
252
auto minLength { std::min (std::size_t (pixelCount), BufferSize) };
255
253
uint16_t *buffer16 { reinterpret_cast <uint16_t *>(buffer) };
256
- for (std::size_t i = 0 ; i < minLength; ++i)
257
- buffer16[i] = modm::toBigEndian (fgColor);
254
+ std::fill (buffer16, buffer16+minLength, pixelValue);
258
255
259
256
BatchHandle h (*this );
260
257
@@ -350,6 +347,22 @@ Ili9341<Interface, Reset, Backlight, BufferSize>::drawImageRaw(glcd::Point upper
350
347
}
351
348
}
352
349
350
+ template <class Interface , class Reset , class Backlight , std::size_t BufferSize>
351
+ void
352
+ Ili9341<Interface, Reset, Backlight, BufferSize>::drawRaw(glcd::Point upperLeft,
353
+ uint16_t width, uint16_t height, glcd::Color* data)
354
+ {
355
+ BatchHandle h (*this );
356
+
357
+ uint16_t * buffer = (uint16_t *)data;
358
+ for (size_t i = 0 ; i < size_t (width*height); i++) {
359
+ buffer[i] = modm::fromBigEndian (buffer[i]);
360
+ }
361
+
362
+ setClipping (upperLeft.getX (), upperLeft.getY (), width, height);
363
+ this ->writeData ((uint8_t *)buffer, width * height * 2 );
364
+ }
365
+
353
366
template <class Interface , class Reset , class Backlight , std::size_t BufferSize>
354
367
void
355
368
Ili9341<Interface, Reset, Backlight, BufferSize>::setScrollArea(
0 commit comments