Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: PixelBuffer.cpp
- Revision:
- 34:5a141ed5d52a
- Parent:
- 32:64c391617f6c
- Child:
- 35:dffa06d09fdc
--- a/PixelBuffer.cpp Mon Oct 31 17:50:12 2016 +0000
+++ b/PixelBuffer.cpp Fri Nov 04 13:19:38 2016 +0000
@@ -95,6 +95,13 @@
{
if (index + len > _numPixels)
len = _numPixels - index;
+
+ if (index < 0)
+ {
+ len = len - (-index);
+ color += (-index);
+ index = 0;
+ }
memcpy(&_pixels[index], color, len * sizeof(_pixels[0]));
}
}
@@ -105,6 +112,14 @@
{
if (index + len > _numPixels)
len = _numPixels - index;
+
+ if (index < 0)
+ {
+ len = len - (-index);
+ color += (-index);
+ index = 0;
+ }
+
RGBColor *dest = &_pixels[index];
do
{
@@ -299,6 +314,14 @@
{
if (index + len > _numPixels)
len = _numPixels - index;
+
+ if (index < 0)
+ {
+ len = len - (-index);
+ color += (-index);
+ index = 0;
+ }
+
memcpy(&_pixels[index], color, len * sizeof(_pixels[0]));
}
}
@@ -309,6 +332,14 @@
{
if (index + len > _numPixels)
len = _numPixels - index;
+
+ if (index < 0)
+ {
+ len = len - (-index);
+ color += (-index);
+ index = 0;
+ }
+
HSVColor *dest = &_pixels[index];
do
{