Permalink
Browse files

Tweaks for Adafruit_GFX

  • Loading branch information...
1 parent f6ea8db commit 0f70b3fbfd1040140080b9c436b96aaabfdcede7 @PaintYourDragon PaintYourDragon committed Apr 10, 2012
Showing with 7 additions and 7 deletions.
  1. +4 −4 Adafruit_GP9002.cpp
  2. +2 −2 Adafruit_GP9002.h
  3. +1 −1 examples/GraphicVFDtest/GraphicVFDtest.pde
View
@@ -75,8 +75,8 @@ void Adafruit_GP9002::begin(void) {
// updated high speed drawing!
-void Adafruit_GP9002::drawFastVLine(uint16_t x, uint16_t orig_y, uint16_t h, uint16_t color) {
- if ((x >= width()) || (orig_y >= height())) return;
+void Adafruit_GP9002::drawFastVLine(int16_t x, int16_t orig_y, int16_t h, uint16_t color) {
+ if ((x < 0) || (x >= width()) || (orig_y >= height())) return;
//if ((orig_y+h) >= height())
// h = height() - orig_y -1;
@@ -125,8 +125,8 @@ void Adafruit_GP9002::drawFastVLine(uint16_t x, uint16_t orig_y, uint16_t h, uin
}
// the most basic function, set a single pixel
-void Adafruit_GP9002::drawPixel(uint16_t x, uint16_t y, uint16_t color) {
- if ((x >= width()) || (y >= height()))
+void Adafruit_GP9002::drawPixel(int16_t x, int16_t y, uint16_t color) {
+ if ((x < 0) || (x >= width()) || (y < 0) || (y >= height()))
return;
uint8_t p;
View
@@ -65,8 +65,8 @@ class Adafruit_GP9002 : public Adafruit_GFX {
void displayOff();
void clearDisplay(void);
- void drawPixel(uint16_t x, uint16_t y, uint16_t color);
- void drawFastVLine(uint16_t x, uint16_t y, uint16_t h, uint16_t color);
+ void drawPixel(int16_t x, int16_t y, uint16_t color);
+ void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
private:
int8_t _miso, _mosi, _sclk, _dc, _cs;
@@ -188,7 +188,7 @@ void testfillrect(void) {
}
void testdrawtriangle(void) {
- for (uint16_t i=0; i<min(display.width(),display.height())/2; i+=5) {
+ for (int16_t i=0; i<min(display.width(),display.height())/2; i+=5) {
display.drawTriangle(display.width()/2, display.height()/2-i,
display.width()/2-i, display.height()/2+i,
display.width()/2+i, display.height()/2+i, WHITE);

0 comments on commit 0f70b3f

Please sign in to comment.