SG12864A
Dependents: SG12864A_TestProgram
Diff: SG12864A.cpp
- Revision:
- 4:200d1ea4e76e
- Parent:
- 3:86e7fba29623
- Child:
- 5:4d86043f7942
diff -r 86e7fba29623 -r 200d1ea4e76e SG12864A.cpp --- a/SG12864A.cpp Tue Jul 20 07:23:15 2010 +0000 +++ b/SG12864A.cpp Tue Aug 10 12:36:05 2010 +0000 @@ -3,6 +3,9 @@ * * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) * http://shinta.main.jp/ + * + * See also ... + * http://mbed.org/users/shintamainjp/notebook/sg12864asunlike-display-graphics-lcd-driver/ */ #include "SG12864A.h" @@ -315,8 +318,13 @@ } int tmp_max = max - min; int tmp_val = value - min; - int pix = ((x2 - x1) * tmp_val) / tmp_max; - bufferFillBox(x1 + 1, y1 + 1, x1 + pix - 1, y2 - 1, reverse); + if (horizontal) { + int pix = ((y2 - y1) * tmp_val) / tmp_max; + bufferFillBox(x1 + 1, y1 + 1, x1 - 1, y2 + pix - 1, reverse); + } else { + int pix = ((x2 - x1) * tmp_val) / tmp_max; + bufferFillBox(x1 + 1, y1 + 1, x1 + pix - 1, y2 - 1, reverse); + } } /**